cs.LGOct 1, 2026
SaveTrained Agentic Context Management
Abstract
We study long context language models. Instead of training long context natively, or designing a long context harness, we train a model over the simplest possible harness: a tool to call itself with any specified prompt and a tool to read tokens in a range from the input context. We finetune Qwen3.6-35B-A3B on a diverse synthetic dataset using this harness. With only 8,000 tokens of context, our small model is as strong as GPT-5.4 with 1M tokens of context on the OOLONG-synth benchmark when document length exceeds 40K tokens.
Figures & tables
Figure 1: Results on RULER and OOLONG-synth. Our finetune runs in our harness with an 8K token per-agent context limit. GPT-5.4 (medium reasoning) and base Qwen3.6-35B-A3B (thinking disabled) receive the full document with the prompt (see Section 4 and Appendix A for more details). Base Qwen and GPT-5.4 are served with 64K and 1M token context limits, respectively. The OOLONG random baseline follows Bertsch et al. (2025, §2.3) .
Figure 2: Tree reduce , for order-independent tasks (aggregation, retrieval). Non-leaf nodes delegate half their range to subagents. Leaves read one chunk and compute a leaf op which is aggregated up the tree.
Figure 3: Sequential fold , for order-dependent tasks (variable tracking, running state). Each agent reads the next slice, updates the accumulator, and delegates the rest of the document to the next agent.
Figure 4: Boundary handling. A leaf/fold agent owns the data that starts in its range. It reads 200 additional tokens at a time until the last item in its range is not cut off (additional calls not pictured in Figures 2 and 3 , for brevity).
| RULER (mean of 13 tasks) | 10K | 20K | 40K | 80K | 160K | 320K |
| GPT-5.4 (full document) | 0.954 | 0.938 | 0.954 | 0.954 | 0.929 | 0.954 |
| Qwen3.6-35B-A3B (full document) | 0.923 | 0.938 | 0.938 | — | — | — |
| Finetuned Qwen3.6-35B-A3B (our harness) | 0.949 | 0.949 | 0.929 | 0.885 | 0.868 | 0.858 |
| OOLONG-synth (mean of 3 families) | 10K | 20K | 40K | 80K | 160K | 320K |
| GPT-5.4 (full document) | 0.718 | 0.666 | 0.600 | 0.539 | 0.556 | 0.479 |
| Qwen3.6-35B-A3B (full document) | 0.536 | 0.558 | 0.388 | — | — | — |
Table 1: Results by document length (tabular view of Figure 1 ). Our finetune runs in our harness with an 8K per-agent context limit. GPT-5.4 (medium reasoning, 1M token context limit) and base Qwen3.6-35B-A3B (reasoning disabled, 64K token Tinker serving limit) receive the full document in one call (see Appendix A for details). Bold marks the highest score per length.
| RULER | 10K | 20K | 40K | 80K | 160K | 320K |
|---|---|---|---|---|---|---|
| NIAH (8) | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 | 1.00 |
| VT | 1.00 | 1.00 | 1.00 | 0.92 | 0.84 | 0.64 |
| CWE | 1.00 | 0.94 | 0.74 | 0.58 | 0.24 | 0.18 |
| FWE | 0.93 | 1.00 | 0.93 | 1.00 | 1.00 | 0.93 |
| QA-1 | 0.60 | 0.60 | 0.80 | 0.60 | 0.60 | 0.60 |
| QA-2 | 0.80 | 0.80 | 0.60 | 0.40 | 0.60 | 0.80 |
Table 2: Results by task family . Left: On RULER, our model chooses a lossy aggregation strategy for the common words “CWE” problem type, which degrades when common words are diluted by fillers as document length grows. Right: On OOLONG-synth, leaf classification and merge errors compound at length. Distribution mismatch also arises at 160K+ document length (it sees 14K doc size in training).
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Benchmark | System prompt task context | Root user message |
|---|---|---|
| OOLONG-synth | OOLONG’s dataset description, verbatim (its intro, the number of items, the label set) | OOLONG’s question, verbatim, + “Put your final answer inside \boxed{}.” |
| RULER | None (empty) | RULER’s task template, verbatim, with {context} replaced by a pointer to the document (below) + “Reply with the answer inside \boxed{}.” |
Table 3: Benchmark text fields. The task context is placed in the system prompt, so every subagent inherits it without the parent restating it. For RULER, {context} in the template is replaced by: “[The relevant text is in a separate document accessible via the read_chunk tool — see the system prompt for usage.] (Document length: N tokens.)”
| Event | Tool result returned to the calling agent (verbatim) |
|---|---|
| spawn_subagent | |
| Subagent ends with a boxed answer | The content of its last closed \boxed{…} |
| Subagent exceeds its context budget | agent overflowed context |
| Subagent stops without a boxed answer | agent did not box an answer |
| Tree node cap reached | Error: rollout node budget reached. Solve directly. |
| read_chunk | |
Table 4: Harness responses. An agent’s budget counts its whole rendered conversation (system prompt, tool schema, user message, its own turns and every tool result); each generation is capped at the remaining room. A subagent that answers returns only its boxed content, so its reads and reasoning never enter the parent’s context.
| Task | Strategy | Example question / what the leaf does | |
| Order-independent aggregation over structured records (one record per line) | |||
| synth_sum | tree | 60 | SUM of amt over all records |
| synth_count | tree | 60 | how many records have flag=Y |
| synth_max | tree | 60 | largest amt |
| synth_min | tree | 60 | smallest amt |
| synth_sumwhere | tree | 60 | SUM of amt over only the flag=Y records |
Table 5: Training tasks. is the number of problems per task. Tree : recursive halving, with each parent merging its two children’s partials (for retrieval, the half that finds the answer wins). Fold : one agent reads a slice and hands the rest of the document and its accumulator to the next. Every agent in each tree is a training example.
More in this topic
Long-Context Language Modeling
Long-context language modeling studies how language models can use, retain, and efficiently process information across very long sequences.
See all 182 papers