TL;DR
SPOKES is a new data selection framework that directly optimizes for pretraining data diversity and quality at scale using gradient-based metrics. By maximizing the G-Vendi score via exponentiated gradient descent, it extracts highly diverse data subsets that significantly boost LLM downstream performance, outperforming traditional quality filtering and semantic deduplication.
What Problem Does This Paper Address?
Building high-quality pretraining corpora for Large Language Models (LLMs) requires balancing both data quality and diversity. While filtering out low-quality text is straightforward, optimizing for diversity is notoriously difficult. Diversity is a "set-level" property—it depends on how data points interact with each other rather than the merit of any single example.
Because directly finding the most diverse subset of a massive dataset is a combinatorially explosive, intractable problem, current pipelines rely on coarse approximations like clustering data into broad topics or using embedding-based deduplication (e.g., SemDeDup). However, these proxies often fail to capture fine-grained, long-tail knowledge. This paper introduces a scalable way to directly optimize for fine-grained diversity at pretraining scale.
Methods
The authors introduce SPOKES, a probabilistic framework that directly optimizes the G-Vendi score—a metric that quantifies dataset diversity by looking at the entropy of the eigenvalues of a similarity matrix. Crucially, instead of comparing data in representation (embedding) space, SPOKES operates in gradient space, analyzing the parameter updates an example would induce during training.
To bypass the combinatorial nightmare of subset selection, SPOKES relaxes the discrete problem into a continuous optimization task. It assigns a continuous weight to every data point and optimizes the objective using exponentiated gradient descent.
To make this computationally feasible at scale, the authors implement three clever approximations:
- Truncated Gradients: Instead of computing gradients across the entire model, they approximate them using only the last 2–3 layers of a proxy model (e.g., Qwen3-0.6B-Base).
- Dimensionality Reduction: They use a Johnson-Lindenstrauss (JL) random projection to squash 200-million-dimensional gradients down to just 1,024 dimensions.
- Gram Matrix Trick: They operate directly on a $d \times d$ Gram matrix (where $d$ is the projection dimension) rather than an $N \times N$ pairwise similarity matrix, bringing the time complexity down to a manageable $O(TNd^2)$.
A tunable hyperparameter ($\alpha$) allows practitioners to smoothly balance the trade-off between pure quality filtering and pure diversity optimization.
Datasets
SPOKES was evaluated on two massive, distinct pretraining web corpora:
- DCLM (Dolmino subset): A dataset that has already undergone aggressive filtering and curation.
- FineWeb: A less aggressively filtered, noisier web-scale corpus.
Models were pretrained from scratch on 100 billion tokens using a LLaMA-1B architecture and evaluated on 10 benchmarks from the OLMES evaluation suite (including HellaSwag, MMLU, ARC, PIQA, and BoolQ) to measure world knowledge and reasoning.
Key Insights and Ideas
- Gradients > Embeddings for Diversity: Embedding-based diversity metrics saturate incredibly quickly on large datasets, making it hard to distinguish between different subsets. Gradients, however, remain highly sensitive under optimization because they capture the actual directional updates a model takes during training.
- Quality and Diversity are Complementary: Pure quality filtering excels at knowledge-intensive tasks (like MMLU), while pure diversity optimization shines on commonsense reasoning tasks (like HellaSwag). Jointly optimizing for both allows SPOKES to bridge this gap, capturing distinct but mutually beneficial properties of the data.
- Extreme Projection Stability: Remarkably, even when compressing massive gradient vectors down to a dimension of $k=1024$, the selected data subsets maintained a 95.5% overlap with a high-dimensional reference baseline. This proves that low-dimensional projections are entirely sufficient for diversity optimization.
Key Results
- Massive Diversity Gains: On a 500k-sample subset, SPOKES achieved a +489 point increase in the G-Vendi score compared to random sampling, whereas SemDeDup only managed a +7 point increase.
- Downstream Performance Boosts: When optimizing for diversity alone, SPOKES outperformed random sampling by +0.4 points on DCLM and +0.5 points on FineWeb.
- The Power of Joint Optimization: The strongest results appeared when jointly optimizing for quality and diversity. Quality-weighted SPOKES achieved an average downstream gain of +1.5 points on DCLM and +1.4 points on FineWeb, outperforming all standard baselines including semantic deduplication and top-50% quality filtering.
Limitations and Future Work
The primary bottleneck of SPOKES remains the computational overhead of evaluating gradients, even when restricted to the final two layers of a proxy model. While the authors argue this cost is amortized if the selected data is reused across multiple large pretraining runs, they note that future work should explore acceleration strategies like Cut Cross Entropy to further minimize memory overhead and make gradient computation truly compute-optimal.
Summary updated