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

Harnessing Diversity for Important Data Selection in Pretraining Large Language Models

Chi Zhang, Huaping Zhong, Kuan Zhang, Chengliang Chai, Rui Wang, Xinlin Zhuang, Tianyi Bai, Qiu Jiantao, Lei Cao, Ju Fan, Ye Yuan, Guoren Wang, Conghui He

Introduction

The performance of a Large Language Model (LLM) is heavily dictated by the quality of its pretraining data. However, web-scale corpora like Common Crawl are notoriously noisy. Researchers typically use "influence functions" to score how much a specific data point helps a model learn. While effective, traditional influence-based selection has two major flaws:

  1. Prohibitive Cost: Calculating the "influence" of a document requires computing a Hessian matrix (a massive table of second-order derivatives), which is computationally impossible to do for trillions of tokens.
  2. The Diversity Trap: Simply picking the "top-k" highest-scoring documents often leads to selecting a redundant set of very similar samples. This lack of diversity causes the model to overfit on specific patterns and fail to generalize to a broad range of downstream tasks.

To address this, researchers introduce Quad (Quality and Attention-based Data selection), a new framework that balances data quality and diversity to optimize LLM pretraining. By treating data clusters as "arms" in a Multi-Armed Bandit problem and using an accelerated, attention-aware influence function, Quad achieves state-of-the-art downstream performance with significantly lower computational costs.

The Quad Framework

Quad operates in three main stages to balance the exploration of diverse data with the exploitation of high-quality data.

The Quad framework pipeline
  • Clustering for Diversity: First, the entire dataset is grouped into clusters (e.g., 10,000 clusters) using k-means on semantic embeddings. This ensures that the "search space" for data is organized by topic and style.
  • The Multi-Armed Bandit (MAB) Strategy: Instead of scoring every document, Quad treats each cluster as an arm of a "slot machine." It uses the Upper Confidence Bound (UCB) algorithm to decide which clusters to sample from. This creates a mathematical balance between exploitation (sampling more from clusters known to have high-quality data) and exploration (sampling from less-visited clusters to maintain diversity).
  • Attention-Aware Influence: Most influence functions only look at the MLP (Multi-Layer Perceptron) layers of a Transformer. Quad incorporates the attention layers, which capture complex semantic interactions.
Attention-aware influence calculation using Kronecker product

To make this efficient, the authors use the Kronecker product (K-FAC) to approximate the Hessian matrix and the Johnson-Lindenstrauss Lemma to reduce the dimensionality of gradients, preventing memory explosions.

Key Insights and Performance

The researchers tested Quad on massive, industry-standard pretraining corpora: SlimPajama (627 billion tokens) and FineWeb (15 trillion tokens). To define what "high quality" looks like, they used reference sets including LAMBADA (word prediction), Openwebmath (technical/math content), and FLAN (instruction-following data).

  • Diversity is a Regularizer: The paper confirms that a "greedy" selection of the highest-quality data actually hurts the model. By forcing the selection of less-frequent clusters via the MAB approach, Quad prevents the model from seeing the same "type" of high-quality data over and over.
  • Attention Layers are the "Brain": Influence scores calculated using both MLP and Attention layers were significantly more accurate than those using MLPs alone. This suggests that the semantic "importance" of data is heavily encoded in how tokens attend to one another.
  • Sampling is Sufficient: You don't need to know the influence of every token. By sampling just 5% of a cluster, Quad can accurately estimate the cluster's overall "reward," saving massive amounts of compute (FLOPs).

Results

  • Superior Accuracy: Quad outperformed all baselines, including Random selection, DSIR, and PPL. On a 7B parameter model, it improved zero-shot accuracy by 1.39% over random sampling across 16 downstream tasks.
  • Efficiency: Quad achieved better results than LLM-based selectors (like Qurating) while consuming significantly fewer FLOPs. It essentially provides high-level data filtering without the massive cost of running a giant model over the entire dataset.
  • Math Specialist: When targeted at mathematical data (using Openwebmath as a reference), Quad-selected data helped a 7B model reach 36.76% accuracy on math evaluations, outperforming the "Clean" baseline by over 3%.

Limitations and Future Work

While Quad is highly effective, its definition of "quality" is tethered to the reference set provided. If the reference set is biased or narrow, the selected pretraining data will be too. Additionally, the balance between exploration and exploitation ($\alpha$) and the influence threshold ($\tau$) require careful tuning. Future work will need to test Quad at "frontier" scales (70B+ parameters) to see if the diversity-quality trade-off remains consistent as model sizes increase.

Summary updated

BibTeX
@inproceedings{zhang2025harnessing,
  author = {Chi Zhang and Huaping Zhong and Kuan Zhang and Chengliang Chai and Rui Wang and Xinlin Zhuang and Tianyi Bai and Qiu Jiantao and Lei Cao and Ju Fan and Ye Yuan and Guoren Wang and Conghui He},
  title = {{Harnessing Diversity for Important Data Selection in Pretraining Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=bMC1t7eLRc},
}
Figure