Breaking re-ranker ties with Gemma's own token probabilities on a Mac mini
- Hardware
- Mac mini with Apple M4 and 16 GB
- Models & engines
- Ollama with gemma3:12b as the scorer; llama3.2:1b and llama3.2:3b timed for comparison
- Key gotcha
- At about a minute and a half per question, the 12B scorer is too slow for an interactive search box but might suit a batch job or nightly report.
What they built
Nerav Doshi runs a series of experiments on a local retrieval collection of 741 chunks, with twelve questions and strict labels, using an LLM re-ranker on top of embedding search.
In the previous entry, gemma3:12b gave the right article and a rival the same score out of 10, and ties fell back to embedding order, which put the rival first. This entry tested two fixes, decided in advance, and timed every scoring call.
Setup
- Mac mini with Apple M4 and 16 GB
- Ollama with gemma3:12b as the scorer; llama3.2:1b and llama3.2:3b timed for comparison
- Top 20 chunks per question, temperature 0, two runs each
How it works
- Variant A: the previous 0-10 setup with ties kept in embedding order (it reproduced the earlier numbers exactly).
- Variant B: the same prompt asking for 0-100.
- Variant C: the same 0-10 scores, with ties broken by an expected score computed from the probabilities Ollama returns for the digits 0-9 at the score position.
Results & numbers
- C put the right article first on 11 of 12 questions (top-1 0.92, MRR 0.94), against 0.83 for embedding only and 0.75 for A.
- The 0-100 scale didn't remove ties: across 240 replies gemma3:12b used only ten values, all multiples of five.
- Scoring 20 chunks took 4.4 s per question with llama3.2:1b, 13.6 s with llama3.2:3b and 94.8 s with gemma3:12b (19 minutes for all 12 questions).
Gotchas
- At about a minute and a half per question, the 12B scorer is too slow for an interactive search box but might suit a batch job or nightly report.
- The tie-break comes from the same model, so it can't fix a confident wrong score, only ties.
- Twelve questions means one question moves the score by eight points.
- Repeated identical prompts are partly cached by Ollama, which made some runs slightly faster per call.
“So the ties were mostly a tie-break problem, not a scale problem.”— Nerav Doshi
Similar setups
Finding why a local Ollama RAG bot ignored its instructions: silent num_ctx truncation
A developer's local RAG bot on llama3.1:8b skipped citations and guessed answers because Ollama silently cut prompts to a 2048-token window; in a 500-question test 312 prompts were truncated, and setting num_ctx to 8192 lifted grounded accuracy from 61% to 84%.
Local AI: a one-click Windows app that picks a model for your PC and sets up Ollama for friends
Tired of setting up local LLMs for friends, a developer built a free MIT-licensed Windows app that detects your GPU and RAM, installs Ollama without admin rights, pulls a fitting model and opens a private chat.
Cutting a local Qwen coding agent's wait on a 16GB Mac with a memory hook
A developer running a coding agent on qwen3.5:9b through Ollama replaced its always-loaded memory index with a hook that attaches only relevant memory lines, and cut median answer time from 90.4s to 56.4s.
A read-only Gemma 4 agent on Ollama that explains what fills a Mac's disk
A sysadmin's one-file Python agent lets Gemma 4 on Ollama dig through his home folder and write a Markdown report on disk usage, while code and a four-line macOS sandbox-exec profile make sure it can only look.