Clustering-Based Balanced Sampling and Allocation with Data Parallelism for High-Performance Fine-Tuning

Hyunjin Kim, Youngeun Nam, Jaemin Han, Wonhyeok Choi, Jae-Gil LeearXiv 2026

TL;DR

CluSTER is a novel data-reduction framework for LLM instruction tuning that clusters data in gradient space to ensure diverse, balanced sample assignment across GPUs. By eliminating redundant computations and using a weighted gradient update, it cuts training time by up to 69.6% with virtually no loss in final model accuracy.

What Problem Does This Paper Address?

Instruction-tuning datasets are notoriously massive, redundant, and highly imbalanced. When fine-tuning Large Language Models (LLMs) using Data Parallelism (DP) across multiple GPUs, standard random sampling introduces a major inefficiency: dominant data patterns are repeatedly processed across different workers. This overrepresentation creates redundant gradient computations, while rarer but highly informative samples are left neglected.

Figure 1: Comparison between full- and reduced-dataset training. Colors indicate clusters and shapes denote finer-grained sample types. (a) With the full dataset, redundant and dominant patterns recur across batches and workers. (b) With the reduced dataset, diverse repre- sentative samples are selected with balanced cluster cov- erage and allocated across GPUs, reducing computation and training time while preserving the data distribution.

The challenge is to curate a smaller, highly representative subset of the data that preserves full-dataset training dynamics and ensures diverse training signals across all parallel workers simultaneously.

Methods

The authors introduce CluSTER (Cluster-aware balanced Sampling framework for Training Efficient data Reduction), which operates in three main stages:

  1. Gradient-Based Semantic Clustering: Instead of relying on surface-level text similarity, CluSTER projects samples into a lightweight gradient proxy space derived from the final-layer hidden states and token-level cross-entropy loss. It then groups these embeddings using capacity-constrained K-means, where the number of clusters ($K$) matches the number of GPUs.
  2. Cluster-Aware Balanced Sampling: To achieve dual-level coverage, CluSTER first balances cluster sizes by down-sampling larger clusters to match the smallest "pivot" cluster. Then, to maximize intra-cluster diversity, it employs peripheral selection, picking samples farthest from the cluster centroid (boundary samples) rather than core-centric ones.
  3. Weighted Gradient Update: Because down-sampling alters the original data distribution, CluSTER applies an importance-weighting coefficient to each cluster's gradient during the backward pass. This mathematically restores the original dataset's distribution while retaining the variance-reduction benefits of balanced sampling.
Figure 3: Overview of the proposed CluSTER framework. It consists of three stages: gradient-based clustering, cluster-aware balanced sampling, and weighted gradient update, which collectively ensure balanced data allocation.

Datasets

The framework was evaluated across two distinct domains using three popular instruction-tuning datasets:

  • Code Domain: Magicoder-OSS-Instruct-75K and Evol-Instruct-Code-80K.
  • Medical Domain: MedInstruct-52K.

Models were evaluated on standard downstream benchmarks including HumanEval(+), MBPP(+), MedMCQA, MedQA, PubMedQA, and MMLU medical subsets.

Key Insights and Ideas

  • Gradient Space over Text Space: Textually distinct prompts can induce identical model updates, while similar-looking prompts can drive learning in opposite directions. Clustering in the gradient proxy space accurately captures actual optimization dynamics.
  • Dual-Level Coverage: Efficient data parallelism requires balancing data both across workers (inter-level, so GPUs don't duplicate work) and within clusters (intra-level, to capture diverse edge cases).
  • The Power of the Periphery: Within a cluster, core-centric samples provide redundant, common gradients. Selecting peripheral (boundary) samples dramatically increases gradient diversity, stabilizing and accelerating convergence.
  • Distribution Preservation via Weighting: Purely balancing clusters introduces sampling bias. Re-weighting gradients based on original cluster sizes allows the model to enjoy the optimization stability of uniform sampling without distorting the underlying data distribution.

Key Results

  • Massive Speedups: CluSTER reduces total training time by up to 69.6% on the medical dataset while maintaining full-dataset performance.
  • High Data Efficiency: On Magicoder-75K, using just 59% of the data yielded an average score of 56.5, nearly matching the full-dataset baseline of 57.6, and outperforming other data-reduction methods like LESS, IFD, and S2L.
  • Ultra-Fast Preprocessing: Because CluSTER only requires a single forward pass to compute its gradient proxies, its data selection time is a fraction of its competitors (e.g., 0.19 hours vs 2.79 hours for LESS on CodeLlama-7B).
  • Scalability: The framework scales seamlessly from 4 to 8 GPUs, showing robust performance even under aggressive data pruning at higher GPU counts.

Limitations and Future Work

  • Single-Node Constraint: The evaluations were limited to a single-node multi-GPU setup (up to 8 GPUs). The authors note that multi-node environments with larger batch sizes and higher communication overhead still need extensive exploration.
  • Dataset Scale: While effective on datasets up to ~80k samples, investigating CluSTER's behavior on massive corpora containing hundreds of thousands or millions of samples remains an open direction for future work.

Summary updated

BibTeX
@misc{kim2026clustering,
  author = {Hyunjin Kim and Youngeun Nam and Jaemin Han and Wonhyeok Choi and Jae-Gil Lee},
  title = {{Clustering-Based Balanced Sampling and Allocation with Data Parallelism for High-Performance Fine-Tuning}},
  year = {2026},
  eprint = {2609.12584},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2609.12584},
}
Figure