acme-home-inbox / docs /bakeoff-reproduction.md
Mitchins's picture
Publish ACME Home Inbox v0.2.0 checkpoint
6fb5ca4 verified
|
Raw
History Blame Contribute Delete
11.4 kB

Reference bake-off reproduction

This procedure recreates the model evaluation without modifying system Python. Dataset generation remains documented in the root README and Makefile.

1. Pin the model payloads

Use Hugging Face CLI downloads into the ignored models/ directory or use the Hub cache. Do not copy model weights into Git.

hf download openai/gpt-oss-20b \
  --revision 6cee5e81ee83917806bbde320786a8fb61efebee \
  --local-dir models/gpt-oss-20b

hf download microsoft/Florence-2-large-ft \
  --revision 4a12a2b54b7016a48a22037fbd62da90cd566f2a \
  --local-dir models/Florence-2-large-ft

hf download google/gemma-4-E4B-it-qat-q4_0-gguf \
  --revision 4b4a2c1d584be7264f87aac328a1bc739ce81b6c \
  --local-dir models/gemma-4-E4B-it-qat-q4_0-gguf

Verify the six weight/projector payloads against results/bakeoff/model-hashes.sha256. The manifest uses logical repository paths so it remains valid whether the files live in models/ or the Hub cache.

2. Isolate runtimes

The dataset environment is created by make setup. Keep serving and sidecar dependencies separate:

conda create --yes --prefix .runtime-vllm python=3.11
conda run --prefix .runtime-vllm pip install vllm==0.26.0 transformers==5.5.3

conda create --yes --prefix .runtime-florence python=3.11
conda run --prefix .runtime-florence pip install \
  torch==2.11.0 transformers==4.48.3 \
  -r requirements-sidecar.txt

Install the CUDA-specific Torch build appropriate to the host if the default wheel is not CUDA-enabled. The recorded host used Torch 2.11.0+cu130. Do not install any of these packages into system Python.

The matched primary A/B/D/K raw responses identify vllm-0.26.0-2d990a78. Historical ledgers with fingerprints vllm-0.26.0-5464fdc4 and vllm-0.23.0-82a58284 are retained but are not pooled into current paired comparisons.

3. Serve the canonical decision models

GPT-OSS CUDA:

conda run --prefix .runtime-vllm vllm serve models/gpt-oss-20b \
  --served-model-name openai/gpt-oss-20b \
  --host 127.0.0.1 --port 8002 \
  --max-model-len 16384 --gpu-memory-utilization 0.75 \
  --no-enable-prefix-caching --no-enable-log-requests \
  --generation-config vllm

Gemma CUDA with the pinned llama.cpp build:

llama-server \
  -m models/gemma-4-E4B-it-qat-q4_0-gguf/gemma-4-E4B_q4_0-it.gguf \
  --mmproj models/gemma-4-E4B-it-qat-q4_0-gguf/gemma-4-E4B-it-mmproj.gguf \
  --host 127.0.0.1 --port 8003 -c 16384 -np 1 -ngl all \
  --cache-ram 0 --flash-attn on --no-webui

The tested llama.cpp commit is 5f55650a78f92aff4d48d671423e888fac0469ff. The CUDA binary was built with CUDA 13.2.78, CMake 3.28.3, and GNU 13.3.0:

git -C vendor/llama.cpp checkout 5f55650a78f92aff4d48d671423e888fac0469ff
cmake -S vendor/llama.cpp -B build-cuda \
  -DCMAKE_BUILD_TYPE=Release \
  -DGGML_CUDA=ON -DGGML_CUDA_FA=ON -DGGML_CUDA_GRAPHS=ON \
  -DGGML_NATIVE=OFF -DCMAKE_CUDA_ARCHITECTURES=120a-real
cmake --build build-cuda --config Release -j

Use build-cuda/bin/llama-server in the server command. 120a-real targets the RTX 5090 host and must be changed deliberately for a different CUDA GPU.

4. Generate native Florence task evidence

The primary run uses the publisher's exact native task token. It does not claim that Florence followed the repository's free-form sidecar system prompt.

