Learning in a world of notes: RL on top of text memory
Read first: DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models · LoRA: Low-Rank Adaptation of Large Language Models
TL;DR. Engram asks whether reinforcement learning still helps an agent that already has good notes and an optimized prompt. A separate agent builds the notes; the agent being trained only reads them. With the notes, harness, workspace and system prompt all frozen, they train only the reader’s weights (GRPO + LoRA, reward = accuracy minus a cost penalty). Across three workspaces, training adds about 7–20 points. It is cheap next to building the notes (about 5–30% of that cost) and pays for itself within days compared with a frontier model at the same accuracy. A model trained once still beats the base model after the notes have changed by about 23M tokens. The traces suggest RL improves how the reader uses the notes, such as narrow lookups and checking what the notes are missing. They do not show that the weights learned no workspace facts.
Why it matters. Most agent “memory” today is text: notes, wikis, skill files. That leaves an open question: is that the end of learning, or should the weights still change? This post argues the two compound. For an IR reader, the notes work like a hand-built index and metadata layer over a raw collection, and RL trains the querying policy over that index: what to ask for, how much to fetch, and when to distrust the index and go to the documents.
Key idea
Section titled “Key idea”Setup. Three workspaces:
- Harvey C&H: a synthetic law firm of about 100M tokens; 125-question held-out subset.
- Hex Shorelane Commerce: a data warehouse with messy identifiers, evaluated on DataBench tasks through Hex’s MCP server.
- Engram Internal: an October 2026 snapshot of Engram’s Notion workspace.
The agents run in the Pi harness. Qwen 3.8-27B is used on Harvey and Engram Internal, and GLM-5.3-Flash on Hex. A separate note-building agent (Engram’s recipe with Claude Sonnet and Haiku) writes the notes, and GEPA optimizes the reader’s system prompt. The baseline is already strong: base model + notes + optimized prompt.
What is trained. Only the model. Training tasks are disjoint from evaluation. The reward per rollout combines correctness with a cost penalty:
and sweeping (the tables use 0, 0.05, 0.1, 0.2) traces out an accuracy–cost frontier. The post does not spell out the cost unit; the plots are in rollout tokens per query. GRPO needs no value network. It samples a group of rollouts for the same task and uses the group-normalised reward as the advantage (the standard form from DeepSeekMath):
Within a group, a correct rollout that used fewer tokens gets a higher advantage than a correct one that wandered. That is the pressure towards narrow lookups. LoRA keeps the update small ( with low-rank ), so the “learned memory skill” is a cheap adapter on a frozen base.
What stays fixed vs what moves.
| Component | During RL | Who produced it |
|---|---|---|
| Workspace (raw files / warehouse) | Frozen | The task |
Notes (notes/) | Frozen | Separate note-building agent (Sonnet + Haiku) |
| System prompt | Frozen | GEPA |
| Harness and tools (Pi, shell, MCP) | Frozen | Fixed |
| Reader weights | Updated (LoRA) | GRPO on accuracy − λ·cost |
note builder (Sonnet+Haiku) ──► notes/ ─┐ frozen GEPA ───────────────────────► prompt ─┤ frozen workspace files / warehouse ─┤ frozen Pi harness + tools (shell, MCP) ─┤ frozen ▼ reader LLM (base + LoRA) ◄── GRPO: acc − λ·cost (trainable) │ on training tasks ▼ held-out eval tasks (disjoint from training)Worked trace (from the post, Harvey C&H). The question asks for Real Estate matters where title insurance was in place.
- The base + notes model pulls every Real Estate row from
matter_metadata.jsonlat once. The 16,308-token output hits the tool’s 50KB cut-off, so it sees 4 of 11 matters and scores 43% at 98K tokens. - The trained model asks the notes only for matter IDs, gets all 11 IDs in 121 tokens, then greps each matter’s closing documents. It scores 86% at 61K tokens.
Nothing in the notes changed. The query did.
Second trace: gap-checking. For a White Collar & Investigations question, the notes list no such practice area. The base model settles on the nearest listed area and answers with the wrong matter. The trained model notices the mismatch, counts 133 matter IDs in the notes against 266 folders, and falls back to the raw files to find the right matter. The post stresses that the trained model does not run this check on every query. Its frequency tracks how much the notes are missing (Figure 8).
What the numbers say
Section titled “What the numbers say”Ablation: notes × training (Appendix Table 2; accuracy / rollout tokens per query, one λ per trained row).
| Notes | Trained | Harvey C&H | Hex | Engram Internal |
|---|---|---|---|---|
| — | — | 60.0% / 90.0k | 15.0% / 16.1k | 72.7% / 73.0k |
| ✓ | — | 72.3% / 53.9k | 18.0% / 19.5k | 81.0% / 70.0k |
| — | ✓ | 68.2% / 130.8k (λ=0.1) | 27.0% / 26.9k (λ=0.2) | 88.6% / 69.0k (λ=0.1) |
| ✓ | ✓ | 76.0% / 36.7k (λ=0.1) | 37.0% / 17.8k (λ=0.2) | 87.6% / 68.0k (λ=0.1) |
How to read it:
- Harvey. Notes do most of the work (+12.3). Training on top adds +3.7 at λ=0.1 and cuts tokens by about a third (53.9k → 36.7k). Training without notes improves accuracy but costs more tokens than the base model (130.8k): RL alone learns to search harder, not smarter.
- Hex. Notes alone barely help (+3.0), but training with notes more than doubles accuracy (18.0 → 37.0). This is the one workspace where the effects are clearly super-additive.
- Engram Internal. Training without notes (88.6) is comparable to training with them (87.6), as the post notes.
- Headline gains depend on λ. The text says Harvey reaches 80% and Hex gains 15 points, read from the λ sweep in Figure 2. Table 2’s single-λ rows show +3.7 and +19.0, and Table 1 selects a 38.00% Hex model (λ=0). The “7 to 20 points” claim is about the best points on each frontier.
- Alternative notes recipe (Figure 7, Harvey). Training also helps on more prose-heavy notes, but that trained model trails the one trained on the structured notes. So better notes and training add up.
Cost and break-even (Table 1; workload 20 users × 20 queries/day).
| Workspace | Notes cost (incl. prompt opt.) | Training cost | Selected model | Cheapest frontier within ±1 pt | Break-even |
|---|---|---|---|---|---|
| Harvey C&H | $1,894.49 | $372.57 | Qwen 3.8-27B + notes, λ=0.05 (77.84%) | GPT-6 Sol medium + notes (77.92%) | 8.7 days |
| Hex DataBench | $245.31 | $45.12 | GLM-5.3-Flash + notes, λ=0 (38.00%) | Sonnet 5.5 medium, no notes (38.00%) | 7.4 days |
| Engram Internal | $2,007.24 | $123.31 | Qwen 3.8-27B + notes, λ=0 (90.60%) | Sonnet 5.5 high + notes (90.15%) | 0.7 days |
- Training/notes cost ratios work out to about 19.7%, 18.4% and 6.1%. The post’s footnote says its notes recipe is deliberately thorough; alternatives were 5–10 points worse.
- Training cost is modelled, not metered: $4.00 per B200-hour, 40% MFU (dense) or 20% (MoE) for training and prefill, 60% MBU for decode.
- Per-query prices: list API prices for frontier models, OpenRouter prices for Qwen and GLM. On Harvey at about 78%, the trained model costs 0.17 for GPT-6 Sol medium.
- On Hex, RL with notes does not reach the frontier’s accuracy; the post suggests the task may be too hard for the small base model. On Harvey and Engram Internal, the trained small models reach the cost–quality Pareto frontier.
Robustness to changing notes (Figure 5, Harvey). The note builder starts with half the matters and receives the rest in stages, editing the notes by about 23M tokens (more than 3× their original size). Results:
- A model trained once on the initial notes beats the base model with the same notes at every stage.
- The reused model’s accuracy rises as the notes improve.
- Retraining on the final notes is only slightly better.
Behaviour shifts (Figures 8–10):
- Harvey. 26% more notes lookups, each returning 36% fewer tokens. Broad queries in the base model get truncated.
- Hex. 9.2 vs 6.8 lookups per question; a typical trace drops from 567 to 166 tokens per lookup. In one trace the base model reads 12K tokens of notes and misses the key detail, while the trained model finds it with 30% fewer tokens.
- Engram Internal. About the same number of lookups, 19% fewer tokens each, and more link-following from notes to source files rather than searching across both.
Caveats
Section titled “Caveats”- A company blog, not a paper (November 2026). There is no code, no released notes or models, single runs, and figure values that can only be read off plots. The Harvey evaluation is 125 questions: flipping one item from entirely wrong to entirely right moves the mean by 0.8 points, and partial-credit scoring allows smaller changes. No seed-level or per-question uncertainty is reported, so close comparisons (±1 point frontier matching, 87.6 vs 88.6 on Engram Internal) cannot be called ties or wins.
- Gains depend on the operating point. Headline numbers come from the best λ; fixed-λ rows are smaller on Harvey and Engram. Compare frontiers, not single points.
- The cost model favours training. It is a modelled single run (the λ sweep is not counted). Serving a LoRA-adapted model is priced as if it were the shared OpenRouter base model. The notes recipe was chosen to be expensive. Hex is matched against a frontier model without notes, so whether the notes cost should count changes break-even a lot.
- Narrow drift test. The robustness experiment grows the same notes recipe over the same workspace. Schema changes, new tools or a different note builder are untested, and those are the changes most likely to break learned query habits such as specific
jqfield names. - Reader only. The agent never writes notes. The post lists joint learning to build and use notes as future work.
- Small models. All trained readers are small open models (Qwen 3.8-27B, GLM-5.3-Flash); whether the gains persist on stronger readers, which may already query precisely, is open.
Connections
Section titled “Connections”- Librarian Agents: the mirror image. Librarian trains the note builder with GRPO against a frozen reader; Engram freezes the notes and trains the reader. The post cites it as a route to learning both.
- GEPA: the prompt optimizer used for the baseline. This post is a case where RL adds on top of a GEPA-optimized prompt rather than competing with it.
- MemGPT and A-MEM vs Mem0: agents that write their own text memory. Here memory is written by a separate agent, and the question is whether the reader’s weights should adapt to it.
- Raw-RAG: argues raw evidence beats processed memory. The gap-check trace shows the same lesson from the other side: a trained reader learns when to leave the notes and read raw files.
- Context-Folding and ReSum: RL for memory within one trajectory (summaries, folds). This post is about persistent memory across tasks, with only lookups learned.
- Search-R1: RL to call a frozen retriever. The Engram reader does the same thing with notes and shell tools as the “retriever”; the cost penalty plays the role of a search budget.
- GRPO (DeepSeekMath) and LoRA: the RL algorithm and the parameter-efficient update used for training.
- On-Policy Distillation: named in the post as a next step beyond plain RL, giving denser per-token supervision for the same reader.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
On Harvey C&H the trained Qwen 3.8-27B costs $0.06 per query and the accuracy-matched GPT-6 Sol (medium, with notes) costs $0.17. Training cost is $372.57 and both sides use the same notes. Compute the break-even time at 20 users × 20 queries per day and compare with the reported 8.7 days. Then use Engram Internal ($123.31 training, 0.7 days) to back out the implied per-query saving, Hex reports $45.12 training, $245.31 note construction and 7.4 days to break even (its matched frontier model uses no notes). Assuming the 7.4 days amortizes training alone, compute the implied daily saving and the break-even time including notes, and say why this is conditional rather than a correction to the published estimate.
What a strong answer covers
- Harvey: saving ≈ $0.11 per query × 400 queries/day ≈ $44/day, so 372.57 / 44 ≈ 8.5 days; the gap to 8.7 comes from the rounded per-query prices (8.7 days implies ≈ $0.107 per query).
- Notes cost cancels on Harvey because the frontier comparator also uses the notes; only the training cost has to be recovered.
- Engram: 123.31 / 0.7 ≈ $176/day ≈ $0.44 saved per query at 400 queries/day, a much larger per-query gap than on Harvey, which is why break-even is under a day.
- Hex: under that assumption the daily saving is 45.12 / 7.4 ≈ $6.10, and notes + training ($290.43) amortizes in 290.43 / 6.10 ≈ 47.6 days. The post does not say whether its figure already includes notes, so the actual accounting cannot be identified.
- Break-even scales inversely with volume: at 2 users instead of 20, Harvey would take ≈ 85–87 days.
- Mechanism
With notes, harness and the GEPA-optimized prompt frozen, what do the Real Estate and White Collar traces suggest changed after GRPO + LoRA? Separate observed behavior from claims that RL alone could produce it, and explain what the note-edit experiment establishes about generalization.
What a strong answer covers
- Observed policy change: the trained model makes narrower lookups (jq returning only 11 matter IDs, 121 tokens) instead of dumping full rows that hit the tool's 50KB cut-off (16,308 tokens, 4 of 11 matters seen), and it runs coverage checks.
- Conditional verification: when a lookup looks wrong (a practice area missing), compare the notes' 133 matter IDs against the 266 folders and fall back to raw files; the base model takes notes at face value.
- The comparison shows improvement over the tested GEPA baseline; it does not prove that prompting cannot implement these behaviors (truncation and coverage gaps are observable) or that the weights memorized no workspace facts.
- The cost term pushes towards smaller results per lookup (Harvey −36% tokens per lookup with 26% more lookups; Hex 567 → 166 tokens per lookup), trading many cheap precise calls for few broad ones.
- The trained-once model still winning after 23M tokens of edits supports transfer within the tested notes workflow (same recipe, schema and tools), not invariance to arbitrary schema, tool or workspace changes.
- What if…
Table 2 gives accuracy for {notes, no notes} × {base, trained}: Harvey 60.0 / 72.3 / 68.2 / 76.0, Hex 15.0 / 18.0 / 27.0 / 37.0, Engram Internal 72.7 / 81.0 / 88.6 / 87.6 (base, +notes, trained-no-notes, notes+trained). Compute the notes effect, the training effect and their interaction in each workspace, and explain why training without notes has similar reported accuracy to training with notes on Engram Internal but falls clearly short on Harvey.
What a strong answer covers
- Harvey: notes +12.3, training +8.2, both +16.0, so the interaction is ≈ −4.5 (sub-additive). Hex: +3.0, +12.0, +22.0, interaction ≈ +7 (super-additive). Engram: +8.3, +15.9, +14.9, interaction ≈ −9.3.
- Hex is the only case where notes and training multiply; notes alone barely help the small GLM model, but training teaches it to use them.
- Harvey is about 100M tokens and many tasks enumerate matters; without a metadata index the trained agent reads much more (130.8k tokens vs 90.0k base) and still scores lower, so the notes act as an index RL cannot replace.
- On Engram Internal the tasks involve reconciling updates over time, where primary sources matter; a plausible reading is that RL alone learns to navigate the raw workspace well enough. The post only reports the result, so this is a hypothesis.
- The post reports no seed-level or per-question uncertainty, so neither equivalence nor significance can be established. Treat the interactions as descriptive and use paired per-question resampling plus repeated training runs.
- Critique
The cost story rests on a modelled training cost ($4 per B200-hour, 40% MFU dense, 20% MoE, 60% decode MBU), OpenRouter prices for the small models, list API prices for frontier models, and a "cheapest frontier model within ±1 point" match. Identify the two or three weakest links in this comparison and the measurement that would expose each.
What a strong answer covers
- Matching noise: the ±1 point rule is vulnerable to evaluation uncertainty. Item scores can be fractional, so bootstrap paired per-question scores rather than assuming 125 Bernoulli trials, and include uncertainty in which frontier comparator qualifies.
- Serving cost: OpenRouter prices are for the base model on shared infrastructure; a LoRA-adapted model needs its own deployment or multi-LoRA serving, with utilization that 400 queries/day may not justify. Measure real per-query cost on the actual deployment.
- Training cost is modelled from utilization assumptions, not metered, and covers one selected run; the λ sweep, failed runs and engineering are not included. Report metered GPU-hours for the full sweep.
- The notes recipe is deliberately expensive (alternatives scored 5–10 points lower), which makes training look cheap in relative terms; the 5–30% ratio depends on that choice.
- On Hex the comparator uses no notes, so whether notes cost belongs in break-even changes the answer by roughly 6×.
- Design
You deploy a trained notes-reader for a firm whose note-building agent rewrites notes continuously. The post's drift test grows the same structured notes from half to all of the matters (≈ 23M tokens of edits) and finds reuse works. Design a monitoring and retraining policy, and the experiment that tells you which kinds of note changes actually require retraining.
What a strong answer covers
- Separate drift types the post did not test: content growth in the same schema (tested), schema or format changes (structured JSONL to prose, renamed fields), and tool or harness changes that break learned jq/grep habits.
- Experiment: take the trained-once model and evaluate it on held-out tasks under each drift type against the base model and a model retrained on the new notes; retraining is needed when the gap to retrained exceeds noise.
- Online signals: rate of truncated tool outputs, lookups that return empty results, gap-check frequency (the post shows it tracks missing coverage), tokens per lookup, and answer accuracy on a small labelled canary set.
- Retrain when the expected value of avoided errors exceeds measured retraining and deployment cost (≈ $45–$373 per run under the post's model), subject to quality floors. Accuracy loss × query volume is an error count, not dollars.
- Keep the alternative-recipe result in mind: training helped there too, but the trained model on prose notes trailed the one on structured notes, so a format change is the riskiest case.
- Research idea
The post builds notes first and then trains the reader, and names learning to construct and use notes jointly as future work (citing Memory-R1 and Librarian Agents). Pitch a project that co-trains a note builder and a note reader, stating the hypothesis, the minimal experiment, and the result that would falsify it.
What a strong answer covers
- Hypothesis: a builder trained against an RL-trained reader writes different notes (for example more ID-level indexes and explicit coverage lists) than one trained against a frozen reader, and the pair beats sequential training at equal compute.
- Minimal setup: Harvey-style workspace, small builder and reader, alternate GRPO phases (builder rewarded by reader accuracy minus build cost, reader by accuracy minus λ·cost), compared with build-then-train and with Librarian-style builder-only training.
- Non-stationarity risk: each agent's target moves; freeze one side per phase and track whether notes collapse into reader-specific shortcuts that another reader cannot use.
- Measure tokens per correct answer including build cost, and robustness when the notes are edited by a different builder.
- Failing to beat build-then-train at matched compute falsifies the main claim. Transfer of co-trained notes to a fresh reader is a separate robustness test; failing it need not negate a useful co-adapted pair.