Skip to content

Memento: an 8B agent reading 2.5M-token books in 20K-token windows

THE ARGUMENT

Whether a small model can handle very long inputs depends less on window size than on whether it learns to write a usable note before every memory reset.

On this page

Your team holds a 20K-token budget and a vendor claim that an 8B model can answer questions over 2.5M-token books, but should you sign? The usual advice is to buy the largest window you can afford, or to buy the strongest model and let it read everything at once. Both moves assume the hard part is capacity. This paper argues the hard part is narrower: whether the model, when its memory is nearly full, writes itself a note worth keeping. Memento [1] is a Qwen3-8B agent trained for exactly that, reporting 67.8% micro-averaged accuracy over four book QA benchmarks while never holding more than 20K tokens in context.

Four benchmarks and six numbers, up front

The task is book-level multi-hop question answering, meaning the evidence needed for one answer is scattered across an entire book rather than a few paragraphs. Four datasets are named: LiteraryQA, NovelHopQA and the English subset of SagaScale are used for training, while NovelQA is held out entirely. The test set has 4.7K questions drawn from 160 books; training has 17K questions over 600 books; validation has 2.3K questions over 70 books. No book or question is shared across splits.

Book length sets the difficulty. Ninety percent of the books exceed 51K Qwen3 tokens, 70% exceed 90K, and the longest reaches 2.5M tokens, while the trained models run on 16–20K windows. An agent must therefore carry its progress across dozens of resets before it can answer anything. All answers are free-form and graded by an LLM judge against a short reference.

SystemAccuracy over 4 benchmarksRelative inference cost
Qwen3-8B agent, untrained36.9%1x (cost baseline)
Memento, SFT + RL, no backtracking66.3%1x
Memento, full system with backtracking67.8%1x
GPT-5.5 agent, same harness13.1%54x
GPT-5.5, full book in context56.7%54x
GLM-5.3 agent, same harness (~100x larger)69.3%1/9
GLM-5.3, full book in context74.3%1/26

Read the harness prefix carefully: every agent runs in the same setup with the same search tools and the same note tool, so the comparison isolates the model and its training. Costs are inference dollars with Memento normalized to 1. The row most often misquoted is the last one, where full-book GLM-5.3 wins by 6.4 accuracy points at 26 times the cost [1].

Why the default assumption fails: models cannot write notes

The default assumption is that swapping in a stronger model fixes context management. Three numbers contradict it. GPT-5.5 never wrote a single compaction note on a 337-question test set. None of 12K pilot GLM-5.3 rollouts on the training set contained a valid note. Qwen3-8B was better at roughly 6% of trajectories, and its characteristic failure was writing near-identical notes back to back with no tool calls in between.

This is not a prompting problem, since the note tool is described in the system prompt and still goes unused. The consequence matters for anyone planning to train: if a valid behavior almost never appears in sampled rollouts, reinforcement learning has nothing to reinforce, no matter how well the reward is designed.

Three training steps: teach note-taking, then teach good notes

Step one is supervised fine-tuning on demonstrations. GLM-5.3 runs correct trajectories in the same harness; the original notes are stripped, and GLM-5.3 is prompted to insert notes after major tool-use turns and discoveries, summarizing key findings, mistakes to avoid and next steps. Notes failing the validity rules are resampled while search actions and final answers stay untouched. The result is about 6K trajectories used to fine-tune Qwen3-8B.

  • Frequency: every non-final window holds at least one note, and a rollout holds fewer than five notes total
  • Placement: no note is a window's first tool call, and no note immediately follows another note
  • Diversity: no two notes exceed 80% token-set similarity
  • A trajectory's notes count as valid only if all of the above hold

Step two is reinforcement learning with a reward of four parts: format, note validity, answer correctness, and confidence calibration. Format is a gate, awarded only when the answer and the verbalized confidence parse and no reward hacking is detected. Calibration uses a negated Brier score, meaning the model is penalized by the squared gap between the confidence it claims and whether it was actually right. Training uses Qwen3-14B as judge, but evaluation switches to Qwen3-235B-A22B-Instruct-2507 so that reported accuracy cannot be inflated by exploiting the training judge.

R = lF*F + F * ( Y + lM*M + lC*[1 - (Y - p)^2] )
F: format gate    M: valid notes
Y: correct answer 
p: verbalized confidence

Step three is the advantage calculation. GRPO samples a group of trajectories for the same question and normalizes rewards within the group, assigning one advantage per trajectory that is shared across all of its context windows. This is the methodological hinge: because the advantage is trajectory-level, a note written in an early window still receives a learning signal from the correctness of the final answer.

Three test-time strategies built on the same notes

The tool set is small. semantic_search queries bge-small-en-v1.5 embeddings over sliding sections of 128–256 tokens; ripgrep_search matches exact keywords and regular expressions; view reads any line range in full. The book is never prefilled, so the agent must retrieve everything it uses.

Three context operations share those notes. Compaction into a new window replaces the history with a fresh window containing only the saved notes. Context folding additionally keeps the turns after the most recent note. Confidence-based backtracking resumes from an earlier note checkpoint after a low-confidence answer and generates an alternative continuation.

The engineering detail that makes this work is that all three share the same prompts, note structure and layout, with the task and saved notes always forming the window prefix; only the suffix differs. A policy trained only on compaction therefore sees a familiar context under the other two, which keeps train-test mismatch small and lets a deployment pick a cost-accuracy point rather than being locked into one.

Ablations and the cost sheet: who earns the points

The ablations are explicit that supervised fine-tuning alone is not meant to raise accuracy; it installs a note-taking strategy that teaches the model when to write. The jump from 36.9% to 66.3% comes from RL on top of that initialization, and confidence calibration plus backtracking adds the final 1.5 points to 67.8%. In rough terms, thirty points come from learning to take notes and the last stretch comes from knowing when the answer is probably wrong.

Against external models, the same-harness GPT-5.5 agent reaches 13.1%, and full-book GPT-5.5 reaches 56.7% at 54 times the cost. The GLM-5.3 agent reaches 69.3% with a model roughly 100 times larger at 9 times the cost, and full-book GLM-5.3 reaches 74.3% at 26 times the cost. Reading the whole book at once is still the most accurate approach; every extra point just costs a multiple.

Where the method stops working

The method does not apply when the task leaves book QA. Every result rests on short free-form answers graded by an LLM judge against a few words, with three retrieval tools and deliberately no paid search API, since API costs would make RL training infeasible. Tasks that require writing long reports or calling external systems are out of scope here.

It also fails when the definition of a good note changes. Validity is three hand-written rules, a five-note cap, a placement restriction and an 80% similarity threshold. Those rules can block a genuinely useful sixth note, and they can teach a model to satisfy the rule rather than write well. Whether the learned habit survives a different rule set is untested.

Backtracking fails when confidence is miscalibrated. The calibration reward is only trained in-distribution, so on shifted question types a low-confidence flag may fire in the wrong place and burn compute on a pointless retry. Finally, everything was verified with 16–20K training windows and never more than 20K tokens of context at test time, and the system still trails full-book GLM-5.3 by 6.4 points. The defensible claim is 91% of the accuracy at 1/26 the cost, not a clean win for small models.

References

  1. Memento: Learning Context Management for Long Context Processing Agents

Sign in to Padda

A code in your inbox. No password to remember.

Connecting to sign-in…