# Retrieval evaluation arithmetic

Anant Mishra · 22 November 2026 · Prepared with AI assistance.

Save fixture.json and reproduce.py together and run `python3 reproduce.py > new-record.json`. Compare retrieval, vector_value_bytes, boundary_checks and hashes with execution-record.json. UTC time and Python version describe the actual run and can differ. Python standard library only, with no network or credentials.

The four questions and both rankings are authored, independent of the dimension illustration. At k=3 the evaluator intersects each ranked prefix with the declared relevant IDs, divides by that relevant-set size and averages exact fractions over judged queries. Null/empty judgments are unjudged under this local preparation contract, not evidence of no relevant answer. They remain visible and are excluded from the macro denominator. An empty ranking for a judged question scores zero. No corpus-wide recall is established from incomplete labels.

Expected macro scores 5/6 and 1/2, the lost q1 identifier b and the shared q3 miss e are checked. Boundary assertions cover duplicate query/relevant/ranking IDs, invalid cutoff, beyond-cutoff exclusion, empty ranking, unjudged-only summary, invalid dimension, zero inventory and question-order invariance. The execution record reports their count. Exact Fraction arithmetic avoids rounded inputs to the average.

The vector-value calculation separately uses N*(4*d+8), the pgvector single-precision type formula reviewed on 22 November. It excludes table/index overhead, text, metadata, replication, backups, working memory and migration overlap. Count and dimensions are invented. No database was measured. Changing these dimensions did not produce the fixture rankings.

Primary-source review also covered Sentence Transformers' Matryoshka guide and the scikit-learn recall definition. Real evaluation needs authorized corpus/tasks, accountable relevance judgments, pinned compatible encoders, actual result traces, index settings, timing, size, answer-quality and cost evidence. No model, embedding, retrieval engine, DGX experiment, deployment or scholarly release is claimed.
