Skip to content

Recall across fully rephrased queries needs semantic (embedding) search #420

Not planned

Description

@abogartz

Context

Split from #409. #409 asked: can recall find a useful row when the query uses different wording? Two shipped fixes cover most of the observed gap:

What remains unsolved

Matching is still lexical. A query that shares no token with either the row content or its keywords cannot be found — true synonyms ("why are totals off" vs "reconciliation drift at tier edges", with keywords not covering the first phrasing) still miss.

Why it was not fixed here

The alias lane (main model generating keyword aliases per row) was tested and made retrieval significantly worse (gold@5 207 vs 216 shipped; 9 lost, 0 gained; McNemar p=0.004). Auto-generated vocabulary is not the bridge.

Sketch for a real solution

  • Embed rows at write/index time (vectors beside the logfmt row or in a sidecar), embed queries at recall time, blend cosine similarity into the existing score rather than replacing it — lexical hits must keep ranking first.
  • Local or self-hosted embedding model only: no new external service dependency for a local-first plugin.
  • Same discipline as the POC: pre-registered retrieval eval (gold sets from real query logs), offline scorer, no outcome claims from a retrieval metric.

References

#409 (parent), #417, #419, #415, #416.

Activity

  1. abogartz commented on Nov 18, 2026

    @abogartz
    OwnerAuthor

    Extracted verdicts from the deleted poc/409-tag-space branch (the #409 research log, §1–33)

    The branch held a 1,664-line research log plus case-bank tooling and contained absolute local paths, so it is deleted rather than merged. The raw log, lane scripts and case-bank summary are preserved in a local archive outside the repo (publishable on request). Case-bank data (real query text and memory prose) was never in git — gitignored by design; only aggregate counts appear here. This issue's premise — that rephrased queries need semantic search — was tested head-on; the results constrain what any embedding work here would have to beat.

    The semantic round (§27). Seven arms frozen before eval, scored on 404 real recall queries with adjudicated full-text labels (404 control rows: judge calls 2.0% relevant, 0% answer — the precision floor). Embeddings ran local ONNX, zero network. Shipped lexical matcher wins every axis:

    arm gold@1 gold@5 gold@20 held-out gold@5 McNemar held-out vs shipped
    shipped 106 216 227 125 —
    bm25 (no gate) 55 117 162 64 67 lost / 6 gained, p=4e-14
    dense-bge-small 30 65 92 33 95 / 3, p=1e-24
    dense-minilm 22 59 92 34 93 / 2
    hybrid-rrf 81 169 225 95 34 / 4, p=6e-7
    ce-rerank (ms-marco) 98 176 227 106 20 / 1, p=2e-5

    Three independent findings: (1) dense cannot see the gold — 92 of 404 gold rows reach its top-20 vs 227 shipped; mean-pooled vectors rank the same-scope cluster, not the row; two different embedding models agree, so it is the domain, not the model. (2) The two-concept abstention gate is load-bearing: ungated BM25 on the same corpus loses 110 queries at k=5. (3) Dense recovers only 3–5 of the 188 held-out queries the shipped window misses; hybrid fusion recovers 4–7 and destroys 31–34. The rephrasing class is not a vocabulary bridge, and semantic re-ranking is excluded as the bridge. Store hygiene (#415) and ranking remain the candidates.

    Adjacent lanes, same corpus. Write-side alias-kw is strictly worse (McNemar p=0.004, §29). Deterministic boundary steering: do not widen the pull trigger set (§28). Content ablation (§30): decoy damage confirmed, delivery solved, use is the wall — 7 of 8 agents never referenced injected memory. Pre-registered outcome tests (§31–33): clean memory is directional at scarce token budgets (BA 5/16 vs BB 7/16; REGIME 350 budget-shift prediction held exactly), not significant, not extended.

    Implication for this issue: before spending on embeddings, note that on this store the rephrased-query failures are not explained by lexical gap — the gold rows dense search retrieves are a 3–5 query set. Any proposal here should first show it recovers held-out queries the frozen arms missed without destroying the 125.

  2. added
    enhancement
    retrieval
    severity:low
    proposal
    tier:full
    on Nov 20, 2026
  3. abogartz commented on Dec 1, 2026

    @abogartz
    OwnerAuthor

    Closed as won't fix. A frozen 404-query eval tested this premise head-on (2026-11-18 comment): every dense arm loses to the shipped lexical matcher on gold@1/5/20; re-open needs a method that beats those frozen arms.

    Triage could not state acceptance criteria for this ticket, and an architecture pass went looking for them anyway and found none — so there is no version of "done" that anyone could check. That is a statement about the criteria, not about the idea: file it again with the missing piece and it starts from the discussion here rather than from zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementproposalretrievalseverity:lowtier:full

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions