Step-Controlled DPO: Leveraging Stepwise Error for Enhanced Mathematical Reasoning

Zimu Lu, Aojun Zhou, Ke Wang, Houxing Ren, Weikang Shi, Junting Pan, Mingjie Zhan, Hongsheng LiarXiv 2024 · DOI

Mathematical reasoning represents a significant challenge for Large Language Models (LLMs). While Direct Preference Optimization (DPO) has emerged as a standard for aligning these models with human preferences, it traditionally relies on "outcome-based" feedback. In this paradigm, if a final answer is correct, the entire reasoning chain is treated as positive; if incorrect, the entire chain is penalized.

Researchers at the Chinese University of Hong Kong (CUHK) argue that this approach is too coarse for complex logic. They introduce Step-Controlled DPO (SCDPO), a method that automatically generates training data to pinpoint exactly where a derivation goes wrong, allowing for more granular credit assignment.

The Challenge of Credit Assignment

The primary hurdle in training LLMs for mathematics is the "credit assignment" problem. In standard DPO, a model compares a correct solution (preferred) with an incorrect one (dispreferred). However, an incorrect solution often contains several valid logical steps before a single calculation error or logical lapse occurs.

Standard DPO penalizes the entire incorrect chain equally, which introduces noise into the training signal. It is analogous to a teacher failing a student on a multi-page proof due to a single typo on the final line. While "process supervision" (labeling every individual step) can solve this, it typically requires expensive, expert human annotation. SCDPO provides a scalable, automated alternative.

Methodology: Step-Controlled Data Generation

The core of SCDPO is a two-stage pipeline consisting of Step-Controlled Data Generation and Step-Aware Training.

Figure 1: The SCDPO pipeline showing automated error generation via temperature ramping and the resulting divergence pairings.
  1. Automated Error Generation: The process begins with a set of correct solutions. To create a "dispreferred" counterpart, the system selects a random intermediate step ($k$) from a correct solution. The model is then prompted to complete the solution from that point, but with a gradually increasing temperature (ramping from 1.1 to 1.4). This encourages the model to eventually deviate into an error while maintaining linguistic coherence. Only attempts that result in an incorrect final answer are retained.
  2. Divergence Pairing: This results in a pair where the preferred and dispreferred samples are identical up to step $k$, creating a clear point of divergence.
  3. Step-Aware Loss: During training, the DPO loss function is modified to focus exclusively on tokens after the divergence point. By ignoring the identical (and correct) prefixes, the gradient signal becomes cleaner, preventing the model from "unlearning" correct reasoning habits while trying to fix specific errors.

Key Insights and Credit Assignment

A major advantage of SCDPO is its ability to correctly identify the "divergence point" where logic fails. Qualitative visualizations of the model's internal reward maps show that standard DPO often fails to highlight the specific error.

Figure 2: Comparison of credit assignment between SCDPO and standard DPO. SCDPO correctly identifies the specific logical error in the reasoning chain.

As seen in the visualization above, SCDPO assigns a significantly lower reward to the exact tokens where the logic fails—for instance, when the model incorrectly interprets "4 less than a dozen" as a multiplication rather than a subtraction. This precision allows the model to learn the specific boundaries of correct mathematical logic.

Experimental Results

The researchers evaluated SCDPO across multiple benchmarks, including GSM8K (grade school math) and MATH (competition-level math), using both Mistral-7B and InternLM2-20B architectures.

  • Performance Gains: On the GSM8K benchmark, SCDPO improved the Mistral-7B baseline from 76.8% to 80.1%, notably outperforming standard DPO (78.8%).
  • State-of-the-Art Results: The InternLM2-20B-SCDPO model achieved 88.5% on GSM8K and 58.1% on MATH. These results are among the highest for open-source models of this size, rivaling the performance of much larger models and approaching the capabilities of closed-source systems like GPT-4.
  • Cross-Lingual Generalization: The method proved robust across languages, showing consistent improvements on Chinese mathematical datasets such as APE210K and CMATH.

Limitations and Future Directions

Despite its success, SCDPO has limitations. As a text-only method, it struggles with geometry problems that require spatial reasoning. Additionally, while it handles interleaved code and text well, it is not yet optimized for solutions that consist entirely of code. Future work may involve integrating verification or reward models to further mitigate hallucinations and extending the method to multi-modal mathematical reasoning.

Summary updated

BibTeX
@misc{lu2024step,
  author = {Zimu Lu and Aojun Zhou and Ke Wang and Houxing Ren and Weikang Shi and Junting Pan and Mingjie Zhan and Hongsheng Li},
  title = {{Step-Controlled DPO: Leveraging Stepwise Error for Enhanced Mathematical Reasoning}},
  year = {2024},
  eprint = {2407.00782},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.00782},
}
Figure