KNN Implementation Details Can Cost You 7.5x: Cover Trees Show Why Benchmarks Mislead
_reachsumit · x · 2026-10-14
Amol Khanna and Edward Raff (arXiv:2610.16940) built RustKNN, a unified Rust implementation of three Cover Tree construction variants with three query modes, and found implementation details materially change KNN performance:
- Optimal query mode depends on k and dataset: single-tree is fastest at k=1 on 3 of 4 large datasets, dual-tree fastest at k≥5; the wrong choice costs up to 7.5x runtime.
- The common base parameter default of 1.3 is optimal on only 1 of 7 datasets, and 1.6x slower than optimal on covtype.
- Of five micro-optimizations, only early-exit distance computation helps consistently, scaling with dimension (none at d=32, 1.49x at d=784).
- All-NN and held-out benchmarks rank implementations differently, meaning conclusions about algorithmic superiority can hinge on implementation choices.
Timing tables report medians over 20 independent runs.
More from Research
- Whole-human-kidney blood flow imaging achieved with multi-lens ultrasound arrays + 3D ULM — Promptmethus · 2026-11-29
- GPU Power-Current Sensor Spots Hidden AI Training in 3 Seconds — bigdata · 2026-11-29
- Agentic GraphRAG unifies enterprise knowledge and agent memory in one traversable graph — vm324234 · 2026-11-29
- Same 80% accuracy, Brier scores 0.1961 vs 0.1600: a tiny demo of probability quality — Heavy-Confidence1826 · 2026-11-29
- Riemann Hypothesis proof condensed to 117 pages in paper rebuilt with Claude's help — birchlse · 2026-11-29
- AI agents solve 909 open math problems in 2 days on 18-year-old's Left to Solve site — julianibarz · 2026-11-29