TL;DR
CHAMELEON is a novel, data-centric framework that uses Kernel Ridge Leverage Scores (KRLS) to automatically determine the optimal mix of data domains for training Large Language Models (LLMs). Unlike existing methods that require expensive and repetitive proxy model training, CHAMELEON computes stable domain weights directly from data embeddings, cutting compute costs by up to 90% while seamlessly adapting to new data and supporting both pretraining and finetuning stages.
What Problem Does This Paper Address?
When training LLMs, the composition of the dataset—how much code versus web text, academic papers versus books—profoundly shapes the model's ultimate capabilities. Finding the right "data mixture" is typically done via trial-and-error or by using small proxy models to estimate optimal weights (e.g., DoReMi or DoGE).
However, current computational methods suffer from three major flaws:
- High Computational Overhead: They require training proxy models for tens of thousands of steps or tracking complex gradients, which can add significant costs.
- Inflexibility to Data Changes: If you add a new data source or modify an existing one, you have to retrain the proxy model entirely from scratch.
- Phase Limitations: They are almost exclusively designed for pretraining, leaving the data-mixing problem for finetuning largely unaddressed.
The authors introduce CHAMELEON to bridge these gaps, creating a unified, agile framework capable of handling dynamic data environments across both pretraining and finetuning.
Methods
CHAMELEON shifts the paradigm from optimization-centric reweighting to data-centric geometric analysis. The pipeline operates in four main steps:
- Learn Domain Embeddings: Data from $k$ distinct domains is passed through a small, uniformly trained proxy model to extract hidden-layer representations. These are averaged to form a single embedding vector for each domain.
- Compute Domain Affinity: A domain affinity matrix ($\Omega_D$) is constructed by calculating the pairwise inner products of these domain embeddings, capturing how semantically close the domains are to one another.
- Compute KRLS Scores: Kernel Ridge Leverage Scores (KRLS) are calculated from the affinity matrix. High KRLS scores indicate a domain is unique and hard to reconstruct from others; low scores mean the domain shares broad, common representations with the rest of the dataset.
- Phase-Specific Weighting:
- Pretraining: The framework prioritizes general knowledge by upweighting high-density regions using the inverse KRLS scores (mathematically related to the Christoffel function).
- Finetuning: The framework prioritizes task specialization by directly using the KRLS scores to upweight unique, domain-specific features.
Crucially, when new data domains are introduced, CHAMELEON simply embeds the new data using the existing proxy model and recalculates the scores—no proxy retraining required.
Datasets
The authors evaluated CHAMELEON across several large-scale setups:
- Pretraining: SlimPajama-627B (7 domains) was used for initial pretraining experiments.
- Data Expansion / Transfer: The Pile (17 available domains) was used to test how well the framework scales when transferring to completely new, unseen data sources.
- Finetuning: Wiki40b (7 Latin languages) and Stack-dedup (7 programming languages).
- Downstream Evaluation: 13 standard reasoning benchmarks including ARC-E, COPA, HellaSwag, Lambada, LogiQA, PiQA, and RACE.
Key Insights and Ideas
- The Duality of Training Stages: Pretraining and finetuning have opposing data needs. Pretraining thrives on structural redundancy and shared representations (low leverage/high density), while finetuning excels when focusing on distinct, unique features (high leverage).
- Rapid Convergence and Stability: Unlike optimization-based methods where domain weights fluctuate wildly throughout training, CHAMELEON's weights stabilize after just 1,000 proxy steps.
- Scale Invariance: Domain relationships captured in the embedding space of an 82M parameter proxy model successfully transfer to guide the training of 684M and 1.2B parameter base models.
Key Results
- Massive Compute Savings: To find domain weights on SlimPajama, CHAMELEON required only 0.8 GPU hours, compared to 7.4 hours for DoReMi and 6.3 hours for DoGE. This represents a ~90% reduction in optimization compute.
- Superior Generalization: When scaling to a 1.2B parameter base model, CHAMELEON achieved an average downstream reasoning accuracy of 41.5%, outperforming the Uniform baseline (40.5%), DoReMi (40.5%), and DoGE (40.4%).
- Zero-Retraining Transfer: When adapting to the Pile dataset, competing methods required up to $3.5 \times 10^{18}$ extra FLOPs to retrain their proxies. CHAMELEON required virtually zero extra training overhead ($4.62 \times 10^{15}$ FLOPs for inference only) and achieved the lowest average test perplexity (19.94 vs. DoReMi's 21.45).
- Finetuning Gains: In finetuning tasks, CHAMELEON consistently lowered test perplexity across all language and code domains compared to a uniform data mixture.
Limitations and Future Work
Currently, CHAMELEON operates as an offline data-mixing framework, meaning weights are calculated once before a training stage begins. The authors note that extending this approach to an online setting—where domain weights dynamically adjust mid-training as the base model evolves—is a promising direction for future work. Additionally, they plan to explore modifying the identity matrix within the KRLS formula to intentionally steer models toward specific, targeted downstream tasks.
Summary updated