Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ When a long session fills its context, Claude Code replaces the conversation wit

Yes, in a controlled test run before the plugin was built, with direct questions rather than a live task. On 48 long conversations, each compacted five times, an agent answered questions about what had been said earlier. With a 1,024-token summary plus search, it scored 0.80, against 0.53 for the summary alone and 0.72 for a summary four times the size. On `claude-haiku-5-5`, the capped keyword search used fewer tokens per question than the bigger summary and cost less per correct answer.

A stronger reader doesn't remove the need. On the 384 questions after the fifth compaction that all three models answered, the summary alone scored 0.42 on `claude-haiku-5-5` and 0.43 on `claude-opus-5-5`; with search, 0.72 and 0.85. On Opus, though, search cost about as much per correct answer as the bigger summary.

<picture>
<source media="(prefers-color-scheme: dark)" srcset="results/charts/main-dark.svg">
<img alt="Score against mean tokens per question for each arm on claude-haiku-5-5, with 95% intervals: summary 0.53, summary-big 0.72, search 0.80, search-nudged 0.83, ceiling 0.95, floor 0.00" src="results/charts/main-light.svg">
Expand Down
1 change: 1 addition & 0 deletions STATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The harness is built and runs end to end offline (`make offline`) against fake m

## Recently Done

- README: the "Does it help?" section also gives the `claude-opus-5-5` scores, checked like the other numbers, since a stronger reader is the obvious objection (#119)
- Third-model run on `claude-opus-5-5` at effort `high`, an extra added after the plan: the Sonnet run's four arms on all 48 cases, 1,536 questions, every answer usable, $49.06 against a $48.26 estimate; the report shows it beside the other two models and it decides no hypothesis ([third-model run](docs/third-model-run.md)) (#117)
- [README](README.md) leads with the plugin: what it does and why, install, the headline result and chart as the test behind it, a real session, then the experiment's detail; the repository and package descriptions lead with the plugin too (#115)
- Pre-publication check: a [NOTICE](NOTICE) and the Apache 2.0 text in `LICENSES/` for the CompactBench text in the summaries and traces, a contact line in the README, and the `plan-frozen` tag ruleset kept in `.github/rulesets/` (GitHub refuses rulesets on a private free repository) (#35)
Expand Down
23 changes: 23 additions & 0 deletions src/backread_exp/readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,21 @@ def score(arm: str, places: int = 2) -> str:
f"A second model, `{second['model']}`, ran a smaller grid",
]
third = summary.get("third_model")
shared: dict[str, Any] = summary.get("shared_all") or {}

def shared_score(arm: str, run: str) -> str:
return fmt_num(shared[arm][run]["score"], 2)

if third is not None:
fragments += [
f"| `{third['model']}` third-model run | {_usd(parts[labels['third-model-']])} |",
f"`{third['model']}` repeated it",
f"On the {shared['summary']['questions']:,} questions after the fifth compaction"
" that all three models answered, the summary alone scored"
f" {shared_score('summary', 'main')} on `{model}` and"
f" {shared_score('summary', 'third_model')} on `{third['model']}`;"
f" with search, {shared_score('search', 'main')} and"
f" {shared_score('search', 'third_model')}.",
]
return fragments

Expand Down Expand Up @@ -142,6 +153,15 @@ def cheapest(among: Sequence[str]) -> str:
return min(among, key=per_correct)

better = [a for a in arms if arms[a]["score"]["point"] > arms["summary"]["score"]["point"]]
third = summary.get("third_model")
third_arms: dict[str, Any] = third["arms"] if third else {}

def third_close_in_cost() -> bool:
if not third_arms:
return False
search, big = (third_arms[a]["usd_per_correct"] for a in ("search", "summary-big"))
return search is not None and big is not None and abs(search - big) <= 0.05 * big

return {
"used fewer tokens per question than the bigger summary": tokens("search")
< tokens("summary-big"),
Expand All @@ -153,6 +173,9 @@ def cheapest(among: Sequence[str]) -> str:
"`floor` scores zero": arms["floor"]["score"]["point"] == 0,
"Among the arms that score higher, `search` is cheapest.": bool(better)
and cheapest(better) == "search",
"A stronger reader doesn't remove the need.": bool(third_arms)
and third_arms["search"]["score"]["point"] > third_arms["summary-big"]["score"]["point"],
"search cost about as much per correct answer as the bigger summary": third_close_in_cost(),
}


Expand Down
9 changes: 9 additions & 0 deletions tests/test_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,12 @@ def test_a_lost_second_model_is_caught(
) -> None:
found = readme.problems(text, {**summary, "second_model": None}, ledger, PICKS)
assert found == ["mentions a second-model run, but the summary has no second model"]


def test_a_moved_third_model_score_is_caught(
text: str, summary: dict[str, Any], ledger: list[LedgerEntry]
) -> None:
moved = copy.deepcopy(summary)
moved["shared_all"]["search"]["third_model"]["score"] = 0.70
found = readme.problems(text, moved, ledger, PICKS)
assert any("with search, 0.72 and 0.70." in p for p in found)
Loading