Abstract
Large Language Models (LLMs) often struggle with mathematical reasoning due to a lack of internal self-correction mechanisms. When a model makes a single error in a chain-of-thought, it typically continues along a flawed path, leading to incorrect conclusions. This paper introduces LEMMA (Learning from Errors for MatheMatical Advancement), a novel fine-tuning framework that trains models on "incorrect-to-correct" trajectories. By teaching models to identify, critique, and rectify their own mistakes mid-stream, LEMMA enables autonomous self-correction during inference without the need for external verifiers or computationally expensive search algorithms.
Introduction
While current LLMs demonstrate impressive capabilities in solving complex math problems, their training is predominantly focused on "gold standard" correct solutions. This creates a "brilliant but brittle" paradigm: models are proficient at following a correct path but lack the reflective capacity to recover once they deviate from it. Existing solutions often rely on external machinery, such as Monte Carlo Tree Search (MCTS) or separate reward models, to prune incorrect reasoning branches. However, these methods do not improve the model's internal reasoning or its ability to self-correct during a single generation.
LEMMA addresses this by treating error data as a valuable learning resource. By systematically generating diverse error types and teaching the model to either patch the error or restart with a superior strategy, LEMMA fosters an "inner voice" for self-correction.
Methodology
The LEMMA framework utilizes a systematic pipeline to transform reasoning errors into learning opportunities through five key components:
1. Error Taxonomy
The authors categorized common mathematical errors into a structured taxonomy, including Question Misinterpretation (QM), Formula Confusion (FC), and Calculation Error (CA). This taxonomy ensures that the training data covers a realistic spectrum of failure modes.
2. Error-Type Grounded Mistake Augmentation
Rather than relying on high-temperature sampling—which often produces nonsensical or illogical errors—LEMMA uses a high-capability "teacher model" (e.g., GPT-4o) to intentionally inject specific, plausible errors into reasoning paths based on the defined taxonomy. This ensures the errors are representative of the logical lapses a model might actually encounter.
3. Early Truncation
A critical finding in the LEMMA framework is that for an error to be an effective teaching tool, the trajectory must be truncated at the first erroneous step. This prevents the model from learning to "reason through" nonsense, focusing the training on the exact moment the logic fails.
4. Correction Strategies
LEMMA employs two distinct strategies for recovery:
- Fix & Continue: The model identifies the specific error, corrects it, and completes the original reasoning path.
- Fresh & Restart: The model critiques the error and abandons the current path entirely to start a new, often more efficient or "smarter" approach. This mimics the human "aha!" moment when a person realizes their initial strategy was fundamentally flawed.
5. Model-Aware Smooth Reflection
To bridge the gap between the error and the correction, the framework uses natural language "reflection links" (e.g., "Wait, let's ensure this is right. Calculating carefully..."). These links make the transition feel like a natural human thought process, allowing the model to trigger self-correction autonomously during inference.
Experimental Setup
Training and Evaluation
The models were fine-tuned on approximately 89,000 error-corrective trajectories synthesized from the training sets of GSM8K and MATH. Evaluation was conducted across several dimensions:
- In-Domain: GSM8K and MATH test sets.
- Out-of-Distribution (OOD): ASDIV, MAWPS, SVAMP, Mathematics, and College-Math.
- Reflective Reasoning: MathChat (FQA and EC), which specifically tests multi-turn reflection.
Key Results and Insights
Performance Gains
LEMMA-trained models showed significant improvements across the board. On LLaMA3-8B, LEMMA improved average accuracy by 13.3% compared to standard Supervised Fine-Tuning (SFT). Notably, it achieved 38.3% on the MATH benchmark, outperforming prior error-aware methods like ISC and RefAug. When applied to the math-specialized DeepSeekMath-7B, LEMMA pushed the average score from 58.4% to 70.1%.
Generalization and Error Reduction
The framework demonstrated strong generalization on the "College-Math" benchmark—a set significantly harder than the training data—improving LLaMA3-8B's performance from 13.3% to 24.7%. Analysis also confirmed that LEMMA specifically reduces the frequency of the most common error types, such as Question Misinterpretation and Calculation Errors.
The "Fresh & Restart" Advantage
One of the most impactful insights was the effectiveness of the "Fresh & Restart" strategy. Teaching the model to recognize when a chosen method is overly complex and to pivot to a simpler strategy proved more effective than merely patching calculation errors in a flawed strategy.
Conclusion and Future Work
LEMMA demonstrates that learning from failure is as critical for LLMs as it is for humans. By internalizing the ability to self-correct, models become more robust and less dependent on external verification.
While the current results are promising, the authors suggest that scaling the error-corrective dataset beyond 90k samples could yield further gains. Additionally, LEMMA-tuned models provide an excellent foundation for Reinforcement Learning (RL). Because these models already possess a preliminary reflection capability, they are well-suited for rule-based RL (similar to the training of DeepSeek-R1), which represents a primary direction for future research.
Summary updated