Skip to content

Local-LLM correspondence timing benchmark (Gemma 3 27B)#633

Closed
efahnestock wants to merge 1 commit into
mainfrom
local-llm-correspondence-timing
Closed

Local-LLM correspondence timing benchmark (Gemma 3 27B)#633
efahnestock wants to merge 1 commit into
mainfrom
local-llm-correspondence-timing

Conversation

@efahnestock

Copy link
Copy Markdown
Collaborator

What

Adds a benchmark measuring the cost of replacing the learned correspondence model with a local LLM that matches a panorama's landmarks directly against a city's full OSM landmark set. This backs the timing comparison in the paper.

The correspondence model cheaply scores each panorama landmark against the whole city stockpile; an LLM must instead read candidate OSM landmarks into a finite context window. So we stream the 28,582 unique Chicago landmark tag bundles through the model in chunks and time single-stream prefill+decode latency on the local GPU (RTX 5090), then extrapolate to per-landmark / per-panorama / full-city cost.

Result (backs the paper)

config per panorama
Gemma 3 27B, no thinking ~5.4 min
Gemma 3 27B, chain-of-thought ~7.6 min
learned correspondence step 3.7 s

→ roughly two orders of magnitude slower.

Files

  • correspondence_scaling_common.py — loads the Chicago OSM stockpile (VIGOR v4_202001) + panorama query landmarks (pano_v2 panov2_tuned_prompt), builds the match prompt, validates JSON output, and extrapolates per-call timings to a whole city.
  • benchmark_correspondence_scaling_ollama.py — runnable sweep for gemma3:27b via ollama (candidate-fill × query-batch × thinking on/off).
  • correspondence_scaling_README.md — setup + reproduction commands.

Reproduction / notes

  • Requires a local GPU + ollama (gemma3:27b pulled on first run, ~17 GB) and the VIGOR/pano_v2 data under /data/overhead_matching/datasets/ — not CI-reproducible. Commands are in the README.
  • Reference sweep results behind the figures live at /data/overhead_matching/evaluation/timing/ (gemma3_27b_thinking_off_per_panorama.jsonl, gemma3_27b_thinking_on_cot_per_panorama.jsonl).
  • Gemma 3 has no native thinking mode (ollama reports completion+vision), so --thinking on emulates it via chain-of-thought prompting.

Measures the cost of replacing the learned correspondence model with a
local LLM that matches a panorama's landmarks directly against a city's
full OSM landmark set. Streams the 28,582 unique Chicago landmark tag
bundles through the model in chunks and times single-stream prefill/decode
latency on the local GPU, extrapolating to per-landmark / per-panorama /
full-city cost.

Backs the paper's timing comparison: Gemma 3 27B ~5.4 min/panorama (no
thinking) and ~7.6 min/panorama (chain-of-thought), vs the 3.7 s learned
correspondence step.

- correspondence_scaling_common.py: stockpile/query loading, match prompt,
  JSON validation, sweep records, extrapolation/report.
- benchmark_correspondence_scaling_ollama.py: gemma3:27b sweep via ollama.
- correspondence_scaling_README.md: setup + reproduction.
@efahnestock

Copy link
Copy Markdown
Collaborator Author

Superseded by #634, which stacks on #632 and relocates the benchmark into experimental/overhead_matching/swag/scripts/timing/.

@efahnestock efahnestock closed this Jul 2, 2026
@efahnestock efahnestock deleted the local-llm-correspondence-timing branch July 2, 2026 03:11
efahnestock added a commit that referenced this pull request Jul 2, 2026
…scripts/timing/ (#634)

Stacked on #632.

## What
1. **Introduces `experimental/overhead_matching/swag/scripts/timing/`**
as the home for pipeline timing benchmarks, so they don't accumulate in
the `scripts/` catch-all. Moves `measure_pipeline_latency.py` (from
#632) into it.
2. **Adds the local-LLM correspondence timing benchmark** (from the
now-superseded #633): measures how long a local LLM would take to
replace the learned correspondence model, by matching a panorama's
landmarks directly against a city's full OSM landmark set.

## Files (in `scripts/timing/`)
- `measure_pipeline_latency.py` — moved from `scripts/` (unchanged).
- `correspondence_scaling_common.py` — loads the Chicago OSM stockpile
(28,582 unique tag bundles) + panorama query landmarks, builds the match
prompt, validates JSON output, extrapolates per-call timings to
per-landmark / per-panorama / full-city cost.
- `benchmark_correspondence_scaling_ollama.py` — `gemma3:27b` sweep via
ollama (candidate-fill × query-batch × thinking on/off).
- `correspondence_scaling_README.md` — setup + reproduction.
- `BUILD` — the three targets.

`scripts/BUILD`: drops the `measure_pipeline_latency` target (moved) and
widens `evaluate_histogram_on_paths` visibility so the relocated target
can depend on it.

## Result (backs the paper)
| | per panorama |
|---|---|
| Gemma 3 27B, no thinking | ~5.4 min |
| Gemma 3 27B, chain-of-thought | ~7.6 min |
| learned correspondence step | 3.7 s |

## Notes
- Requires a local GPU + ollama (`gemma3:27b` pulled on first run) and
VIGOR/pano_v2 data under `/data/overhead_matching/datasets/` — not
CI-reproducible; commands in the README.
- Reference sweep results live at
`/data/overhead_matching/evaluation/timing/`.
- Supersedes #633 (same benchmark, but stacked on #632 and relocated
into `scripts/timing/`).
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