TL;DR
Even when a large language model makes an arithmetic mistake, its internal activations often still encode the correct ground-truth answer. By probing hidden states at the equals sign token, lightweight classifiers can detect arithmetic errors with over 90% accuracy, generalize across contexts from simple equations to chain-of-thought word problems, and serve as non-invasive "weak oracles" that prompt self-correction without breaking correct reasoning steps.
What Problem Does This Paper Address?
Language models are notoriously prone to brittle calculation errors in multi-step math reasoning. While prior work has explored self-correction, recent studies suggest that LLMs rarely self-correct reliably unless guided by external oracles. Meanwhile, mechanistic interpretability work has shown that models build geometric representations of numbers (such as circular or helical layouts), but rarely translates these insights into practical debugging tools.
The authors investigate whether an LLM's own internal representations already "know" when a calculation is wrong—and whether we can tap into those latent states to anticipate calculation errors and trigger targeted self-correction.
Methods
The researchers analyze the residual stream activations right at the equals sign token (=), immediately before the model produces its computed digit:
- Geometric & Digit Probing: Inspired by findings that periodic and modular concepts take circular shapes in activation space (confirmed via PCA visualizations showing circular digit clustering in deeper layers), the authors compare four probe designs:
- Circular Probe: Projects the residual stream into 2D space and maps the angle $\theta = \text{atan2}(\mathbf{w}_1^\top \mathbf{x}, \mathbf{w}_2^\top \mathbf{x})$ to a digit $\hat{y} \in [0, 9]$ using smooth $\ell_1$ loss.
- Linear Probe: Standard ridge regression rounding to the nearest integer.
- Logistic Regression: 10-class linear classifier.
- MLP Probe: A single-hidden-layer network (512 units, ReLU).
- Error Detection Strategies: Probes are trained either to detect model predictions, ground-truth results, or binary correctness. Error detectors are constructed either by training independent probes for predicted vs. ground-truth outputs and flagging disagreements, or by directly optimizing a joint binary classifier.
- Selective Re-Prompting (Weak Oracle): When a probe flags an intermediate reasoning step as suspicious, a concise prompt intervenes at that exact step (e.g., "That step looks suspicious. Let's re-do just this step: <a+b="), leaving the rest of the chain untouched.
Datasets
- Synthetic 3-Digit Addition & Subtraction: Balanced datasets of queries of the form $a+b$ ($a,b \in [100, 999], a+b < 1000$), balanced across predicted digits and correctness. Extensions include subtraction ($800$ addition + $800$ subtraction) and 3-to-5 digit addition queries ($100$ to $99,999$).
- GSM8K Addition-Only Subset: 685 intermediate reasoning steps derived from GSM8K math problems filtered to addition, converted into abstract symbolic templates via Claude 3.7 Sonnet, and resampled with concrete 3-digit values. Steps follow a structured format (
<a+b=c>), with an additional evaluation on unstructured, free-form chain-of-thought traces.
Key Insights and Ideas
- The Model Encodes What It Won't Say: In late layers, probes decode the ground-truth answer with over 90% accuracy—even when the model outputs an incorrect digit.
- Probes Aren't Just "Doing the Math": To ensure probes were not merely learning addition from input operands, the authors probed early layers (layer 5). While operands were almost 100% decodable in early layers, the ground-truth sum was only decodable in late layers. This proves the probe reads a partially computed answer from the model's computation rather than computing it independently.
- Circular Geometry Outperforms Linear Decoding: Standard linear probes completely failed (near 3–4% accuracy), whereas a simple 2-parameter circular probe matched the performance of expressive 512-dimensional MLPs.
- Cross-Context Zero-Shot Generalization: Error detectors trained strictly on raw arithmetic equations (
"a+b=") generalized out-of-the-box to complex chain-of-thought word problems from GSM8K without fine-tuning, maintaining ~85% error-detection accuracy.
Key Results
- Error Detection Accuracy: Probes achieve 90% to 95% accuracy in distinguishing correct from incorrect calculations in the pure 3-digit addition setting on Gemma 2 2B IT, and replicate consistently on Phi-3 3.8B.
- CoT & Free-Form Performance: Detectors reach 80%–90% accuracy on structured GSM8K intermediate steps, and 72% accuracy on unstructured, free-form CoT steps.
- Safe Self-Correction: Using an MLP error detector at layer 25 to trigger re-prompting:
- Corrected up to 11.8% of flagged arithmetic mistakes (True Positive correction).
- Maintained a 100% preservation rate on false alarms across multiple prompting styles, meaning correct steps were not corrupted by the intervention.
Limitations and Future Work
- Arithmetic Scope: The primary focus is limited to addition (with preliminary subtraction experiments); multiplication, division, and mixed symbolic expressions remain untested.
- Model Scale: Experiments were restricted to smaller open models (Gemma 2 2B and Phi-3 3.8B).
- Formatting Assumptions: The strongest results rely on structured steps (
<a+b=c>); while preliminary free-form CoT detection reached 72%, extending probe reliability to completely unconstrained natural language traces is an ongoing challenge.
Summary updated