Skip to content

Back to the catalog

Librarian Agents: Training LLMs to Curate Long-Context Workspaces that Anticipate Future Queries
arxiv.orgpaper

Librarian Agents: Training LLMs to Curate Long-Context Workspaces that Anticipate Future Queries

Introduces Librarian Agents, where a builder agent turns raw unstructured documents into a hierarchical filesystem of synthetic files and reference links, forming a workspace for a downstream answering agent. Workspace construction is cast as a Markov decision process and the builder policy is trained with reinforcement learning to maximize downstream answering accuracy. It beats the strongest retrieval and precomputation baselines by 33 points on BrowseComp-Plus, amortizes construction cost over repeated queries, and generalizes zero-shot to BRIGHT with a 31-point average gain.

TL;DR RL-trained builder agents pre-organize document corpora into filesystem workspaces that anticipate future queries, beating retrieval baselines by 33 points on BrowseComp-Plus.
Document

What it claims

A builder LLM is trained with RL to rewrite a raw document corpus into a filesystem workspace before any queries arrive. The workspace holds synthetic summary files, hierarchy and reference links back to the originals. A frozen answering agent then navigates it with ordinary list and read tools. The pitch is that agents already handle filesystems well (the paper cites Claude Code-style harnesses), so the learned structure is exposed through an interface that needs no new retriever. The headline results are an average 33-point gain over the best retrieval and precomputation baseline on BrowseComp-Plus, and an average 31-point gain on BRIGHT, which the builder was never trained on.

How it works

  • State: the current filesystem, meaning the raw documents plus any synthetic files, folders and links created so far.
  • Action space: deliberately restricted to four builder actions, to shorten the optimisation horizon:
  • CreateFile consolidates raw and/or synthetic files and links back to its sources.
  • MergeFiles builds a higher-level summary or directory over child files.
  • Delete removes synthetic files only. Raw documents are never deleted, so the answering agent can always fall back to them.
  • Stop ends construction.

The authors note this could be widened to raw touch/mkdir/mv/rm but did not do so.

  • Answering agent: frozen. It has file-listing and file-reading actions and is scored with 0/1 correctness.
  • Objective:
  • The general utility is accuracy minus token-cost and file-read penalties, where the penalties apply only to correct answers, minus a construction-cost term.
  • The dense per-step reward is the change in utility. It telescopes to the sparse objective, which makes it potential-based shaping.
  • Practical surrogate:
  • The answering agent is probed every 8 builder turns, and the reward combines the accuracy deltas between probes with a terminal answer reward.
  • Advantages are computed per step in the style of multi-turn GRPO.
  • Data hygiene:
  • Reward is estimated on minibatches of training queries that the builder never sees.
  • Evaluation queries are never used to build workspaces or to select checkpoints.
flowchart LR
  D[Raw corpus] --> B[Builder policy]
  B -->|Create/Merge/Delete| F[Workspace]
  F --> B
  F -->|every 8 turns| P[Probe frozen answerer<br/>on hidden train queries]
  P -->|accuracy delta| R[Per-step advantage]
  B -->|Stop| T[Terminal answer reward]
  T --> R
  R -->|GRPO update| B

Evidence

The fetched text contains only the headline figures:

  • BrowseComp-Plus: +33 points averaged over the best retrieval and precomputation baseline.
  • BRIGHT (zero-shot): +31 points average.

The text breaks off before the experiments section. Baseline identities, backbone models, the number of training queries and the size of the construction-cost amortisation are therefore not available here.

How to use it

The page gives no install commands, model names, sizes or licence.

Limits

  • Cost penalties are off in the main run. The primary experiment sets the token, read and construction weights to zero (λ_tok = λ_read = α = 0) and optimises accuracy only. The "amortizes construction cost" claim therefore does not come from the cost-penalised objective. Check how construction cost was actually measured before relying on it.
  • Narrow queries may not survive compression. The authors flag that synthesised artifacts can drop details that turn out to matter, especially for needle-in-a-haystack queries. Their mitigation is the raw-document fallback, not the learned structure.
  • Training needs a query distribution and a live answerer. Training requires sampled training queries and repeated rollouts of the answering agent. A corpus with no representative queries has no reward signal.
  • The learned structure is tied to one answerer. The answering agent is frozen during training. Whether a workspace built for one answerer transfers to a different one is not addressed in the fetched text.
  • Partial view of the paper. This analysis covers only the introduction and method. Experimental details, ablations and the authors' own limitations section were not available.

Organisations named here

  • arXiv
  • BRIGHT
  • BrowseComp-Plus
  • Claude Code

Technologies named here

  • Librarian Agents
  • Claude Code
  • LLM
  • RAG

Techniques named here

  • Anticipatory directed curation
  • Librarian Agents workspace construction