Paper summary: Writing in the Margins: Better Inference Pattern for Long Context Retrieval
Writing in the Margins processes a long context chunk by chunk during prefill, writes short "margin" notes per chunk, keeps the relevant ones, and uses them to answer, improving off-the-shelf models without fine-tuning.
Problem
Long-context models can accept huge inputs, but they don’t always use the relevant parts well, especially for multi-hop reasoning or aggregating information spread through a document.
Method
Writing in the Margins (WiM) is an inference pattern, with no training:
- Long inputs are already processed in chunks during chunked prefill of the key–value cache.
- After each chunk, the model writes a short note, a margin, about what that chunk contains that’s relevant to the query.
- Margins are classified as relevant or not, and the useful ones are added before the final answer is generated.
The computational overhead is small, and the margins can also give users ongoing updates during long retrieval.
Key results
From the abstract, on off-the-shelf models without fine-tuning:
- +7.5% average accuracy on reasoning tasks (HotpotQA, MultiHop-RAG)
- more than 30% F1 increase on aggregation tasks (CWE)
Limitations
There’s no dedicated limitations section in the extracted text. Generating margins adds some extra decoding per chunk, which the authors describe as a marginal overhead.
Sources
- Writing in the Margins: Better Inference Pattern for Long Context Retrieval (arXiv:2408.14906) — arXiv
- Hugging Face Daily Papers, 2024-08-28 — Hugging Face
- Writing in the Margins: Better Inference Pattern for Long Context Retrieval (arXiv HTML full text) — arXiv
- Code repository (linked in the paper) — GitHub
This is a summary written from the linked public sources. Figures and numbers are as reported there.