Organizations: Beijing University of Posts and Telecommunications · University of Hong Kong · Nanyang Technological University · China Aerospace Science and Industry Corporation
Large language models (LLMs) exhibit strong general capabilities that mechanistic interpretability has attributed to sparse computational circuits. However, existing circuit studies emphasize preserving functionality or explaining safety, leaving the mechanisms underlying failures across a broader range of tasks largely unexplored. Extending circuit analysis from abilities to errors, we explore the perspective that such failures may likewise arise from erroneous internal computations and that targeted tuning of the corresponding parameters can correct such errors while largely preserving other capabilities. Motivated by this insight, we introduce RESCUE (Reasoning-Error Sparse-Circuit Uncovering and Editing), a framework that localizes error-associated circuits and surgically repairs them for performance enhancement. General tasks typically involve multi-step reasoning and long-form generation, where early deviations can cause prefixes to drift from supervised references, leading SFT-based mask optimization to overlook circuits involved in generation-time errors. RESCUE therefore refines these masks through reinforcement learning with multiple masked-model rollouts, improving their relevance to observed task failures. Finally, RESCUE introduces a pruning technique and precisely fine-tunes error circuits to correct task failures, thereby translating error localization into a sparse and targeted model update. We validate RESCUE on heterogeneous repair sets across two domains: (1) mathematical reasoning, identifying a math error circuit of 1.40% density whose repair raises accuracy from 6.0% to 75.5%; and (2) medical QA, where a similarly compact 1.44% circuit improves repair-set accuracy from 0% to 81%. Our code is available at: https://github.com/chuanpupig/RESCUE.
Figures & tables
Figure 1: Overview of RESCUE , with complementary repair and preservation signals ( Left ), the sparse-circuit localization and tuning framework ( Middle ), and targeted repair generations ( Right ).
Figure 2: Post-tuning accuracy after heterogeneous GSM8K repair; Aggregate Evaluation is the macro-average over the eight non-target benchmarks in Section 5.1 . The panels use different truncated y-axis ranges for readability, with exact percentages shown above each bar.
Model
Error Pattern
Base (Acc.)
RESCUE Abl. (Acc.)
Δ (pp)
Circuit
Qwen3-8B
Misleading Premise Back-solving
2%
93%
+91
0.32%
Dynamic State Tracking
1%
91%
+90
0.31%
Dropped-lowest Average
4%
94%
+90
0.26%
Declining Group Accumulation
2%
76%
+74
0.44%
Multiplicative Increment Back-solving
0%
91%
+91
0.39%
Llama-3.1-8B- Instruct
Cumulative Target Gap
1%
95%
+94
0.62%
Table 1: Pattern-specific circuit ablation. Circuit denotes the proportion of selected MLP rows.
Model
Error Pattern
Rephrased(Acc.)
Ablation (Acc.)
Δ (pp)
Qwen3-8B
Misleading Premise Back-solving
28%
42%
+14
Dynamic State Tracking
17%
25%
+8
Dropped-lowest Average
3%
16%
+13
Declining Group Accumulation
1%
18%
+17
Multiplicative Increment Back-solving
0%
23%
+23
Llama-3.1-8B- Instruct
Cumulative Target Gap
25%
60%
+35
Table 2: Cross-rephrase transfer of pattern-specific error circuits. Accuracy is measured over 100 rephrased examples before and after ablating the circuit localized from the original formulation.
Figure 3: Density-matched random-circuit controls. Pale-blue lines denote their means, while orange dashed and red solid lines denote Base and RESCUE, respectively.
Figure 4: Full-set ablation accuracy (%) during sequential repair for (a) Qwen3-8B and (b) Llama-3.1-8B-Instruct. AR1–AR5 denote repair stages; pattern order follows Table 1.
Targeted Repair
Post-tuning Evaluation
Model
Method
Repair-set (Acc.)
Circuit
MedMCQA
Aggregate Eval.
Qwen3-8B
Base
3.0%
–
59%
66.63%
LoRA
65.0%
–
60%
64.75%
RESCUE
78.5%
1.47%
60%
66.75%
Llama-3.1-8B-Instruct
Base
0.0%
–
59%
62.38%
LoRA
65.5%
–
57%
58.88%
Table 3: Cross-domain repair results on MedMCQA. Repair-set accuracy is measured after RESCUE and after LoRA. Aggregate Eval. is the mean accuracy over the eight benchmarks.
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 5: English translation of the prompt for generating pattern-specific GSM8K problems.
Figure 6: English translation of the prompt for rephrasing pattern-specific problems.
Figure 7: English translation of the prompt for minimally correcting erroneous reasoning.
Figure 8: Illustrative minimum-intervention correction. Colored text marks the erroneous and revised quantities; unchanged reasoning is omitted for brevity.
Model
Benchmark
Base
LoRA
Supervised-only
RESCUE
Qwen3-8B
ARC-C
56
57
57
57
HellaSwag
75
76
75
76
WinoGrande
68
67
68
67
PIQA
78
77
78
77
TruthfulQA
36
36
36
36
MMLU-Math
50
53
55
50
Appendix
Table 4: Detailed post-tuning accuracy (%) after heterogeneous GSM8K repair; Aggregate Eval. is the macro-average over the eight non-target benchmarks.
Model
Benchmark
Base
Misleading Premise Back-solving
Dynamic State Tracking
Dropped-lowest Average
Declining Group Accumulation
Multiplicative Increment Back-solving
Qwen3-8B
GSM8K
80
80
81
80
86
82
MATH-500
75
76
75
77
74
75
ARC-C
56
56
56
57
55
58
HellaSwag
75
75
75
75
75
75
WinoGrande
68
69
68
68
67
68
PIQA
78
77
78
77
77
77
Appendix
Table 5: Post-tuning accuracy (%) after independently repairing each pattern-specific GSM8K dataset; Aggregate Eval. is the macro-average over the eight non-target benchmarks.
Figure 9: Layer-wise enrichment of localized error-circuit rows, normalized by each circuit’s overall selection density. Curves and shading show the mean and min–max range across five pattern-specific circuits; E=1 denotes no enrichment.
Model
Misleading Premise Back-solving
Dynamic State Tracking
Qwen3-8B
Rephrased Base
28%
17%
Transferred Abl.
42%
25%
Re-localized Abl.
95%
95%
Δ vs. Base (pp)
+67
+78
Circuit
0.68%
0.69%
Model
Cumulative Target Gap
Percentage Risk
Appendix
Table 6: Re-localization on rephrased pattern-specific datasets. Transferred Abl. applies the original circuit, whereas Re-localized Abl. uses a circuit localized on the rephrased data; the bottom panel reports post-tuning accuracy.
Figure 10: Benchmark accuracy for the base models and their final states after five sequential repairs (AR5).
Model
Benchmark
Base
LoRA
RESCUE
Qwen3-8B
MedMCQA
59
60
60
GSM8K
80
85
86
ARC-C
56
57
58
HellaSwag
75
76
76
WinoGrande
68
68
69
PIQA
78
76
79
Appendix
Table 7: Detailed post-tuning accuracy (%) for MedMCQA repair. Aggregate Eval. averages the eight benchmarks from ARC-C through BBH and excludes GSM8K.
Large language models (LLMs) often exhibit flawed reasoning ability that undermines reliability. Existing approaches to improving reasoning typically treat it as a general and monolithic skill, applying broad training which is inefficient and unable to target specific reasoning errors. We introduce Reasoning Editing, a paradigm for selectively modifying specific reasoning patterns in LLMs while preserving other reasoning pathways. This task presents a fundamental trade-off between Generality, the ability of an edit to generalize across different tasks sharing the same reasoning pattern, and Locality, the ability to preserve other reasoning capabilities. Through systematic investigation, we uncover the Circuit-Interference Law: Edit interference between reasoning patterns is proportional to the overlap of their neural circuits. Guided by this principle, we propose REdit, the first framework to actively reshape neural circuits before editing, thereby modulating interference between reasoning patterns and mitigating the trade-off. REdit integrates three components: (i) Contrastive Circuit Reshaping, which directly addresses the generality-locality trade-off by disentangling overlapping circuits; (ii) Meta-Contrastive Learning, which extends transferability to novel reasoning patterns; and (iii) Dual-Level Protection, which preserves preexisting abilities by constraining reshaping update directions and regularizing task-level predictions. Extensive experiments with Qwen-2.5-3B on propositional logic reasoning tasks across three difficulty levels demonstrate that REdit consistently achieves superior generality and locality compared to baselines, with additional validation in mathematics showing broader potential. Our code is available at https://github.com/LzyFischer/REdit.
Zhenyu Lei, Qiong Wu, Jianxiong Dong +4
University of Virginia · AT&T Chief Data Office · Florida State University
Large language models demonstrate strong performance on mathematical reasoning benchmarks, yet remain surprisingly fragile to meaning-preserving surface perturbations. We systematically evaluate three open-weight LLMs, Mistral-7B, Llama-3-8B, and Qwen2.5-7B, on 677 GSM8K problems paired with semantically equivalent variants generated through name substitution and number format paraphrasing. All three models exhibit substantial answer-flip rates (28.8%-45.1%), with number paraphrasing consistently more disruptive than name swaps. To trace the mechanistic basis of these failures, we introduce the Mechanistic Perturbation Diagnostics (MPD) framework, combining logit lens analysis, activation patching, component ablation, and the Cascading Amplification Index (CAI) into a unified diagnostic pipeline. CAI, a novel metric quantifying layer-wise divergence amplification, outperforms first divergence layer as a failure predictor for two of three architectures (AUC up to 0.679). Logit lens reveals that flipped samples diverge from correct predictions at significantly earlier layers than stable samples. Activation patching reveals a stark architectural divide in failure localizability: Llama-3 failures are recoverable by patching at specific layers (43/60 samples), while Mistral and Qwen failures are broadly distributed (3/60 and 0/60). Based on these diagnostic signals, we propose a mechanistic failure taxonomy (localized, distributed, and entangled) and validate it through targeted repair experiments: steering vectors and layer fine-tuning recover 12.2% of localized failures (Llama-3) but only 7.2% of entangled (Qwen) and 5.2% of distributed (Mistral) failures.
Shou-Tzu Han, Rodrigue Rizk, KC Santosh
Department of Computer Science, University of South Dakota
Large language models frequently fail to produce correct code on their first attempt, yet most benchmarks evaluate them in a single-shot setting. We investigate iterative self-repair (feeding execution errors back to the model for correction) across seven models spanning three families and both open-weight and proprietary providers: Llama 3.1 8B, Llama 3.3 70B, Llama 4 Scout (MoE, 16 experts), Llama 4 Maverick (MoE, 128 experts), Qwen3 32B, Gemini 2.5 Flash, and Gemini 2.5 Pro. On HumanEval (164 problems) and MBPP Sanitized (257 problems) with up to five attempts, self-repair universally improves pass rates: +4.9 to +17.1 pp on HumanEval and +16.0 to +30.0 pp on MBPP. Gemini 2.5 Flash achieves the highest final pass rates (96.3% HumanEval, 93.8% MBPP). Most gains concentrate in the first two rounds.Error-type analysis shows assertion errors (logical mistakes) are the hardest to repair at ~45%, while syntax and name errors are repaired at substantially higher rates, connecting to broader findings on the limits of LLM self-correction. Prior work found that weaker models fail at self-repair or require fine-tuning; we show that modern instruction-tuned models succeed with prompting alone, even at 8B scale. We also provide the first comparison of dense and MoE architectures for self-repair, and extend the repair-vs-resampling tradeoff analysis to modern models. A prompt ablation reveals chain-of-thought repair yields up to +5.5 pp additional self-repair gain (measured as improvement in repair delta) over minimal prompting for capable models.