MACE-Bench / REPRODUCE.md
tirtho149's picture
MACE-Bench release: images, memory banks, captions, predictions, traces, code
c8e03af verified
|
Raw History Blame Contribute Delete
2.95 kB
# Reproducing MACE from this repository
Everything below runs from a copy of this repository. Steps 1 and 2 make no model calls and cost nothing.
## 1. Check every reported number (under a minute; numpy and pandas only)
```bash
python results/verify.py
```
Expected equal-crop accuracies (%), Sonnet 5.5, 1,600 queries over 10 crops:
| Method | In distribution | Held-out collection |
|---|---|---|
| SAGE (KB only) | 42.8 | 50.7 |
| DINOv2 1-NN | 52.5 | 38.2 |
| Labels only | 55.8 | 54.8 |
| MACE retrieval | 62.2 | 57.0 |
`python results/verify_extension.py` does the same for the follow-up tests in `results/extension/`.
## 2. Rebuild the memory banks and replay the model calls (no cost)
```bash
pip install -r code/requirements.txt
cd code
mkdir -p .cache && tar -xzf ../cache/llm.tar.gz -C .cache
AGMEM_DATA=$PWD/../benchmark python verify_release.py
```
This rebuilds all 12,438 evaluation jobs from `benchmark/splits/` (memory selections in `memory.parquet`, folds in
`iid_5fold_3seed.parquet`) and `study/queries.csv`, compares each job and its exact memory list with
`study/evaluation_jobs.jsonl.gz`, then rebuilds every caption and text-diagnosis request and checks that the cached reply
exists and gives the saved prediction. Expected last line: `RELEASE REPRODUCES`.
To recompute `results/results.json` from the raw predictions:
```bash
cp -R ../runs/P* ../captions.json ../results/local_baselines.csv mace10/out/
mkdir -p runs
# the ledger also holds later follow-up calls; the paper's price and latency rows use calls up to the analysis time
gunzip -c ../results/cost_ledger.jsonl.gz | python -c "import sys,json;[sys.stdout.write(l) for l in sys.stdin if json.loads(l)['t']<=1793870828.0]" > runs/cost_ledger.jsonl
AGMEM_DATA=$PWD/../benchmark python -m mace10.results
```
The new `code/mace10/out/results.json` equals `results/results.json` in all 1,062 values.
## 3. Rerun a package
With the cache from step 2 in place, any package replays from the cache without new calls:
```bash
cd code
AGMEM_DATA=$PWD/../benchmark python -m mace10.run P1 --cap-additional 0
```
Packages: `P7dev P1 P4labels P2 P3 P4rest P5 P6 P7 P8 P9`. Calls that miss the cache go to the Claude Code CLI
(`claude-sonnet-5-5`); delete `code/.cache/llm` to rerun fresh, which costs about USD 185 at list prices. The agentic
package P6 also needs `tar -xzf ../cache/agentic.tar.gz -C .cache`.
## Memory banks
`study/memory_banks.jsonl` lists every bank as used: `package`, `condition`, `crop`, selection `seed` (0 to 2), fold
`run`, `K` (1, 4 or 16 images per disease), the member `image_id`s with labels, and the queries it served. A query never
sits in its own bank. The source of these banks is `benchmark/splits/memory.parquet` (facility-location selection,
nested over K) filtered by the query's fold in `benchmark/splits/iid_5fold_3seed.parquet`; held-out collections are
never in memory (`benchmark/splits/ood_heldout_collection.parquet`).