P2N: Reusing Deep Representations for Greater Effective Depth
Organizations: LUMIA Lab, School of Artificial Intelligence, Shanghai Jiao Tong University · Sun Yat-sen University · Shanghai AI Laboratory
Abstract
Mathematical problem solving and autonomous agents are increasingly important applications of language models, demanding stronger reasoning capabilities. Computational depth is a key resource for such reasoning, but adding model layers increases both training and inference costs, while test-time scaling incurs substantial additional inference computation. We introduce P2N (Previous to Next), which reuses the previous token's deep representations, already available during generation, to increase effective computational depth with negligible decoding overhead. Specifically, P2N adds the previous token's deep hidden state to the current token's shallow representation, allowing subsequent layers to build on previously completed deep computation. This recurrence extends effective computational depth across tokens, while introducing only a single vector addition per decoding step. We train the recurrence using parallel Jacobi updates restricted to a middle-layer core. Experiments with Qwen-style models show that, at 1.5B parameters, P2N improves GSM8K accuracy by over 10 percentage points under both zero-shot and few-shot prompting, with nearly unchanged decoding latency. The benefits also extend to language modeling and average performance on general downstream benchmarks. on general downstream benchmarks.
Figures & tables
| Scale | Method | LAMBADA | PIQA | Wino Grande | SciQ | Hella Swag | ARC | RACE | Avg. | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| OpenAI | Standard | Easy | Challenge | ||||||||
| Zero-shot | |||||||||||
| 1B | Vanilla | 61.73 | 49.91 | 71.06 | 59.91 | 88.70 | 41.62 | 60.02 | 27.39 | 33.30 | 54.85 |
| 1B | P2N | 64.22 | 57.13 | 72.31 | 58.64 | 89.50 | 43.45 | 61.45 | 27.05 | 34.16 | 56.43 |
| 1.5B | Vanilla | 66.23 | 57.36 | 74.16 | 59.91 | 88.60 | 45.05 | 64.14 | 27.99 | 35.50 | 57.66 |
| 1.5B | P2N | 67.92 | 61.46 | 73.18 | 62.27 | 90.70 | 46.74 | 64.90 | 29.86 | 37.03 | 59.34 |
| Batch | TPOT (ms) | Throughput (tok/s) | Rel. latency | ||
|---|---|---|---|---|---|
| size | Vanilla | P2N | Vanilla | P2N | P2N / Vanilla |
| 1 | 16.442 | 16.494 | 60.8 | 60.6 | |
| 4 | 16.983 | 16.991 | 235.5 | 235.4 | |
| 16 | 17.079 | 17.143 | 936.8 | 933.3 | |
| 32 | 22.298 | 22.352 | 1435.1 | 1431.7 | |
| (a) Residual-scale treatment | (b) Learnable mixing | ||||
|---|---|---|---|---|---|
| Method | Val. loss | Loss gap | Method | Val. loss | Loss gap |
| Direct sum ( P2N ) | 2.0511 | Direct sum ( P2N ) | 2.0511 | ||
| RMS matching | 2.0543 | Channel-wise gate | 2.0491 | ||
| Compute-only | 2.0665 | Scalar gate | 2.0494 | ||
| Method | Core layers | Relative compute | Val. loss |
|---|---|---|---|
| Vanilla | 0 | 2.0859 | |
| Middle ( P2N ) | 7 | 2.0511 | |
| Middle | 11 | 2.0453 | |
| Full | 21 | 2.1046 |
| Core placement | Val. loss | Loss gap |
|---|---|---|
| Vanilla (no recurrence) | 2.0859 | |
| First | 2.0792 | |
| Middle ( P2N ) | 2.0511 | |
| Last | 2.0969 |
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | Parameters | Layers | Q heads | KV heads | P2N core | Prefix/Core/Suffix | ||
|---|---|---|---|---|---|---|---|---|
| 150M | 149,541,120 | 12 | 768 | 3,328 | 12 | 4 | L4–L7 | 4/4/4 |
| 300M | 303,203,200 | 15 | 1,024 | 4,608 | 16 | 4 | L5–L9 | 5/5/5 |
| 600M | 604,627,328 | 21 | 1,280 | 5,632 | 20 | 5 | L7–L13 | 7/7/7 |
| 1B | 1,011,626,496 | 24 | 1,536 | 7,168 | 24 | 6 | L8–L15 | 8/8/8 |
| 1.5B | 1,496,092,288 | 27 | 1,792 | 8,192 | 28 | 7 | L9–L17 | 9/9/9 |
| Model | Active params. | Total params. | Layers | Q/KV heads | P2N core | Prefix/Core/Suffix | ||
|---|---|---|---|---|---|---|---|---|
| A0.15B | 150,130,944 | 794,218,752 | 12 | 768 | 416 | 12/4 | L4–L7 | 4/4/4 |
| A0.3B | 304,186,240 | 1,790,542,720 | 15 | 1,024 | 576 | 16/4 | L5–L9 | 5/5/5 |
| A0.6B | 606,347,648 | 3,785,499,008 | 21 | 1,280 | 704 | 20/5 | L7–L13 | 7/7/7 |
| A1B | 1,013,985,792 | 6,563,049,984 | 24 | 1,536 | 896 | 24/6 | L8–L15 | 8/8/8 |
| Scale | Method | LAMBADA | PIQA | Wino Grande | SciQ | Hella Swag | ARC | RACE | Avg. | ||
|---|---|---|---|---|---|---|---|---|---|---|---|
| OpenAI | Standard | Easy | Challenge | ||||||||
| A0.6B | Vanilla | 64.43 | 52.61 | 72.85 | 59.04 | 88.60 | 44.12 | 63.05 | 26.79 | 34.83 | 56.26 |
| A0.6B | P2N | 66.68 | 57.11 | 73.18 | 61.25 | 90.60 | 45.08 | 63.51 | 29.69 | 34.93 | 58.00 |
| A1B | Vanilla | 67.77 | 58.74 | 75.03 | 62.59 | 90.20 | 48.44 | 68.06 | 32.94 | 35.50 | 59.92 |
| A1B | P2N | 69.84 | 63.11 | 75.79 | 65.35 | 92.30 | 49.62 | 69.70 | 34.98 | 35.50 | 61.80 |
| Scale | Method | Zero-shot | Eight-shot | ||
|---|---|---|---|---|---|
| EM (%) | Gain (pp.) | EM (%) | Gain (pp.) | ||
| A1B | Vanilla | 21.68 | – | 20.02 | – |
| A1B | P2N | 27.98 | 26.38 | ||
| Batch | TPOT (ms) | Throughput (tok/s) | Rel. latency | ||
|---|---|---|---|---|---|
| size | Vanilla | P2N | Vanilla | P2N | P2N / Vanilla |
| 1 | 70.454 | 70.470 | 14.2 | 14.2 | 1.000 |
| 4 | 70.537 | 70.464 | 56.7 | 56.8 | 0.999 |
| 16 | 71.038 | 71.013 | 225.2 | 225.3 | 1.000 |
| 32 | 70.905 | 70.923 | 451.3 | 451.2 | 1.000 |
Efficient Language Model Inference
Efficient language model inference reduces the compute, memory, latency, and energy needed to generate useful outputs.
See all 321 papers