Chameleon: A Flexible Data-mixing Framework for Language Model Pretraining and Finetuning

Wanyun Xie, Francesco Tonin, Volkan Cevher
5/30/2025
cs.LGcs.CL

Official code: LIONS-EPFL/Chameleon (8 stars, last commit 2025-07-23).

Abstract

Training data mixtures greatly impact the generalization performance of large language models. Existing domain reweighting methods often rely on costly weight computations and require retraining when new data is introduced. To this end, we introduce a flexible and efficient data mixing framework, Chameleon, that employs leverage scores to quantify domain importance within a learned embedding space. We first construct a domain affinity matrix over domain embeddings. The induced leverage scores determine a mixture that upweights domains sharing common representations in embedding space. This formulation allows direct transfer to new data by computing the new domain embeddings. In experiments, we demonstrate improvements over three key scenarios: (i) our computed weights improve performance on pretraining domains with a fraction of the compute of existing methods; (ii) Chameleon can adapt to data changes without proxy retraining, boosting few-shot reasoning accuracies when transferred to new data; (iii) our method enables efficient domain reweighting in finetuning, consistently improving test perplexity on all finetuning domains over uniform mixture. Our code is available at https://github.com/LIONS-EPFL/Chameleon.

View on arXivView PDF

Code Implementations(1)

Chameleon: A Flexible Data-mixing Framework for Language Model Pretraining and Finetuning, ICML 2025

82PythonMay 30, 20251 years ago

Similar Papers

Cite this paper

@article{xie2025chameleon,
  title  = {Chameleon: A Flexible Data-mixing Framework for Language Model Pretraining and Finetuning},
  author = {Wanyun Xie and Francesco Tonin and Volkan Cevher},
  year   = {2025},
  eprint = {2505.24844},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2505.24844v1},
  journal = {ICML 2025 2025}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2505.24844.svg)](https://codeofpaper.com/paper/2505.24844)

Discussion