From f91ff4820309fd598c22b03e837ecbf4d67e026b Mon Sep 17 00:00:00 2001 From: jacob weiss Date: Tue, 6 Oct 2026 10:01:56 -0600 Subject: [PATCH] docs(context-lm): plain-language chart titles Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + docs/figures/context-lm-accuracy.svg | 8 +++---- docs/figures/context-lm-before-after.svg | 4 ++-- docs/figures/context-lm-idea.svg | 6 ++--- docs/figures/context-lm-learning.svg | 4 ++-- docs/figures/context-lm-tokens.svg | 10 ++++---- recipes/papers/context-lm/figures.py | 30 ++++++++++++------------ 7 files changed, 32 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9606d996..12302fd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ to 0.109 releases under the wrong numbers; they are yanked. ## Unreleased +- `recipes/papers/context-lm/figures.py`: plain-language titles and subtitles on all five figures. - `recipes/papers/context-lm/figures.py` adds two figures: right answers by training step, and the untrained vs trained model's notes on the same held-out log, each line checked against the log's real final values. - `recipes/papers/context-lm/figures.py`: three figures (what a context LM sees, held-out pass@1, tokens a diff --git a/docs/figures/context-lm-accuracy.svg b/docs/figures/context-lm-accuracy.svg index ffcaa376..d85a52e0 100644 --- a/docs/figures/context-lm-accuracy.svg +++ b/docs/figures/context-lm-accuracy.svg @@ -1,7 +1,7 @@ -Answered right on 200 held-out logs -Qwen2.5-1.5B, 60 steps. Untrained: 0.07. Dots: 4 seeds. Tick: mean. +Trained, it gets almost every log right +Untrained: 7% right. Each dot is one training run; the line is the average. 0.80 @@ -19,14 +19,14 @@ 0.95 -+ paper's Eq. 6 +Paper's bonus 0.97 -+ Eq. 6, complete files +Our stricter bonus diff --git a/docs/figures/context-lm-before-after.svg b/docs/figures/context-lm-before-after.svg index c4a0cab6..674eed3c 100644 --- a/docs/figures/context-lm-before-after.svg +++ b/docs/figures/context-lm-before-after.svg @@ -1,7 +1,7 @@ -Its notes after the last chunk, same held-out log -Checked against the log's real final values. Question: final value of maple? +Its notes after reading the whole log +Same unseen log, checked against the true values. Asked: what is maple? UNTRAINED lumen: 275 diff --git a/docs/figures/context-lm-idea.svg b/docs/figures/context-lm-idea.svg index 1c5dba60..af1c8aec 100644 --- a/docs/figures/context-lm-idea.svg +++ b/docs/figures/context-lm-idea.svg @@ -1,7 +1,7 @@ -What the model sees before each answer -A log in 5 chunks of 8 lines, then: final value of maple? (Illustration.) +Normal LLM vs context LM +Same log, read in 5 chunks. One piles it all up. One keeps notes. NORMAL LLM: THE CONTEXT ONLY GROWS chunk 1 @@ -59,5 +59,5 @@ river: 162 ... after chunk 5 -Each chunk is gone after its turn. The model keeps only what it wrote. +Illustration. Once a chunk is read it's gone; only the notes remain. diff --git a/docs/figures/context-lm-learning.svg b/docs/figures/context-lm-learning.svg index d9c07107..f876e45f 100644 --- a/docs/figures/context-lm-learning.svg +++ b/docs/figures/context-lm-learning.svg @@ -1,7 +1,7 @@ -Learning to keep its own notes -Share of training logs answered right, by step. Thin: 4 seeds. Thick: mean. +It learns to keep notes in about 15 steps +Practice logs answered right during training. Faint: each run. Bold: average. 0.00 diff --git a/docs/figures/context-lm-tokens.svg b/docs/figures/context-lm-tokens.svg index f4b9059d..5a408dbb 100644 --- a/docs/figures/context-lm-tokens.svg +++ b/docs/figures/context-lm-tokens.svg @@ -1,7 +1,7 @@ -Tokens spent per held-out log -Prefix-reuse tokens over 6 steps. Untrained: 1,209. Dots: 4 seeds. +Tokens used per log (lower is cheaper) +Untrained: 1,209. Each dot is one training run; the line is the average. 800 @@ -17,19 +17,19 @@ 1,315 -+ paper's Eq. 6 +Paper's bonus 1,115 -+ Eq. 6, complete files +Our stricter bonus 1,050 -Eq. 6 spends 15% less than plain GRPO; most of that is one seed whose file bloated. +The paper's bonus uses 15% fewer tokens, mostly because one plain run let its notes bloat. diff --git a/recipes/papers/context-lm/figures.py b/recipes/papers/context-lm/figures.py index 2c3e7a25..91519437 100644 --- a/recipes/papers/context-lm/figures.py +++ b/recipes/papers/context-lm/figures.py @@ -35,8 +35,8 @@ # labeled, so color is never the only cue. ARMS = [ ("baseline", "Plain GRPO", C["muted"]), - ("paper", "+ paper's Eq. 6", C["green"]), - ("recipe", "+ Eq. 6, complete files", C["warm"]), + ("paper", "Paper's bonus", C["green"]), + ("recipe", "Our stricter bonus", C["warm"]), ] LABEL_W = 176 SEEDS = "17, 18, 19, 20" @@ -108,8 +108,8 @@ def idea() -> None: s = Svg(100 + 150 + 104 + 60) y0 = title( s, - "What the model sees before each answer", - "A log in 5 chunks of 8 lines, then: final value of maple? (Illustration.)", + "Normal LLM vs context LM", + "Same log, read in 5 chunks. One piles it all up. One keeps notes.", ) x0, gap = 24, 8 cw = (W - 48 - gap * (steps - 1)) / steps @@ -131,7 +131,7 @@ def idea() -> None: s.text(x + 8, top + 77, "...", size=11, color="muted", mono=True) s.text(x + cw / 2, top + 102, f"after chunk {t + 1}", size=12, color="muted", anchor="middle") # fmt: skip - s.text(24, s.h - 18, "Each chunk is gone after its turn. The model keeps only what it wrote.", + s.text(24, s.h - 18, "Illustration. Once a chunk is read it's gone; only the notes remain.", size=13, color="body") # fmt: skip s.save("context-lm-idea.svg") @@ -164,8 +164,8 @@ def accuracy() -> None: s = Svg(100 + 170) y0 = title( s, - "Answered right on 200 held-out logs", - f"Qwen2.5-1.5B, 60 steps. Untrained: {base:.2f}. Dots: 4 seeds. Tick: mean.", + "Trained, it gets almost every log right", + f"Untrained: {base:.0%} right. Each dot is one training run; the line is the average.", ) dot_panel( s, y0, "score", "per_seed", 0.80, 1.00, [0.8, 0.85, 0.9, 0.95, 1.0], lambda v: f"{v:.2f}" @@ -179,14 +179,14 @@ def tokens() -> None: s = Svg(100 + 170 + 26) y0 = title( s, - "Tokens spent per held-out log", - f"Prefix-reuse tokens over 6 steps. Untrained: {base:,}. Dots: 4 seeds.", + "Tokens used per log (lower is cheaper)", + f"Untrained: {base:,}. Each dot is one training run; the line is the average.", ) dot_panel(s, y0, "cost_tokens", "cost_per_seed", 800, 2200, [800, 1200, 1600, 2000], lambda v: f"{v:,.0f}") # fmt: skip d = R["deltas"]["paper"]["cost"]["pooled"]["relative"] - s.text(24, s.h - 18, f"Eq. 6 spends {abs(d):.0%} less than plain GRPO; most of that is one " - "seed whose file bloated.", size=12.5, color="body") # fmt: skip + s.text(24, s.h - 18, f"The paper's bonus uses {abs(d):.0%} fewer tokens, mostly because one " + "plain run let its notes bloat.", size=12.5, color="body") # fmt: skip s.save("context-lm-tokens.svg") @@ -221,8 +221,8 @@ def lines(sample): s = Svg(100 + 40 + n * 26 + 62) y0 = title( s, - "Its notes after the last chunk, same held-out log", - f"Checked against the log's real final values. Question: final value of {task['ask']}?", + "Its notes after reading the whole log", + f"Same unseen log, checked against the true values. Asked: what is {task['ask']}?", ) cw = (W - 48 - 16) / 2 for c, (head, rows, right) in enumerate(cols): @@ -259,8 +259,8 @@ def smooth(xs, k=5): s = Svg(100 + 230) y0 = title( s, - "Learning to keep its own notes", - "Share of training logs answered right, by step. Thin: 4 seeds. Thick: mean.", + "It learns to keep notes in about 15 steps", + "Practice logs answered right during training. Faint: each run. Bold: average.", ) px0, px1, py0, py1 = 70, W - 30, y0 + 10, y0 + 180