conda run --prefix .runtime-florence python scripts/run_florence_sidecar.py \
  --model models/Florence-2-large-ft \
  --revision 4a12a2b54b7016a48a22037fbd62da90cd566f2a \
  --selection all --task more-detailed-caption --max-new-tokens 256 \
  --wrapper-version historical-v0 \
  --expected-weight-sha256 8b4e610c952eef90a836c56cda0f398a672a3a6ca7b4d96b0e09a86dee42e2c3 \
  --out results/bakeoff/florence-all.jsonl

Run the full matched detailed-caption control with --selection all --task detailed-caption --wrapper-version native-v1, writing results/bakeoff/florence-detailed-all.jsonl. Neither task level may be selected using lockbox outcomes.

5. Run and score arms

Example GPT-OSS OCR arm:

.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8002/v1/chat/completions \
  --model openai/gpt-oss-20b --mode ocr --selection all \
  --reasoning-effort low \
  --out results/bakeoff/normalized-A-gpt-oss-ocr-vllm026.jsonl

.venv/bin/python -m acme_home_inbox.score \
  results/bakeoff/normalized-A-gpt-oss-ocr-vllm026.jsonl \
  --out results/bakeoff/normalized-A-gpt-oss-ocr-vllm026-score.json

Run the remaining measured source arms literally as follows (the endpoint on port 8003 is the Gemma server above):

# B: GPT-OSS OCR plus lossless TSV geometry
.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8002/v1/chat/completions \
  --model openai/gpt-oss-20b --mode ocr-layout --selection all \
  --reasoning-effort low \
  --out results/bakeoff/final-B-gpt-oss-ocr-layout.jsonl

# D: GPT-OSS plus Florence MORE_DETAILED captions
.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8002/v1/chat/completions \
  --model openai/gpt-oss-20b --mode ocr-sidecar --selection all \
  --sidecars results/bakeoff/florence-all.jsonl --reasoning-effort low \
  --out results/bakeoff/normalized-D-gpt-oss-ocr-florence-vllm026.jsonl

# K: GPT-OSS plus Florence DETAILED captions
.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8002/v1/chat/completions \
  --model openai/gpt-oss-20b --mode ocr-sidecar --selection all \
  --sidecars results/bakeoff/florence-detailed-all.jsonl --reasoning-effort low \
  --out results/bakeoff/final-K-gpt-ocr-florence-detailed-vllm026.jsonl

# C/G/E: one canonical Gemma backbone, native image-only/OCR/image+OCR paths
.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8003/v1/chat/completions \
  --model google/gemma-4-E4B-it-qat-q4_0-gguf --mode image --selection all \
  --out results/bakeoff/final-C-gemma-image-only.jsonl
.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8003/v1/chat/completions \
  --model google/gemma-4-E4B-it-qat-q4_0-gguf --mode ocr --selection all \
  --out results/bakeoff/final-G-gemma-ocr-control.jsonl
.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8003/v1/chat/completions \
  --model google/gemma-4-E4B-it-qat-q4_0-gguf --mode image-ocr --selection all \
  --out results/bakeoff/final-E-gemma-image-ocr.jsonl

The harness disables prompt caching, places images before text, preserves every attempt, and automatically replays length-limited or incomplete output using the caps in config/bakeoff-v1.json. The recorded A, D, and K runs each needed one independent replay after exhausting that ladder. Recreate and merge only the IDs printed as unresolved; the recorded commands were:

.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8002/v1/chat/completions \
  --model openai/gpt-oss-20b --mode ocr --selection acme_0021 \
  --reasoning-effort low --initial-max-tokens 2048 \
  --out results/bakeoff/replay-normalized-A-acme0021.jsonl
.venv/bin/python scripts/merge_replays.py \
  results/bakeoff/normalized-A-gpt-oss-ocr-vllm026.jsonl \
  results/bakeoff/replay-normalized-A-acme0021.jsonl \
  --out results/bakeoff/normalized-A-gpt-oss-ocr-vllm026-resolved.jsonl

.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8002/v1/chat/completions \
  --model openai/gpt-oss-20b --mode ocr-sidecar \
  --sidecars results/bakeoff/florence-all.jsonl --selection acme_0038 \
  --reasoning-effort low --initial-max-tokens 2048 \
  --out results/bakeoff/replay-normalized-D-acme0038.jsonl
