Build your own vector database
Searching the tower (Algorithm 5) & the recall payoff·20 min

The recall/latency curve

0 / 1
# grade this stage (from your course directory)
npx theinference test --stage tune-the-curve --watch

The recall/latency curve every vector DB exposes as a single knob. Sweep efSearch ∈ {8, 16, 32, 64} and emit a recall-vs-comparisons table. You are reproducing the ANN-Benchmarks plot on your own index.

What to build

Your task

Emit the sweep table

Wire the sweep subcommand. For each efSearch in the swept set, compute mean recall@10 and mean comparisons over all queries. Print:

{ "sweep": [ { "efSearch": 8, "recall": ..., "meanComparisons": ... }, ... ] }
your_program.sh
./your_program.sh sweep <fixture>/chapters/05-knn-search/steps/04-tune-the-curve/fixtures/data.json
Recall is not strictly monotone in efSearch

A wider frontier can locally re-order a near-tie and dip recall by under 1% before climbing again. So the gate is match the frozen reference table, not "recall must never decrease." Comparisons, being integer-deterministic on the seeded graph, match exactly.

How it's graded

Process mode: stdout_json_match of your sweep array against the frozen reference (atol 1e-6 on recall, integer-exact on comparisons). Same seed ⇒ same graph ⇒ the sweep is a deterministic table.