NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

A Two-Stage Active Learning Algorithm for k-Nearest Neighbors

Nicholas Rittler, Kamalika Chaudhuri

Introduction

The $k$-nearest neighbor (k-NN) classification algorithm is a staple of non-parametric machine learning, prized for its ability to naturally adapt to different scales and distributions. However, designing effective active learning strategies for k-NN—where the model strategically chooses which data points to label to reduce annotation costs—has proven surprisingly difficult.

Previous attempts at active k-NN either lacked theoretical guarantees for finite samples or completely abandoned the classic "k-NN vote" at prediction time, replacing it with complex algorithmic subroutines. This paper bridges that gap by introducing a simple, intuitive active learning algorithm that preserves the core identity of the k-NN vote while mathematically proving it can outperform traditional passive sampling.

The Two-Stage Active Algorithm

To address the inefficiencies of passive sampling (where data is collected uniformly at random), the authors propose a targeted, two-stage approach.

Comparison of passive sampling versus the two-stage active learning process.
  1. Stage 1 (Passive Exploration): The learner collects an initial set of $n$ labeled samples randomly from the target distribution to get a baseline understanding of the space.
  2. Identify the "Hard Region": Using these first-round samples, the algorithm identifies an "estimated hard region." This is the area of the instance space where the k-NN vote is close to $1/2$—essentially, the decision boundary where the model is most uncertain.
  3. Stage 2 (Targeted Sampling): The learner uses its remaining label budget, $m$, to sample points specifically from an augmented version of this hard region, effectively "zooming in" on the most contentious areas.
  4. Modified k-NN Prediction: At prediction time, the classifier applies a modified rule. If a test point falls within the identified "hard" region, it uses the high-resolution samples gathered in Stage 2. Otherwise, it relies on the broader Stage 1 samples.

The theoretical backbone of this approach relies on two standard assumptions: $(\alpha, L)$-smoothness (the probability of a label changes smoothly across space) and the Tsybakov noise condition (which quantifies how much data lies near the decision boundary).

Key Insights and Theoretical Guarantees

This theoretical work focuses on providing mathematical proofs for consistency and convergence rates rather than empirical benchmarking. Several key insights emerge from the analysis:

  • Preserving the Vote: The most significant breakthrough is demonstrating that k-NN does not need to be reinvented to work with active learning. By identifying where the vote is contentious and allocating more data to those specific spots, the model maintains its simplicity while gaining massive efficiency.
  • Faster Convergence: Under the Tsybakov noise condition, the actively trained k-NN classifier converges to the Bayes optimal classifier at a faster asymptotic rate than a passively trained equivalent.
  • Finite Sample Guarantees: The paper provides explicit bounds on the probability that the active k-NN classifier disagrees with the Bayes optimal classifier. As the total number of samples grows, the error term for the active approach becomes significantly tighter than the passive one.
  • Consistency without Smoothness: Interestingly, the algorithm is proven to be "consistent"—meaning it will eventually find the correct answer given enough data—even if the smoothness assumptions on the data distribution do not hold. Smoothness is only required to prove the speedup over passive learning.

Limitations and Future Directions

While the proposed algorithm offers strong theoretical improvements, the authors note a few limitations and areas for future exploration. First, it is not yet fully clear if this specific sampling scheme achieves the "minimax optimal" rate (the best possible theoretical rate). Second, the current algorithm uses a fixed $k$. Adaptively modifying $k$ across different regions of the instance space—using more neighbors in "easy" regions and fewer in "hard" ones—could yield even better performance. Finally, some factors in the mathematical bounds are relics of the uniform convergence techniques used in the proofs, which might be further optimized with different analytical strategies.

Summary updated

BibTeX
@inproceedings{rittler2023two,
  author = {Nicholas Rittler and Kamalika Chaudhuri},
  title = {{A Two-Stage Active Learning Algorithm for k-Nearest Neighbors}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=UOyczqYEU7},
}
Figure