Abstract
Chain-of-Thought (CoT) prompting has significantly advanced the reasoning capabilities of Large Language Models (LLMs). However, standard CoT remains sensitive to intermediate logical errors. We present Contrastive Chain-of-Thought Prompting, a method that enhances LLM reasoning by providing both valid and invalid reasoning demonstrations in the prompt. By contrasting correct logic with common pitfalls, this approach helps models distinguish between valid and invalid reasoning steps. Our evaluation across seven benchmarks demonstrates improvements of up to 16 points in reasoning accuracy.
Introduction
Large Language Models (LLMs) often struggle with complex reasoning tasks where a single logical error in an intermediate step leads to an incorrect final answer. While Chain-of-Thought (CoT) prompting encourages step-by-step reasoning, it often fails to teach the model the underlying logic, instead acting as a template for formatting. Recent studies suggest that LLMs can sometimes achieve similar performance even when provided with invalid reasoning chains, indicating that standard CoT does not sufficiently define the boundaries of correct logic.
To address this "brittleness," we propose Contrastive CoT. Inspired by how humans learn from both positive and negative examples, this method provides the model with a contrastive context: a correct reasoning path paired with an incorrect one.
Methodology: Contrastive Prompting
The core of Contrastive CoT is the modification of the few-shot prompt structure. Instead of the standard (Question, Explanation, Answer) triplet, we use a quadruplet: Question, Valid Explanation, Invalid Explanation, and Answer.
Generating Invalid Explanations
To scale this approach without manual annotation, we developed an automated pipeline for generating "hard negatives." We identify "bridging objects"—such as numbers, names, or equations—within a valid reasoning chain using entity recognition. By randomly shuffling these objects, we create an explanation that maintains the correct format but contains logical inconsistencies (e.g., using the wrong numbers in a calculation).
Experimental Setup
We evaluated the method using GPT-3.5-Turbo with 4-shot prompting across seven diverse reasoning benchmarks:
- Arithmetic Reasoning: GSM8K, AQuA, GSM-Hard, SVAMP, and ASDIV.
- Factual Question Answering: Bamboogle and StrategyQA.
Key Results and Insights
Contrastive CoT consistently outperformed standard CoT across all tested datasets. Notable improvements include:
- Arithmetic: Accuracy on GSM8K rose from 69.2% to 79.0% (+9.8 points).
- Factual QA: Bamboogle saw a significant jump from 40.8% to 56.8% (+16.0 points), while StrategyQA improved by 10.4 points.
- Synergy with Self-Consistency: When combined with self-consistency (majority voting over multiple reasoning paths), Contrastive CoT achieved 86.2% on GSM8K, a 15.2-point improvement over the baseline.
Our analysis shows that providing negative examples acts as a "guardrail," forcing the model to pay closer attention to the specific relationships between entities and the validity of each step.
Discussion and Limitations
While Contrastive CoT is highly effective, it currently relies on the availability of valid rationales to generate contrastive pairs. Future work should explore generating "harder" negatives that target specific model weaknesses and investigate the impact on smaller models, which may have different sensitivities to contrastive examples.
Conclusion
Contrastive Chain-of-Thought prompting demonstrates that LLMs, much like humans, benefit from seeing examples of what not to do. By explicitly defining the boundary between correct and incorrect reasoning, we can build more robust and accurate AI systems for complex problem-solving.
Summary updated