Language Model Harnesses can be Compositional Generalizers
Organizations: MIT CSAIL
Abstract
Modern language models (LMs) are post-trained and deployed as agents inside a "harness", but standard harness designs accumulate context that the neural network is forced to generalize to, making training for long-horizon tasks expensive and time-consuming. We study an alternative emerging path: training inherently neurosymbolic LM harnesses, which externalize and manage context programmatically to compose existing LM capabilities. We hypothesize that training around these harnesses can offer a better return on compute by enabling compositional generalization, as they can learn to decompose complex problems so that every observation their neural LM receives is locally in-distribution, even when the full task is novel. We find that harnesses like the Recursive Language Model (RLM) learn such decompositions readily under reinforcement learning post-training: (1) we demonstrate that training only on short tasks can generalize to tasks 2-64 longer while the base neural LM improves less, and (2) training on one domain transfers to novel domains that share latent structure. On messier, complex tasks, we find that we can target individual LLM calls within a harness by generating and training on easier, synthetically generated surrogate environments with fake tool / sub-calls, a technique we call surrogate harness training. From this finding, we train RLM-27B on synthetic data, and show it improves Qwen3.8-27B in the same RLM harness on a hard suite of long-context tasks like CTC-Bench and ExpertLongBench by 26.9% on average while using 2 fewer tokens at inference time. Finally, we show that harnesses can compose over these newly learned decompositions using recursive sub-harness calls.
Figures & tables
| Environment | Train Tasks | Evaluation Tasks | Length |
| MRCRv2 ( Vodrahalli et al., 2024 ) | 32K–64K tokens, 2-needle | 2M–4M tokens, 8-needle | 64 |
| GraphWalks ( OpenAI, 2025b ) | 128K tokens | 50 samples, 256K–1M tokens | 2–8 |
| LongBenchPro ( Chen et al., 2026b ) | 32K tokens, English | 256K tokens, English | 8 |
| OOLONG ( Bertsch et al., 2025 ) | 32K split, trec-coarse | 256K split, trec-coarse | 8 |
| OOLONG-Pairs ( Zhang et al., 2026a ) | 8K input tokens | 32K tokens | 4 |
| Ada-LEval ( Wang et al., 2024a ) | 8K tokens | 128K tokens | 16 |
| Environment | Train Tasks | Evaluation Tasks |
| OOLONG ( Bertsch et al., 2025 ) | trec-coarse questions, 32K tokens | spam questions, 132K tokens |
| OBLIQ-Bench ( Tchuindjo et al., 2026 ) | Writing-style analogues (300 docs) | Math analogues (300 docs) |
| OBLIQ-Bench ( Tchuindjo et al., 2026 ) | Twitter stances (300 docs) | LLM transcript errors (300 docs) |
| Benchmark | Evaluation split | Context Length | |
| LongReason ( Ling et al., 2025 ) | All 128k items | 118K | 794 |
| OOLONG-Real ( Bertsch et al., 2025 ) | D&D test, 170K split. | 175K | 577 |
| OBLIQ-Bench ( Tchuindjo et al., 2026 ) | Math, full corpus | 278K | 151 |
| CorpusQA ( Lu et al., 2026 ) | 1M, real estate (English) | 451K | 81 |
| LooGLE-v2 ( He et al., 2025 ) | 500K | 675K | 206 |
| BrowseComp-Plus ( Chen et al., 2025 ) | All queries; full corpus | 456M | 830 |
| Method | LongReason | LooGLE | CTC | BC+ | OOLONG | CorpusQA | OBLIQ | ELB | Avg. |
| Qwen3-30B-A3B-Instruct-2507 | |||||||||
| Base Transformer | 63.1 | 34.5 | 0.2 | 0.0 | 18.7 | 11.7 | 0.5 | 52.2 | 22.6 |
| Pi (base) | 72.2 | 26.2 | 0.2 | 3.5 | 13.6 | 8.1 | 0.4 | 27.6 | 19.0 |
| LM + REPL | 44.7 | 24.7 | 1.0 | 0.0 | 13.6 | 7.3 | 4.7 | 33.1 | 16.1 |
| RLM (base) | 44.6 | 18.3 | 1.1 | 2.1 | 15.1 | 11.2 | 4.5 | 25.6 | 15.3 |
| [][] + RL (short tasks) | 74.9 | 21.7 | 2.2 | 8.3 | 19.3 | 17.8 | 7.3 | 26.8 | 22.3 |
| Method | # Turns | # Sub-calls | Delegates | Turn Cap | Root tokens (in / out) | Sub-call tokens (in / out) | ||
| Qwen3-30B-A3B-Instruct-2507 | ||||||||
| RLM (base) | 16.9 | 697.0 | 49.5% | 35.4% | 321K / 16K | 979K / 219K | ||
| [4pt][4pt] + RL (short tasks) | 13.1 | 416.5 | 35.8% | 16.6% | 215K / 16K | 619K / 50K | ||
| [4pt][4pt] + RL (synthetic tasks) | 13.1 | 1031.1 | 55.9% | 4.6% | 260K / 19K | 577K / 50K | ||
| Qwen3.8-27B | ||||||||
| RLM (base) | 18.4 | 87.3 | 43.2% | 32.9% | 263K / 5K | 443K / 10K | ||
| Model | RLM Harness | + recursion hint | + SFT (recursion synthetic data) | |||
| Solve rate (%) | Partial | Full | Partial | Full | Partial | Full |
| Qwen3.8-27B | 38.4 1.7 | 19.3 1.7 | 32.5 1.5 | 12.4 1.4 | 32.1 1.4 | 9.9 1.3 |
| [3pt][3pt] RLM-27B | 74.5 1.4 | 55.2 2.2 | 63.3 1.7 | 47.2 2.2 | 84.4 1.4 | 77.5 1.8 |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| Task family | Training split(s) | Held-out validation split(s) |
| FanOutQA ( Zhu et al., 2024 ) | Dev evidence, contexts up to 400K characters | Dev evidence, contexts 800K characters |
| Ada-LEval ( Wang et al., 2024a ) | Best Answer, 8K-32K train split | – |
| BABILong ( Kuratov et al., 2024 ) | QA3, 32K/64K/128K | QA1, 128K |
| NoCha ( Karpinska et al., 2024 ) | – | NoCha evaluation stream (20 examples) |
| GraphWalks ( OpenAI, 2025b ) | 128K tokens and shorter | 256K–1M tokens |
| MRCRv2 ( Vodrahalli et al., 2024 ) | Two needles, 32K–64K | Eight needles, 2M–4M |
| Model | LongReason | LooGLE | CTC | OOLONG-Real | CorpusQA | ELB | Avg. |
| Qwen3-30B-A3B (base) | 44.6 | 18.3 | 1.1 | 15.1 | 11.2 | 25.6 | 19.3 |
| + RL (short tasks) | 74.9 | 21.7 | 2.2 | 19.3 | 17.8 | 26.8 | 27.1 |
| + RL (synthetic tasks) | 69.6 | 28.2 | 1.6 | 18.6 | 23.7 | 44.0 | 31.0 |
| [][] + RL (broad task suite) | 83.1 | 28.5 | 2.0 | 19.7 | 20.4 | 35.8 | 31.6 |
| Model | Root turns | Sub-calls | Root tokens | Sub-call tokens |
| Base | 17.0 | 438.8 | 229K / 14K | 572K / 24K |
| [][] + RL (short tasks) | 12.8 | 179.4 | 170K / 16K | 285K / 7K |
| [][] + RL (synthetic tasks) | 12.6 | 774.6 | 230K / 20K | 429K / 23K |
| [][] + RL (broad task suite) | 13.3 | 422.6 | 245K / 19K | 250K / 30K |
| Environment | Real | Train | ||
| BrowseComp-Plus | 830 | 1,322 | 0.021 | 0 |
| CorpusQA | 81 | 853 | 0.315 | 81 |
| CTC: QDMatch 256K | 125 | 136 | 1.000 | 125 |
| CTC: absence 32K | 100 | 516 | 1.000 | 100 |
| CTC: contradiction 1M | 125 | 151 | 1.000 | 125 |
| CTC: outlier 1M | 125 | 209 | 1.000 | 125 |
| p50 | p99 | Mean | ||||
| Benchmark | Real | Synth. | Real | Synth. | Real | Synth. |
| CTC-Bench | 219 | 145 (0.66 ) | 1021 | 1639 (1.61 ) | 276 | 222 (0.81 ) |
| OBLIQ † | 213 | 47 (0.22 ) | 521 | 78 (0.15 ) | 229 | 50 (0.22 ) |
| BrowseComp-Plus † | 195 | 79 (0.40 ) | 698 | 394 (0.56 ) | 240 | 96 (0.40 ) |
| ExpertLongBench † | 45 | 12 (0.27 ) | 167 | 33 (0.20 ) | 61 | 17 (0.27 ) |
| LooGLE-v2 | 75 | 54 (0.72 ) | 253 | 180 (0.71 ) | 84 | 61 (0.73 ) |
| p50 | p99 | Mean | ||||
| Benchmark | Real | Synth. | Real | Synth. | Real | Synth. |
| CTC-Bench | 157 | 90 (0.57 ) | 1009 | 601 (0.60 ) | 219 | 154 (0.70 ) |
| OBLIQ † | 144 | 119 (0.83 ) | 487 | 233 (0.48 ) | 158 | 120 (0.76 ) |
| BrowseComp-Plus † | 87 | 56 (0.64 ) | 572 | 370 (0.65 ) | 135 | 73 (0.54 ) |
| ExpertLongBench † | 28 | 20 (0.72 ) | 182 | 219 (1.21 ) | 37 | 47 (1.27 ) |
| LooGLE-v2 | 48 | 40 (0.83 ) | 275 | 313 (1.14 ) | 82 | 56 (0.68 ) |
| Chains by tasks passed | Per chain | Per RLM call | 2nd att. | |||||||||
| Setting | 0 | 1 | 2 | 3 | 4 | Passed | unlock | handoff | RLM calls | Turns | Sub-calls | (%) |
| Qwen3.8-27B | ||||||||||||
| RLM harness | 756 | 382 | 285 | 191 | 386 | 1.53 | 2.57 | 0.00 | 0.84 | 60.8 | 0.75 | 21.5 |
| + recursion hint | 766 | 523 | 306 | 156 | 249 | 1.30 | 2.20 | 1.13 | 1.92 | 31.6 | 0.41 | 21.5 |
| + SFT | 646 | 693 | 306 | 157 | 198 | 1.28 | 3.10 | 0.93 | 1.92 | 15.1 | 0.91 | 27.2 |
| RLM-27B | ||||||||||||
| Method | LongReason | LooGLE | CTC | BC+ | OOLONG-Real | CorpusQA | OBLIQ | ELB | Avg. |
| Qwen3-30B-A3B-Instruct-2507 | |||||||||
| RLM (base) | 21.0 | 10.9 | 16.6 | 21.2 | 17.8 | 25.4 | 11.8 | 10.3 | 16.9 |
| [][] + RL (6 short tasks) | 8.0 | 11.0 | 13.5 | 14.1 | 15.3 | 22.4 | 13.6 | 6.8 | 13.1 |
| [][] + RL ( 20 tasks) | 6.0 | 11.1 | 14.6 | 18.1 | 16.3 | 22.7 | 14.4 | 9.2 | 14.1 |
| [][] + RL (synthetic tasks) | 11.7 | 10.5 | 10.1 | 18.8 | 19.7 | 17.4 | 10.0 | 6.2 | 13.1 |
| Qwen3.8-27B | |||||||||
| Method | LongReason | LooGLE | CTC | BC+ | OOLONG-Real | CorpusQA | OBLIQ | ELB | Avg. |
| Qwen3-30B-A3B-Instruct-2507 | |||||||||
| RLM (base) | 3.4 | 3.2 | 2610.8 | 113.0 | 0.6 | 10.1 | 2830.3 | 4.8 | 697.0 |
| [][] + RL (6 short tasks) | 0.0 | 0.5 | 1064.1 | 15.5 | 0.2 | 9.5 | 2240.5 | 2.0 | 416.5 |
| [][] + RL ( 20 tasks) | 0.0 | 0.2 | 2532.0 | 91.9 | 0.0 | 0.4 | 1756.8 | 2.8 | 548.0 |
| [][] + RL (synthetic tasks) | 0.0 | 3.5 | 4584.1 | 207.1 | 8.1 | 48.0 | 3394.7 | 3.8 | 1031.1 |
| Qwen3.8-27B | |||||||||
| Qwen3-30B-A3B | Qwen3.8-27B | |||||||
| Benchmark | Base | + RL (6 short) | + RL ( 20) | + RL (synth.) | Base | + RL (6 short) | + RL (synth.) | RLM-27B |
| LongReason | 227K / 4K | 53K / 3K | 35K / 3K | 327K / 8K | 31K / 1K | 29K / 1K | 14K / 1K | 6K / 2K |
| LooGLE | 48K / 3K | 45K / 3K | 76K / 7K | 77K / 5K | 46K / 2K | 50K / 1K | 54K / 2K | 19K / 3K |
| CTC | 170K / 43K | 95K / 49K | 238K / 61K | 140K / 65K | 400K / 10K | 428K / 10K | 496K / 14K | 60K / 5K |
| BC+ | 572K / 20K | 191K / 7K | 353K / 16K | 603K / 24K | 495K / 6K | 658K / 6K | 1036K / 13K | 203K / 4K |
| OOLONG-Real | 178K / 7K | 107K / 6K | 275K / 13K | 315K / 13K | 545K / 7K | 321K / 23K | 395K / 23K | 20K / 4K |
| Environment | Delegated sub-task | Ground truth | Metric | Train | Eval |
| [][] Length generalization | |||||
| OOLONG | Label one question line (6 classes) | TREC label | Accuracy | 86.1 85.6 | 81.7 83.7 |
| OOLONG-Pairs | Label one question line (6 classes) | TREC label | Accuracy | 88.5 90.3 | 83.9 89.3 |
| Ada-LEval | Is this candidate answer relevant? | Accepted answer vs. distractors | Balanced acc. | 82.5 93.4 | 78.5 83.0 |
| GraphWalks | Parse edges into an adjacency dict | Edges in the prompt | Exact match | – | 99.8 (–) |
| LongBench-Pro | 25 task types | No per-call ground truth; not scored | |||
Compositional Generalization
Compositional generalization is the ability to combine learned parts and rules in ways that transfer to unseen combinations.
See all 125 papers