Abstract
Although large language models demonstrate strong performance across various domains, they still struggle with numerous bad cases in mathematical reasoning. Previous approaches to learning from errors synthesize training data by solely extrapolating from isolated bad cases, thereby failing to generalize the extensive patterns inherent within these cases. This paper presents Self-Error-Instruct (SEI), a framework that addresses these model weaknesses and synthesizes more generalized targeted training data. Specifically, we explore a target model on two mathematical datasets, GSM8K and MATH, to pinpoint bad cases. Then, we generate error keyphrases for these cases based on the instructor model’s (GPT-4o) analysis and identify error types by clustering these keyphrases. Next, we sample a few bad cases during each generation for each identified error type and input them into the instructor model, which synthesizes additional training data using a self-instruct approach. This new data is refined through a one-shot learning process to ensure that only the most effective examples are kept. Finally, we use these curated data to fine-tune the target model, iteratively repeating the process to enhance performance. We apply our framework to various models and observe improvements in their reasoning abilities across both in-domain and out-of-domain mathematics datasets. These results demonstrate the effectiveness of self-error instruction in improving LLMs’ mathematical reasoning through error generalization.
Introduction
Large Language Models (LLMs) have achieved remarkable success in many fields, yet complex mathematical reasoning remains a significant challenge. When models fail at math, they often do so in predictable ways. However, existing "learning from errors" methods typically adopt a "whack-a-mole" approach: they fix specific instances of failure but fail to address the broader underlying reasoning weaknesses. For example, if a model fails a geometry problem due to a unit conversion error, training on that specific problem may not teach the general principle of conversion. This paper introduces Self-Error-Instruct (SEI), a framework designed to move beyond isolated corrections toward learning from broad error patterns.
The Self-Error-Instruct Framework
The SEI pipeline is a four-stage process designed to systematically identify and "patch" a model's reasoning holes by focusing on error types rather than individual mistakes:
- Bad Case Extraction: The target model (e.g., Qwen2.5-Math-7B) is evaluated on standard datasets like GSM8K and MATH. Problems where the model's output differs from the ground truth are collected into an error dataset.
- Self-Error-Instruct (Core Innovation):
- Keyphrase Generation: An instructor model (GPT-4o) analyzes the failed reasoning paths to generate concise keyphrases describing the error (e.g., "weekly hours miscalculation").
- Clustering: These keyphrases are clustered into distinct error types, such as Arithmetic Errors or Problem Understanding Errors.
- Data Synthesis: For each identified error type, the instructor model synthesizes new, challenging math problems that specifically target that category of failure.
- One-shot Learning Selection: To ensure high data quality, synthetic examples are filtered using a "one-shot" test. A synthetic example is kept only if using it as a prompt helps the target model solve a different known bad case without breaking cases it already solves correctly.
- Iterative Training: The target model is fine-tuned on this curated, error-type-specific data. This process can be repeated to continuously refine the model as its error patterns evolve.
Experimental Results
The researchers evaluated the SEI framework across several models, including Llama3-8B-Instruct, Qwen2.5-Math-7B, and Mathstral-7B. To test generalization, the models were evaluated on both in-domain datasets and four Out-of-Domain (OOD) benchmarks: TAL-SCQ (K-12 math), GaoKaoBench-Math (Chinese high school exams), SAT-MATH, and CollegeMath.
Performance and Generalization
Qwen2.5-Math-7B showed the most dramatic improvement, with its average score across all benchmarks jumping from 32.77% to 57.71%, representing a 24.94% absolute gain. Notably, the model demonstrated significant generalization to OOD datasets. For instance, performance on the GaoKao benchmark improved by 42.1 points, proving that the error-type approach successfully taught broader reasoning skills rather than just memorizing training instances.
Conclusion and Future Work
The Self-Error-Instruct framework demonstrates that clustering errors provides a much stronger signal for model improvement than treating every mistake as unique. By targeting the underlying categories of weakness, SEI allows models to "see" and correct their own reasoning patterns. While the current reliance on high-end instructor models like GPT-4o presents a cost barrier, future research will focus on making the system more autonomous, enabling models to identify and cluster their own errors independently.
Summary updated