.venv/bin/python scripts/merge_replays.py \
  results/bakeoff/normalized-D-gpt-oss-ocr-florence-vllm026.jsonl \
  results/bakeoff/replay-normalized-D-acme0038.jsonl \
  --out results/bakeoff/normalized-D-gpt-oss-ocr-florence-vllm026-resolved.jsonl

.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8002/v1/chat/completions \
  --model openai/gpt-oss-20b --mode ocr-sidecar \
  --sidecars results/bakeoff/florence-detailed-all.jsonl --selection acme_0002 \
  --reasoning-effort low --initial-max-tokens 2048 \
  --out results/bakeoff/replay-K-acme0002.jsonl
.venv/bin/python scripts/merge_replays.py \
  results/bakeoff/final-K-gpt-ocr-florence-detailed-vllm026.jsonl \
  results/bakeoff/replay-K-acme0002.jsonl \
  --out results/bakeoff/final-K-gpt-ocr-florence-detailed-vllm026-resolved.jsonl

merge_replays.py retains failed attempts and replay lineage, so latency and runaway rates are not erased.

6. Build the bounded policies

H is a replay-derived diagnostic gate from the full G and E source ledgers; J uses the same gate across GPT-OSS A and Gemma E. L/M/N use the fixed Florence gate policies:

.venv/bin/python scripts/build_gated_ledger.py \
  --ocr results/bakeoff/final-G-gemma-ocr-control.jsonl \
  --vision results/bakeoff/final-E-gemma-image-ocr.jsonl \
  --out results/bakeoff/final-H-gemma-gated-vision.jsonl
.venv/bin/python scripts/build_gated_ledger.py \
  --ocr results/bakeoff/normalized-A-gpt-oss-ocr-vllm026-resolved.jsonl \
  --vision results/bakeoff/final-E-gemma-image-ocr.jsonl \
  --pipeline-name normalized-J \
  --out results/bakeoff/normalized-J-gpt-oss-gated-gemma-vision.jsonl

for policy in heuristic semantic hybrid; do
  .venv/bin/python scripts/build_sidecar_gated_ledger.py \
    --ocr results/bakeoff/normalized-A-gpt-oss-ocr-vllm026-resolved.jsonl \
    --sidecar results/bakeoff/normalized-D-gpt-oss-ocr-florence-vllm026-resolved.jsonl \
    --policy "$policy" --pipeline-name "normalized-$policy" \
    --out "results/bakeoff/normalized-sidecar-$policy.jsonl"
done

P is a directly measured 2048-first version of H. The exact disjoint selections are derived from H's recorded gate result without reading gold labels:

OCR_IDS=$(jq -r 'select(.vision_escalated != true) | .case_id' \
  results/bakeoff/final-H-gemma-gated-vision.jsonl | paste -sd, -)
VISION_IDS=$(jq -r 'select(.vision_escalated == true) | .case_id' \
  results/bakeoff/final-H-gemma-gated-vision.jsonl | paste -sd, -)

.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8003/v1/chat/completions \
  --model google/gemma-4-E4B-it-qat-q4_0-gguf --mode ocr \
  --selection "$OCR_IDS" --initial-max-tokens 2048 \
  --out results/bakeoff/production-H-2048-ocr-shard.jsonl
.venv/bin/python -m acme_home_inbox.bakeoff \
  --endpoint http://127.0.0.1:8003/v1/chat/completions \
  --model google/gemma-4-E4B-it-qat-q4_0-gguf --mode image-ocr \
  --selection "$VISION_IDS" --initial-max-tokens 2048 \
  --out results/bakeoff/production-H-2048-vision-shard.jsonl

.venv/bin/python scripts/merge_gated_shards.py \
  --ocr results/bakeoff/production-H-2048-ocr-shard.jsonl \
  --vision results/bakeoff/production-H-2048-vision-shard.jsonl \
  --out results/bakeoff/production-H-2048.jsonl

7. Score and aggregate

The checked scoring driver names every canonical ledger and score file, then regenerates both summary formats:

scripts/score_bakeoff.sh
.venv/bin/python scripts/benchmark_ocr.py

Run make validate, make test, and git diff --check before comparing results. A complete backend acceptance must update the backend matrix rather than silently treating CUDA results as Vulkan or ROCm results.