Abstract: In the context of multi-step reasoning, e.g., with chain-of-thought, language models (LMs) can easily assign a high likelihood to incorrect steps. As a result, decoding strategies that optimize for solution likelihood often yield incorrect solutions. To address this issue, we propose Guiding chain-of-thought ReAsoning with a CorrectnEss Discriminator (GRACE), a stepwise decoding approach that steers the decoding process towards producing correct reasoning steps. GRACE employs a discriminator trained with a contrastive loss over correct and incorrect steps, which is used during decoding to score next-step candidates based on their correctness. Importantly, GRACE only requires sampling from the LM, without the need for LM training or fine-tuning. Using models from FLAN-T5 and LLaMA families, we evaluate GRACE over four math and two symbolic reasoning tasks, where it exhibits substantial performance gains compared to greedy decoding, verifiers, and self-consistency in most settings. When further combined with self-consistency, GRACE outperforms all the baselines by sizeable margins. Human and LLM evaluations over GSM8K show that GRACE not only improves the final answer accuracy but also the correctness of the intermediate reasoning.
Introduction
Large Language Models (LLMs) have significantly advanced in complex reasoning through Chain-of-Thought (CoT) prompting. However, these models often generate logically flawed reasoning chains because their primary training objective—next-token prediction—prioritizes linguistic probability over factual or logical correctness. This often leads to a "hallucination rabbit hole," where a single early error propagates through the entire solution, making recovery impossible.
Existing solutions like Supervised Fine-Tuning (SFT) are computationally expensive, while outcome-based verifiers (e.g., Self-Consistency) only evaluate the final answer, ignoring the validity of intermediate steps. GRACE (Guiding chain-of-thought ReAsoning with a CorrectnEss Discriminator) addresses this by providing step-level guidance during the decoding process using a specialized, lightweight discriminator.
Methods
The GRACE framework utilizes a three-stage process to train and deploy a correctness discriminator without requiring manual annotation of intermediate steps.
- Negative Sampling & Automatic Alignment: The system samples incorrect solutions from the base LM and aligns them with gold-standard reference solutions using a modified Needleman-Wunsch algorithm. This process automatically identifies exactly where the model's logic diverged, creating a dataset of correct vs. incorrect "next steps" for any given reasoning prefix.
- Discriminator Learning: A relatively small encoder (such as FLAN-T5-Large, ~340M parameters) is trained on this aligned data using a max-margin contrastive loss. The objective is to ensure the discriminator assigns higher scores to logically sound steps than to flawed ones.
- Guided Stepwise Decoding: During inference, the LM generates a pool of candidate next steps. Each candidate is scored by a weighted combination of the LM’s original probability and the discriminator’s correctness score. The highest-scoring step is selected, and the process repeats until the solution is complete.
Key Results
GRACE was evaluated across six reasoning benchmarks, including math (GSM8K, MathQA, SVAMP, MultiArith) and symbolic reasoning (Coin Flip, Tracking Shuffled Objects).
- Accuracy Boosts: On GSM8K, GRACE improved the accuracy of LLaMA-7B by 5.4% over greedy decoding. When combined with Self-Consistency (GRACE + SC), it outperformed vanilla SC by 10.2% on GSM8K and 15.7% on MultiArith.
- Reasoning Quality: Human evaluation on GSM8K showed that GRACE reduced "trace errors" (logical mistakes in solutions that still reach the correct final answer) by 44%, dropping from 9.0% to 5.0%.
- Efficiency: GRACE is more sample-efficient than standard voting methods. By intervening at every step, it keeps the model on the correct path rather than generating numerous flawed full-length solutions.
Insights and Discussion
A striking finding is the effectiveness of small guides for giant models: a 340M parameter discriminator can effectively steer models 20x to 40x its size (like LLaMA-13B). This suggests that recognizing a logical error is a significantly lighter task than generating the reasoning itself. Additionally, a discriminator trained on one task (e.g., GSM8K) provides performance gains on others (e.g., SVAMP), indicating it learns general principles of mathematical logic.
Limitations and Future Work
While powerful, GRACE introduces inference overhead because it requires sampling and scoring a pool of candidates at every step. Furthermore, the method is upper-bounded by the base LM's sampling pool; if the model fails to generate any correct next-step candidates, the discriminator cannot intervene. Future work may involve using these alignment-based signals for Reinforcement Learning from Human Feedback (RLHF) to further refine base model performance.
Summary updated