Skip to content

docs(benchmarks): ENGRAM-typed retrieval — third null architectural lever - #64

Merged
jaylfc merged 1 commit into
masterfrom
docs/engram-negative-may6
May 10, 2026
Merged

docs(benchmarks): ENGRAM-typed retrieval — third null architectural lever#64
jaylfc merged 1 commit into
masterfrom
docs/engram-negative-may6

Conversation

@jaylfc

@jaylfc jaylfc commented May 6, 2026

Copy link
Copy Markdown
Owner

Summary

Third architectural negative result on top of the prompt and embedder sweeps: typed memory routing per the ENGRAM paper (arXiv:2511.12960) does not transfer to our local 9B generator + qwen3:4b judge stack.

Three-cell experiment at the leader recipe (`k=20 + adj=2 + llm-exp + RRF`), 200 QAs subset:

cell overall single-hop temporal multi-hop open-dom
leader_baseline_repro 0.54 0.28 0.59 0.77 0.60
engram_typed 0.53 0.30 0.57 0.54 0.62
oracle_routed 0.53 0.33 0.60 0.46 0.58

Headlines:

  • Overall flat (-0.01).
  • Multi-hop regresses -0.23 with typed retrieval — set-merge dilutes cross-encoder ranking across heterogeneous candidates. Same direction across both ENGRAM-using cells, so it's a real cost not noise.
  • Single-hop is the third null lever (0.28 → 0.30 → 0.33, within noise on 43 QAs). Combined with prompt + embedder nulls, the Single-hop ceiling is not in retrieval architecture — it's generator extraction quality, which Phase 1 (qwen3.6-MoE) targets.
  • Oracle-routed (perfect category routing) is also flat — rules out the query-time classifier path; no real classifier can beat oracle.

Why it doesn't replicate the paper's +31 pp: ENGRAM uses GPT-4o-mini + text-embedding-3-small. At that tier, typed routing recovers recall a frontier generator extracts well. Our 9B's bottleneck is extraction, not retrieval recall — typed routing doesn't address it.

Methodology note

The first engram_typed run reported +0.16 Multi-hop. Wiring bug: `--retrieval-mode` was silently ignored when `--strategy=vector-only` (bench default) because the runner's `_retrieve` short-circuited to a direct `vmem.search` call. Fix landed in commit `9306bb2` on `feat/engram-typed-retrieval`; pre-fix numbers retracted internally; the table here is post-fix and matches `oracle_routed`'s independently-computed per-category numbers.

Test plan

  • Read end-to-end alongside the prompt + embedder negative-result sections — third null in a series, verify the narrative arc tracks.
  • Verify all numbers against `/tmp/engram_routed_3cell_summary.tsv` on the bench host.
  • Confirm the methodology-note flag for the wiring bug is clear (we want to be honest about retracting the pre-fix run).

Summary by CodeRabbit

  • Documentation
    • Added comprehensive benchmark docs describing an experiment on typed memory routing (per-turn classification and type-based retrieval), comparison of routing modes (including an oracle mode), measured results across Single-hop/Temporal/Multi-hop/Open-dom categories, analysis of predicted turn-type distribution, note of a prior retrieval bug that was fixed, and reproduction notes.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

A new ENGRAM-style typed retrieval experiment section is added to docs/benchmarks.md describing a per-turn classifier into {episodic, semantic, procedural}, typed metadata storage, routed multi-store retrieval (including oracle routing), a three-cell experiment (leader, engram_typed, oracle_routed), results, and reproduction pointers.

Changes

Benchmark Documentation: ENGRAM Typed Retrieval Experiment

Layer / File(s) Summary
Experimental Documentation
docs/benchmarks.md
New section (lines 402–439) describing ENGRAM-style typed memory routing: per-turn classifier, typed metadata tagging, per-type retrieval fan-out with set-merge/dedup, oracle routing mode, three-cell experiment (leader, engram_typed, oracle_routed), category-level result interpretation (Single-hop, Temporal, Multi-hop, Open-dom), distribution of predicted turn types, note on prior wiring-bug and its fix, and reproduction pointers (branch/scripts/cached outputs).

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly Related PRs

  • jaylfc/taosmd#38: Modifies the same docs/benchmarks.md file; both PRs add benchmark content to the document.

Poem

🐰 Hops through memory routes so neat,

Typed turns sorted, retrieval fleet,
Merged candidates, judges cheer,
Benchmarks told for all to hear,
A rabbit's note: experiments complete.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: documenting an ENGRAM-style typed retrieval experiment as a benchmark result in docs/benchmarks.md.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/engram-negative-may6

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kilo-code-bot

kilo-code-bot Bot commented May 6, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
WARNING 1
Issue Details (click to expand)

WARNING

File Line Issue
docs/benchmarks.md 438 ⚠️ Potential issue (carried forward from previous review)
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
docs/benchmarks.md 438 ⚠️ Potential issue (carried forward)
Files Reviewed (2 files)
  • README.md - 0 issues
  • docs/benchmarks.md - 1 issue

