core practice · implementation task
Build a brute-force vector index
Build an index that stores vectors and answers top-k queries by scanning every vector. Benchmark latency as the vector count grows.
The mechanism
Brute force computes the metric against every stored vector. It is O(n·d) and slow at scale, but it is exact — making it the recall=1.0 baseline that every ANN index is measured against.
Expected evidence
Exact top-k results; a latency-vs-n table.
Try this drill in the practice workspace →
Hints when you need them
- Batch the scan as a matrix multiply.
- This is your recall=1.0 baseline.
Watch for these mistakes
- Skipping the brute-force baseline, so ANN recall is unmeasurable
- Not batching the matrix multiply for the scan
- Assuming brute force is always too slow — it is fine for <100k vectors