Skip to content

feat(recall): real-store HIT@1 eval harness, and settle roadmap item 13 - #170

Merged
navbytes merged 5 commits into
mainfrom
claude/recall-realstore-eval
Jul 28, 2026
Merged

navbytes merged 5 commits into
mainfrom
claude/recall-realstore-eval

Conversation

@navbytes

Copy link
Copy Markdown
Owner

Settles item 13 with a measurement built from a real store instead of synthesised notes.

The finding, in short

Recall accuracy does degrade as a store grows — the premise item 13 had written off. But length normalization is not the fix, which is the verdict item 13 already reached, now on stronger evidence.

HIT@1 by corpus size (22-query corpus, real 195-note store):

size 22* 40 100 160 whole store
HIT@1 18/22 16/22 15/22 13/22 12/22

*targets only, no distractors — a different regime from the rest of the curve.

Sweeping BM25 b ∈ {0, .25, .5, .75, 1.0} moved nothing — identical HIT@1 at every value, paraphrase corpus 8/8 throughout. Length is simply not the operative variable.

The actual mechanism: closed-class function words are scored as topical terms. IDF over a few hundred terse notes cannot tell "uninformative in English" from "rare in this store" — should (df=5) scores IDF 3.69, above swift (3.12) in an iOS-heavy store. As the store grows the target's score stays put while the best distractor's rises. Function-word share of the winning note: 0.02 on a hit, 0.44 on a miss.

The ceiling that matters more than tuning: targets sharing ≤2 query concepts hit 0/6; those sharing ≥3 hit 12/16. Reweighting cannot cross that gap, so embeddings stay parked — now for a measured reason rather than an assumed one.

Why these numbers can be trusted

A previous attempt invalidated itself: its queries were written while looking at the target, producing planted near-duplicates. This corpus was built under enforced information asymmetry — one agent saw each note and wrote a scenario with the note's distinctive vocabulary stripped; a second agent, which never saw the notes or titles, wrote the queries from scenarios alone. The scenario writer had to rewrite 16 of 22 after its own leak self-check, which is how systemic the contamination is.

The harness

internal/recall/realstore_eval_test.go — skip-by-default, driven by NT_EVAL_STORE / NT_EVAL_CORPUS, optional NT_EVAL_MIN_HIT1 floor, NT_EVAL_SIZES to reproduce the curve. Fixed-seed nested sampling (each size is a strict superset of the previous).

No real note content is committed — deliberately; the store holds private client data. That is also why this PR adds .claude/company/ and .claude/worktrees/ to .gitignore: they held verbatim titles copied out of the store and were covered by a global gitignore on one machine only.

Verified

go build ./..., go test ./..., go vet ./..., golangci-lint run ./internal/recall/... all clean, run bare. Skips cleanly with no env set.

Known limits

Per-size counts are a point-in-time measurement — a later run on the same store measured 19/16/14/14/12 as the store drifted. The monotone decline holds; the exact digits are not reproducible. The b-sweep and IDF figures came from one-off instrumented runs, not this harness — flagged as such in the roadmap. This session's sweep also disagrees with the earlier session's on whether non-zero b broke the paraphrase corpus; that contradiction is recorded unresolved rather than papered over.

navbytes added 5 commits July 28, 2026 23:54
Settles roadmap item 13 (does recall accuracy degrade as a store grows?)
without ever touching real note content: NT_EVAL_STORE/NT_EVAL_CORPUS point
outside the repo, and the test skips cleanly when unset. Measures HIT@1 at
corpus sizes 10/20/40/whole-store with a deterministic (fixed-seed) sample
of distractors, and only fails on operational errors unless NT_EVAL_MIN_HIT1
opts into a regression floor.
…ation flat, identify function-word IDF as blocker

Earlier session reported HIT@1 falling 65%→41% as store grew and tried length normalization (BM25 `b`), but used adversarial synthetic distractors ("the wait budget for writers" vs "writers exceed the wait budget"). This session re-tested against user's actual 218-note store with controlled corpus (information asymmetry: one agent wrote scenarios from notes with vocabulary stripped; second agent unseen notes wrote queries from scenarios alone).

**Findings:**
- Growth degradation is real: HIT@1 size 22→18/22, 40→16/22, 100→13/22, 160→11/22, 218→12/22
- Length normalization does nothing (swept b∈{0,0.25,0.5,0.75,1.0}: flat 16/22 at size 40, 12/22 full, paraphrase corpus 8/8 throughout)
- Real issue: function words scored as topical (IDF can't distinguish "uninformative in English" from "rare in store")
- Growth mechanism: target +19.7%, best distractor +106.9% size 25→218; function-word share 0.02 on hit, 0.44 on miss
- Hard ceiling: targets with ≤2 concepts 0/6, ≥3 concepts 12/16
- Stopwords gain +1–2 precision mid-range but don't fix growth; combined with b=0.75 collapse by size 100, regress paraphrase 8/8→7/8

**Methodology:** Information-asymmetry protocol isolates corpus distortion from scorer; both synthetic and honest trials now tested. Live harness: internal/recall/realstore_eval_test.go (NT_EVAL_STORE / NT_EVAL_CORPUS env vars); no real note content committed (private client data).

Precondition holds: embeddings cannot land without semantic-distance quality lexical scoring cannot provide.
… configurable sizes; re-measure roadmap curve

Code review fixes to the real-store eval harness:
- corpus sizes now configurable via NT_EVAL_SIZES, defaulting to the
  published curve (22, 40, 100, 160, 218, 0) instead of an unreproducible
  hardcoded {10, 20, 40, 0}
- filter note.Reserved() alongside note.Active(): __tasks__/ notes were
  counted toward corpus size and IDF's n but never scored by RankProject,
  inflating every labeled size by ~10%
- hit check now compares the resolved target note's Rel, not top.Title, so
  a duplicate title can't produce a spurious hit
- best-effort LoadUserSynonyms(dir), matching cmdRecall, plus a comment
  noting RankProject's project boost is deliberately off here
- log empty-result counts per size separately from wrong-note misses
- nits: fixed the NT_EVAL_MIN_HIT1 doc example, renamed the local `min`
  shadow, noted expiredPenalty's time.Now() point-in-time caveat

Re-measured against the live store after the reserved-note fix (true
scored size 195, not 218): size 22 (targets only, no distractors) 18/22,
40 → 16/22, 100 → 15/22, 160 → 13/22, 195 (whole store) → 12/22 — a fully
monotone decline, no tail wobble. The growth-degradation conclusion holds
and is if anything cleaner than the pre-fix curve.

Roadmap: corrected every number in item 13 to the re-measured curve,
surfaced the unresolved contradiction between this session's and the
earlier session's b-sweep (both include b=0.75/1.0, disagree on the
paraphrase-corpus effect), restored the "do not re-attempt without new
evidence" imperative, attributed the information-asymmetry protocol to
this session only, and added a provenance note distinguishing
harness-reproducible figures from one-off instrumented runs.
…ent scratch

The corpus-format comment used a real 6-char handle from the author's private
store, which is both a leak into a public repo and wrong (matching is on the
full 26-char ULID, so a short form never resolves).

.claude/company/ and .claude/worktrees/ hold verbatim titles copied out of that
store while investigating recall. They were covered by a global gitignore on one
machine only; a git add -A anywhere else would have published them.
@navbytes
navbytes merged commit 887a8f5 into main Jul 28, 2026
9 checks passed
@navbytes
navbytes deleted the claude/recall-realstore-eval branch July 28, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant