Can Computation from Earlier Problems Help LLMs Solve New Ones?
Organizations: Gaoling School of Artificial Intelligence, Renmin University of China, Beijing, China · University of Modena and Reggio Emilia, Italy
Abstract
Large language models often solve independent problems in the same conversation. Can computation from earlier problems help them solve new ones? To answer this question, we first conduct preliminary experiments showing that retained history can raise or lower later-turn accuracy, even within the same domain. To understand these effects, we use controlled replay to isolate internal state changes specific to each problem-history pairing. Across different histories, these changes preserve similar relationships among current problems. To improve reasoning under retained history, we introduce STAIR (Stale-Token Attention for Inter-query Reuse). STAIR captures keys and values from earlier response generation in a fixed bank. It learns to redirect current queries when they read this bank during prompt processing. The base model remains frozen; only 12,288 parameters are trained. Across three Qwen models and four benchmarks, STAIR improves average later-turn accuracy by up to 11.67 percentage points over the unmodified model with history.
Figures & tables
| T1 | Vanilla | Native | STAIR | |
|---|---|---|---|---|
| Correct | 18,879 | 93.96 | 93.42 | 94.18 |
| Wrong | 1,425 | 80.07 | 60.35 | 68.56 |
| MATH-500 | AIME 2025 | AMC23 † | GPQA-Diamond | |||||
| Condition | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 |
| Qwen3-4B Instruct | ||||||||
| Vanilla | 95.00 | 97.20 | 47.50 | 66.67 | 92.65 | 97.06 | 58.59 | 78.79 |
| Native | 94.10 | 97.60 | 34.44 | 47.78 | 93.38 | 96.08 | 58.00 | 76.94 |
| STAIR | 94.63 | 97.53 | 38.06 | 52.22 | 93.38 | 97.06 | 58.75 | 77.78 |
| Qwen3.5-4B | ||||||||
| Condition | Avg@4 | (pp) | Pass@4 |
|---|---|---|---|
| Native | 21.67 | 0.00 | 56.67 |
| Random-reflector | 37.22 | +15.56 | 63.33 |
| Direct reflected-read | 41.67 | +20.00 | 73.33 |
| Bank-free | 36.67 | +15.00 | 66.67 |
| K–V pairing permutation | 33.06 | +11.39 | 61.11 |
| STAIR | 48.33 | +26.67 | 80.00 |
| Avg@4 | Pass@4 | ||||
|---|---|---|---|---|---|
| Condition | Trainable params | Score | (pp) | Score | (pp) |
| Native | 0 | 34.44 | – | 47.78 | – |
| STAIR | 12,288 | 38.06 | +3.61 | 52.22 | +4.44 |
| LoRA | 4,128,768 | 39.44 | – | 58.89 | – |
| LoRA + STAIR | 4,141,056 | 43.33 | +3.89 | 63.33 | +4.44 |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Design | Group | Current problems | Histories | Sessions | Source problems |
|---|---|---|---|---|---|
| History coverage | 1 | 64 | 128 | 33 | 81 |
| History coverage | 2 | 64 | 128 | 32 | 83 |
| Problem coverage | 1 | 128 | 32 | 25 | 67 |
| Problem coverage | 2 | 128 | 32 | 23 | 63 |
| Turn | W to C | C to W | C to C | W to W | Net change |
|---|---|---|---|---|---|
| T2 | 37 | 47 | 1,853 | 63 | |
| T3 | 40 | 59 | 1,841 | 60 | |
| T4 | 35 | 60 | 1,840 | 65 |
| Turn | T1 answer | Vanilla | Native | STAIR | |
|---|---|---|---|---|---|
| MATH-500 | |||||
| T2 | Correct | 1,900 | 1,808 (95.16) | 1,798 (94.63) | 1,806 (95.05) |
| T2 | Wrong | 100 | 92 (92.00) | 92 (92.00) | 94 (94.00) |
| T3 | Correct | 1,900 | 1,805 (95.00) | 1,787 (94.05) | 1,805 (95.00) |
| T3 | Wrong | 100 | 95 (95.00) | 94 (94.00) | 94 (94.00) |
| T4 | Correct | 1,900 | 1,804 (94.95) | 1,778 (93.58) | 1,784 (93.89) |
| Turn | T1 answer | Vanilla | Native | STAIR | |
|---|---|---|---|---|---|
| MATH-500 | |||||
| T2 | Correct | 1,920 | 1,848 (96.25) | 1,768 (92.08) | 1,813 (94.43) |
| T2 | Wrong | 80 | 72 (90.00) | 42 (52.50) | 59 (73.75) |
| T3 | Correct | 1,920 | 1,844 (96.04) | 1,864 (97.08) | 1,875 (97.66) |
| T3 | Wrong | 80 | 76 (95.00) | 67 (83.75) | 74 (92.50) |
| T4 | Correct | 1,920 | 1,844 (96.04) | 1,873 (97.55) | 1,878 (97.81) |
| Turn | T1 answer | Vanilla | Native | STAIR | |
|---|---|---|---|---|---|
| MATH-500 | |||||
| T2 | Correct | 1,933 | 1,874 (96.95) | 1,850 (95.71) | 1,857 (96.07) |
| T2 | Wrong | 67 | 59 (88.06) | 36 (53.73) | 46 (68.66) |
| T3 | Correct | 1,933 | 1,867 (96.59) | 1,892 (97.88) | 1,884 (97.47) |
| T3 | Wrong | 67 | 66 (98.51) | 54 (80.60) | 58 (86.57) |
| T4 | Correct | 1,933 | 1,868 (96.64) | 1,892 (97.88) | 1,900 (98.29) |
| Model | Query heads/layer | Init. std. | Parameters | |
|---|---|---|---|---|
| Qwen3-4B Instruct | 32 | 128 | 12,288 | |
| Qwen3.5-4B | 16 | 256 | 12,288 | |
| Qwen3.5-9B | 16 | 256 | 12,288 |
| Model | Temp. | Top- | Top- | Presence penalty | Output limit |
|---|---|---|---|---|---|
| Qwen3-4B Instruct | 0.7 | 0.8 | 20 | 0 | 16,384 |
| Qwen3.5-4B | 1.0 | 0.95 | 20 | 1.5 | 81,920 / 32,768 |
| Qwen3.5-9B | 1.0 | 0.95 | 20 | 1.5 | 81,920 / 32,768 |
| Readable bank | Truncated | Avg@4 | Pass@4 |
|---|---|---|---|
| Native | – | 21.67 | 56.67 |
| STAIR 2K | 120/120 | 35.00 | 73.33 |
| STAIR 8K | 114/120 | 43.33 | 80.00 |
| STAIR 32K | 81/120 | 39.17 | 70.00 |
| STAIR Full | 0/120 | 48.33 | 80.00 |
| Bank | K/V | Transfer | Prefill | Decode | Peak | Total |
|---|---|---|---|---|---|---|
| (MiB) | (ms) | (ms) | (s) | (GiB) | (s) | |
| Native | 0 | 70 | 10.08 | 8.03 | 10.15 | |
| 2K | 24 | 6 | 110 | 10.02 | 8.19 | 10.15 |
| 8K | 96 | 24 | 157 | 10.06 | 8.70 | 10.23 |
| 32K | 384 | 138 | 338 | 10.05 | 10.71 | 10.56 |
| Full | 330 | 628 | 9.98 | 14.61 | 10.95 |
| T1 | T2 | T3 | T4 | Mean | ||||||
| Condition | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 |
| MATH-500 | ||||||||||
| Vanilla | 95.00 | 97.20 | – | – | – | – | – | – | – | – |
| Native | 95.00 | 97.20 | 94.50 | 97.40 | 94.05 | 97.60 | 93.75 | 97.80 | 94.10 | 97.60 |
| STAIR | 95.00 | 97.20 | 95.00 | 97.60 | 94.95 | 97.60 | 93.95 | 97.40 | 94.63 | 97.53 |
| AIME 2025 | ||||||||||
| T2 | T3 | T4 | Mean | |||||
|---|---|---|---|---|---|---|---|---|
| Condition | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 |
| Native | 36.67 | 50.00 | 32.50 | 40.00 | 34.17 | 53.33 | 34.44 | 47.78 |
| STAIR | 40.00 | 53.33 | 35.83 | 50.00 | 38.33 | 53.33 | 38.06 | 52.22 |
| LoRA | 40.83 | 53.33 | 38.33 | 60.00 | 39.17 | 63.33 | 39.44 | 58.89 |
| LoRA + STAIR | 44.17 | 63.33 | 45.00 | 70.00 | 40.83 | 56.67 | 43.33 | 63.33 |
| T1 | T2 | T3 | T4 | Mean | ||||||
| Condition | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 |
| MATH-500 | ||||||||||
| Vanilla | 96.00 | 98.60 | – | – | – | – | – | – | – | – |
| Native | 96.00 | 98.60 | 90.50 | 98.20 | 96.55 | 99.20 | 97.30 | 99.00 | 94.78 | 98.80 |
| STAIR | 96.00 | 98.60 | 93.60 | 99.40 | 97.45 | 99.40 | 97.75 | 99.00 | 96.27 | 99.27 |
| AIME 2025 | ||||||||||
| T1 | T2 | T3 | T4 | Mean | ||||||
| Condition | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 | Avg@4 | Pass@4 |
| MATH-500 | ||||||||||
| Vanilla | 96.65 | 98.20 | – | – | – | – | – | – | – | – |
| Native | 96.65 | 98.20 | 94.30 | 98.80 | 97.30 | 99.60 | 97.55 | 99.20 | 96.38 | 99.20 |
| STAIR | 96.65 | 98.20 | 95.15 | 98.80 | 97.10 | 99.40 | 98.10 | 99.20 | 96.78 | 99.13 |
| AIME 2025 | ||||||||||