Reviewed by grok-code-fast-1:optimized:free · 170,807 tokens

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/benchmarks.md`:
- Line 302: Replace ephemeral /tmp paths in the benchmarks provenance note with
a stable repository artifact path or documented bench-output directory: update
the sentence in docs/benchmarks.md that mentions
`/tmp/engram_classifications.json` and `/tmp/engram_routed_3cell_summary.tsv` to
point to a reproducible location (e.g.,
`benchmarks/artifacts/engram_classifications.json` and
`benchmarks/artifacts/engram_routed_3cell_summary.tsv` or a CI-attached artifact
URL) and, if needed, add a brief note in the engram_routed_3cell.sh bench script
to write outputs to that same repo artifact path or to upload them as CI
artifacts.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7a646897-407d-4575-bbd7-3b7f17e7d371

📥 Commits

Reviewing files that changed from the base of the PR and between 54e8983 and e206265.

📒 Files selected for processing (1)
  • docs/benchmarks.md

Comment thread docs/benchmarks.md

The fourth lever — generator size — is the next experiment. `qwen3.6:35b-a3b` (Q4_K_M, ~23 GB, MoE: 35 B total / 3 B active) at the same leader recipe runs as Phase 1 on Fedora the night of May 6.

Measured on Fedora 12 GB 3060 host, May 6 2026. Branch `feat/engram-typed-retrieval` carries the EngramRouter classifier, the `engram_typed` / `oracle_routed` retrieval modes, and the bench script `engram_routed_3cell.sh` for reproduction. Cached classifications at `/tmp/engram_classifications.json`, full sweep summary at `/tmp/engram_routed_3cell_summary.tsv` on the bench host.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Avoid /tmp host paths in benchmark provenance notes

/tmp/engram_classifications.json and /tmp/engram_routed_3cell_summary.tsv are ephemeral and not reproducible for other readers. Prefer a stable repo path (or attached artifact location) for referenced outputs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/benchmarks.md` at line 302, Replace ephemeral /tmp paths in the
benchmarks provenance note with a stable repository artifact path or documented
bench-output directory: update the sentence in docs/benchmarks.md that mentions
`/tmp/engram_classifications.json` and `/tmp/engram_routed_3cell_summary.tsv` to
point to a reproducible location (e.g.,
`benchmarks/artifacts/engram_classifications.json` and
`benchmarks/artifacts/engram_routed_3cell_summary.tsv` or a CI-attached artifact
URL) and, if needed, add a brief note in the engram_routed_3cell.sh bench script
to write outputs to that same repo artifact path or to upload them as CI
artifacts.

…ever

May 6 three-cell experiment at the leader recipe replicating the ENGRAM
paper (arXiv:2511.12960). Overall is flat:

  leader_baseline_repro  0.54
  engram_typed           0.53
  oracle_routed          0.53

Per-category, typed retrieval REGRESSES Multi-hop hard (-0.23): the
3-way fanout dilutes cross-encoder ranking on the set-merged
candidates. Single-hop unchanged across all three cells, matching the
prompt and embedder nulls — the Single-hop ceiling at our 9B generator
tier is not in retrieval architecture at all. Oracle-routed (perfect
category routing — upper bound on what a query classifier could do) is
also flat at 0.53, so we're not building Phase 2b.

Includes a why-it-doesn't-replicate analysis (ENGRAM's GPT-4o-mini
generator + text-embedding-3-small retrieval saturate different
failure modes than our local stack; typed routing recovers recall a
frontier generator can use, but our 9B is bottlenecked on generator
extraction quality — not retrieval recall). Phase 1 (qwen3.6-MoE) is
the generator-size lever, queued the night of May 6.

Methodology note flags the wiring bug found mid-experiment: the first
engram_typed run reported +0.16 Multi-hop, which turned out to be the
runner's vector-only path silently ignoring --retrieval-mode. Fixed in
9306bb2 on feat/engram-typed-retrieval; pre-fix numbers retracted
internally; table is post-fix.
@jaylfc
jaylfc force-pushed the docs/engram-negative-may6 branch from e206265 to 2587d2d Compare May 10, 2026 17:56

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
docs/benchmarks.md (1)

438-438: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Ephemeral /tmp paths reduce reproducibility.

Same issue as previously flagged: /tmp/engram_classifications.json and /tmp/engram_routed_3cell_summary.tsv are ephemeral host paths that won't be available to other readers. Consider moving these to a stable repository location (e.g., benchmarks/artifacts/) or documenting them as CI artifacts.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/benchmarks.md` at line 438, The docs currently reference ephemeral host
paths `/tmp/engram_classifications.json` and
`/tmp/engram_routed_3cell_summary.tsv` which harms reproducibility; update the
`docs/benchmarks.md` entry (the paragraph mentioning branch
`feat/engram-typed-retrieval` and script `engram_routed_3cell.sh`) to point to
stable repository artifact locations (e.g.,
`benchmarks/artifacts/engram_classifications.json` and
`benchmarks/artifacts/engram_routed_3cell_summary.tsv`) or explicitly note they
are produced as CI artifacts with a link/path where CI stores them, and adjust
any mention of the cached classifications and full sweep summary to the new
repo-relative paths or CI artifact instructions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@docs/benchmarks.md`:
- Line 438: The docs currently reference ephemeral host paths
`/tmp/engram_classifications.json` and `/tmp/engram_routed_3cell_summary.tsv`
which harms reproducibility; update the `docs/benchmarks.md` entry (the
paragraph mentioning branch `feat/engram-typed-retrieval` and script
`engram_routed_3cell.sh`) to point to stable repository artifact locations
(e.g., `benchmarks/artifacts/engram_classifications.json` and
`benchmarks/artifacts/engram_routed_3cell_summary.tsv`) or explicitly note they
are produced as CI artifacts with a link/path where CI stores them, and adjust
any mention of the cached classifications and full sweep summary to the new
repo-relative paths or CI artifact instructions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e54b2a55-6f9a-437b-8bdc-b775d53f3c1d

📥 Commits

Reviewing files that changed from the base of the PR and between e206265 and 2587d2d.

📒 Files selected for processing (1)
  • docs/benchmarks.md

@jaylfc
jaylfc merged commit d54914e into master May 10, 2026
2 checks passed
@jaylfc
jaylfc deleted the docs/engram-negative-may6 branch May 10, 2026 18:04
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