tirtho149's picture
Add retriever study (code, predictions, one-pager), refresh response cache
874eec2 verified
|
Raw History Blame Contribute Delete
3.19 kB
# Retriever study: can a small neural retriever replace BM25 in MACE?
One-page summary: `MACE_retriever_onepager.pdf`. Code and every result: `code/experiments/retriever_pilot/`
(its `README.md` records each step in order).
Frozen pipeline: P1 MACE, seed 0, four memory images per disease, the same memory per query, prompt, four-entry format
and 1,600 queries. Only the four retrieved references change. Baselines are the paper's own runs (never rerun); BM25 in
this code reproduces the recorded P1 retrieval on 1,600/1,600 queries, and the BM25 requests hit the recorded Sonnet and
Haiku replies byte for byte.
| Step | Script | Output |
|---|---|---|
| Pilot: trained and LLM-weighted linear scorers over 16 caption features (retrieval only) | `pilot.py` | `out/table.md` |
| Tuning on a clean development set (2,215 training-fold images), BM25 + DINOv2 image similarity | `tune.py` | `out/tune_table.md` |
| 200-query diagnosis check | `diag.py` | `out/diag_table.md` |
| Full diagnosis, BM25 + image, Sonnet and Haiku, 1,600 queries | `full.py run`, `full.py analyze` | `out/full_tables.md`, `out/full_table_hero.tex` |
| Plan: 29-parameter MLP over 5 features, weights written by Sonnet (contexts G0 to G3, 3 packs) or fitted; A reranks BM25 top 20, B scores the full memory; locked on dev | `plan/run_plan.py` | `plan/out/` |
| Full diagnosis of the locked LLM-written MLP | `full.py run_gen` | `out/full_predictions_gen.jsonl` |
| One-pager | `onepager/make_onepager.py` | `onepager/onepager.pdf` |
Main results (equal-crop accuracy %, 1,600 queries, IID / held-out):
| Model | MACE, BM25 (paper) | MACE, BM25 + image | MACE, LLM-written MLP |
|---|---|---|---|
| Sonnet 5.5 | 62.2 / 57.0 | 63.5 / 58.8 (+1.3 / +1.8, n.s.) | 62.0 / 57.7 (-0.2 / +0.7, n.s.) |
| Haiku 5.5 | 55.5 / 53.5 | 57.3 / 54.7 (+1.8 / +1.2, n.s.) | 57.4 / 54.2 (+1.9 / +0.7, n.s.) |
On retrieval (hit@4) every neural or fused retriever stays within about one point of BM25; the LLM-written MLP matches
BM25, while the same MLP fitted on the same 16 examples drops 20 points. BM25's top 20 already holds a true-disease
reference for about 97% of queries.
## Reproduce (no model calls)
From the repository root, after the steps in `REPRODUCE.md` section 2 (`code/.cache` filled from `cache/llm.tar.gz`):
```bash
cd code
mkdir -p mace10/out experiments/mace_extension/raw_results
cp ../captions.json ../results/results_wide.csv mace10/out/
cp ../study/evaluation_jobs.jsonl.gz mace10/out/jobs_all.jsonl.gz
cp -R ../runs/P* mace10/out/
cp -R ../extension/raw_results/E1_haiku experiments/mace_extension/raw_results/
export AGMEM_DATA=$PWD/../benchmark
python -m experiments.retriever_pilot.full analyze # full tables from the saved predictions
python -m experiments.retriever_pilot.plan.run_plan # retrieval stage; the 12 generator calls replay from the cache
```
We ran these steps on a fresh copy of this repository: the analysis reproduces the tables above, and the new retriever
diagnosis requests replay from the cache (60 of 60 sampled requests across Sonnet and Haiku). The text embeddings
(`plan/text_emb.npz`, bge-small-en-v1.5) are included, so `plan/embed.py` need not be rerun.