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 step-level verifier or 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.
What Problem Does This Paper Address?
Large Language Models (LLMs) have revolutionized complex reasoning through Chain-of-Thought (CoT) prompting. However, they suffer from a fundamental flaw: the objective they are trained on—next-token prediction—does not inherently prioritize logical correctness. An LM can assign a very high probability to a reasoning step that is mathematically or logically "hallucinated."
Existing solutions like Self-Consistency (sampling many paths and taking a majority vote) or Solution Verifiers (ranking completed solutions) are "post-hoc." They act on the output after the generation is complete and cannot intervene when a model starts veering off-track early in a reasoning chain. Furthermore, training step-level verifiers usually requires massive amounts of expensive human-annotated data to label which specific steps are right or wrong.
Methods
GRACE introduces a three-stage pipeline to build and deploy a step-level discriminator without requiring human labels:
- Negative Sampling & Automatic Alignment: The authors sample multiple solutions from an LM and identify those with incorrect final answers. To pinpoint the exact logical failure, they use a modified Needleman-Wunsch algorithm to align incorrect sampled steps with a "gold" reference solution. This automatically identifies "missing," "extra," or "comparable but incorrect" steps.
- Discriminator Training: Using these automatically labeled steps, a step-level discriminator (e.g., a T5-Large encoder) is trained using a contrastive max-margin loss. The goal is to ensure the discriminator assigns a higher score to a correct step than to an incorrect one, given the same problem context and reasoning prefix.
- Guided Stepwise Decoding: During inference, the base LM samples a pool of $J$ candidate next steps. GRACE scores each candidate using a weighted combination of the LM's log-probability and the discriminator's correctness score: $$\text{Score} = (1 - \beta) \log p_{LM} + \beta D(q, r, s)$$ This allows the discriminator to "nudge" the model toward the logically sound path, even if that path wasn't the model's most probable choice.
Key Insights and Ideas
- The "Probability ≠ Correctness" Gap: The paper confirms that LMs often assign higher probabilities to incorrect steps than correct ones. This justifies the need for an external "judge" during decoding.
- Small Models Can Guide Giants: A relatively small discriminator (e.g., a 340M parameter T5-Large) can effectively guide a much larger model (e.g., LLaMA-13B). The discriminator only needs to recognize errors, not generate text.
- Step-Level Control is Superior: By intervening at every step, GRACE is more sample-efficient than Self-Consistency, pruning bad reasoning paths early before they compound.
- Generalization: A discriminator trained on one math dataset (like GSM8K) can still provide a performance boost on others (like SVAMP), suggesting it learns general features of mathematical correctness.
Key Results
- Accuracy Boosts: On GSM8K, GRACE improved FLAN-T5-Large accuracy by 7.4% and LLaMA-7B by 5.4% over greedy decoding.
- Synergy with Self-Consistency: When combined with Self-Consistency (GRACE w/ SC), it outperforms all baselines. On MultiArith, it boosted LLaMA-7B performance from 78.9% (Vanilla SC) to 94.6%.
- Improved "Trace Error": Human evaluations showed that GRACE reduces the "trace error" (the presence of at least one major mistake in a solution) by 44% compared to greedy decoding.
Limitations and Future Work
- Computational Overhead: Sampling multiple candidates for every reasoning step adds significant latency compared to greedy decoding.
- Sampling Quality: GRACE is upper-bounded by the LM's ability to generate at least one correct candidate in its pool. If the LM cannot produce the correct next step, the discriminator has no valid path to choose.
- Dependency on Gold Solutions: While it avoids human step-labels, it still requires a set of problems with known correct solutions to train the discriminator.
Summary updated