Efficient Coreset Selection via K-Nearest Neighbor Graphs

Yingfan Liu, Leiyu Zhang, Jiadong Xie, Mingzhe Wang, Jeffrey Xu Yu, Jiangtao CuiarXiv 2026

TL;DR

Training machine learning models on massive datasets is computationally expensive, but selecting a small, representative "coreset" can dramatically speed things up. This paper introduces KNNG-CS, a lightweight coreset selection method that uses sparse $K$-nearest neighbor graphs to bypass the massive memory and time bottlenecks of traditional methods. It delivers up to $41\times$ speedups and uses less than 8% of the peak memory of existing baselines without sacrificing model accuracy.

What Problem Does This Paper Address?

Coreset selection aims to find a small subset of data that maintains the training utility of the full dataset. Gradient-approximation (GA) based methods, like the well-known CRAIG algorithm, do this by minimizing feature-space distances to approximate the full dataset's gradients.

However, calculating these ideal representatives traditionally requires computing and storing a dense pairwise distance matrix, which scales quadratically ($O(n^2)$) with the number of samples. For large datasets, this creates an insurmountable memory and computational bottleneck. Even newer cluster-based methods (like FastCore) require maintaining massive item-cluster bound matrices, which remain computationally heavy and slow.

Methods

The authors propose KNNG-CS (K-Nearest Neighbor Graph Coreset Selection), which shifts the problem from dense matrix operations to sparse graph topology:

  1. Graph Construction: It first builds an approximate $K$-nearest neighbor graph (KNNG) using an efficient library (KGraph). This reduces the space complexity from quadratic $O(n^2)$ to linear $O(nK)$, where $K$ is small (set to 10 by default).
  2. Distance-Aware Node Scoring: Instead of just counting a node's incoming edges (in-degree), KNNG-CS applies a softmax function over the negative Euclidean distances of outgoing edges to compute a normalized closeness weight. A node's importance score is the sum of these weights from its incoming neighbors.
  3. One-Pass Greedy Removal: Traditional greedy algorithms repeatedly recompute benefits after picking each item. KNNG-CS avoids this bottleneck entirely. It picks the highest-scoring node, adds it to the coreset, and immediately removes that node and all its in-neighbors from the graph. This one-pass removal strategy eliminates the need for iterative re-scoring.
Illustration of KNNG construction and the one-pass node removal strategy.

Datasets

The method was evaluated on four distinct real-world datasets:

  • CovType: 581,012 samples with 54 attributes for forest cover type prediction.
  • IMDB: Movie metadata used for rating prediction.
  • Brazil: 98,463 e-commerce orders with 9 attributes for review score prediction.
  • Card: 30,000 records with 23 attributes for credit card payment default prediction.

Key Insights and Ideas

  • Representativeness is inherently local: A data point that serves as a close neighbor to many other points is naturally a great cluster representative. Sparse graphs capture this local topology perfectly without needing global pairwise distances.
  • In-neighbors as a proxy for coverage: When a node is selected for the coreset, its in-neighbors (the points that consider it a close neighbor) are highly likely to choose it as their representative. Therefore, they can be safely pruned from the candidate pool immediately.
  • Bypassing the greedy recomputation loop: By removing covered in-neighbors in a single pass, the algorithm avoids the classic $O(n)$ re-evaluation loop per selection step, making the selection phase incredibly lightweight ($O(nK)$).

Key Results

  • Massive Speedups: KNNG-CS achieved $2.3\times$ to $41.2\times$ speedups over CRAIG and $2.3\times$ to $4.9\times$ speedups over FastCore across the four datasets.
  • Drastic Memory Reduction: Peak memory usage plummeted to just 0.3% to 3.4% of CRAIG's requirements, and 4.1% to 7.5% of FastCore's requirements.
  • Preserved Accuracy: Despite the massive computational savings, the test accuracy of models trained on the KNNG-CS coreset remained highly competitive and comparable to full training and exact greedy methods.
Comparisons of memory usage across the four datasets, highlighting the efficiency of KNNG-CS.

Limitations and Future Work

  • While KNNG-CS is highly robust and insensitive to the choice of $K$ within a reasonable range, the graph construction step still relies on approximate KNN algorithms, which might occasionally miss optimal global structures in highly complex data distributions.
  • The evaluation focuses primarily on static feature-space representations for logistic regression models. Extending this sparse graph approach to dynamically changing embedding spaces during deep neural network training remains an open area for exploration.

Summary updated

BibTeX
@misc{liu2026efficient,
  author = {Yingfan Liu and Leiyu Zhang and Jiadong Xie and Mingzhe Wang and Jeffrey Xu Yu and Jiangtao Cui},
  title = {{Efficient Coreset Selection via K-Nearest Neighbor Graphs}},
  year = {2026},
  eprint = {2608.16270},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.16270},
}
Figure