Classical Supervised LearningLevel: FoundationalStudy Battlecard

k-Nearest Neighbors (k-NN)

Instance-Based Non-Parametric Classification & Spatial Voronoi Tessellations

#Non-parametric#Lazy Learning#Metric Space#KD-Tree#Voronoi
Choose Presentation Mode:
STAGE 1 / 7— Anti-Pattern
Section 1: The LLM Anti-Pattern vs Right-Sized Model
The Naive Generative LLM Approach:

Asking an LLM to find the 5 most similar patient medical profiles from a database of 100,000 historical records.

Why It Fails in Production:

LLMs cannot index 100,000 records in context; k-NN using KD-Trees or Ball-Trees locates exact nearest neighbors in 0.5ms.

Targeted Algorithm (k-Nearest Neighbors (k-NN))
Latency:0.5ms (KD-Tree)
Cost / 1M Ops:$0.00
Determinism:Mathematically Exact Neighbors
Generative LLM Alternative
Latency:4,000ms
Cost / 1M Ops:$15,000
Determinism:Incomplete / Hallucinated