Domain2Vec: Vectorizing Datasets to Find the Optimal Data Mixture without Training

Mozhi Zhang, Howe Tissue, Lu Wang, Xipeng Qiu

Abstract

Domain2Vec is a novel framework that treats datasets as vectors in a "meta-domain" space, allowing researchers to find the optimal data mixture for Large Language Model (LLM) pretraining without the need for expensive trial-and-error training. By aligning the distribution of training data with a target validation set in this vector space, the method achieves superior performance while using only 0.26% of the computational cost of previous state-of-the-art techniques.

What Problem Does This Paper Address?

Training a state-of-the-art LLM isn't just about the amount of data; it’s about the mixture. If you have 1 trillion tokens from Wikipedia, GitHub, and Common Crawl, how much of each should you use? Currently, this "data mixture" problem is solved either through heuristics (educated guesses) or by training small "proxy" models to test different ratios—a process that is incredibly expensive and doesn't scale. If you add a new dataset to your collection, you often have to start the whole optimization process from scratch.

The authors identify two main bottlenecks in current workflows:

  1. Computational Efficiency: Methods like DoReMi require massive FLOPs just to find the right ratios.
  2. Lack of Scalability: Existing functional relationships between data and performance break down the moment the dataset composition changes.

Methods

The core innovation is Domain2Vec, which treats any dataset as a linear combination of meta-domains.

  1. Meta-Domain Vocabulary: The authors constructed a "basis" of 260 meta-domains (120 English, 120 Chinese, and 20 Code) derived from a massive 5.2 TB corpus. These represent the fundamental semantic building blocks of text.
  2. Vectorization: They trained a classifier (based on Qwen2-1.5B) to categorize any document into these meta-domains. A dataset is then represented as a domain vector—essentially a probability distribution across the meta-domain vocabulary.
Heatmap of dataset representations in the meta-domain space.
  1. Distribution Alignment Assumption (DA²): This is the "secret sauce." The authors hypothesize that the optimal training mixture is the one whose domain vector most closely aligns with the domain vector of the target validation set.
  2. Training-Free Optimization: Because datasets are now just vectors, finding the "best" mixture becomes a simple geometric distance minimization problem (using Huber Loss) rather than a deep learning training problem.

Datasets

The researchers utilized several massive, standard corpora for their experiments:

  • The Pile: An 825 GB English text corpus. They specifically used the Pile-CC (Common Crawl) subset as a "golden" validation set.
  • C4 & Knowledge Pile: Used to create controlled training mixtures for pilot studies.
  • RedPajama: Used for additional validation across diverse domains like StackExchange and EuroParl.
  • Downstream Benchmarks: To prove the mixtures actually work, they evaluated on 12 standard tasks including HellaSwag, PiQA, ARC-Easy, and SciQ.

Key Insights and Ideas

  • Mixture Invariance: One of the most striking findings is that the "optimal" data mixture for a tiny 83M parameter model is nearly identical to the optimal mixture for a 1.6B parameter model. This justifies using small-scale observations to inform large-scale training.
  • Datasets as a Basis: By viewing datasets through the lens of linear algebra (as a "spanning set"), the authors move data selection from a qualitative "vibe check" to a quantitative geometric calculation.
  • Training is Optional: The DA² approach suggests that semantic alignment in vector space is a powerful proxy for loss minimization. You don't need to see the model's loss curve to know a mixture is bad if its "coordinates" are miles away from your target.

Key Results

  • Efficiency: Domain2Vec identifies optimal mixtures using only 0.26% of the compute required by DoReMi and 9.46% of that required by RegMix.
  • Compute Savings: To reach the same validation loss as the standard "Human" mixture on The Pile, Domain2Vec required only 51.5% of the training steps.
  • Performance Boost: Under an equivalent compute budget, models trained on Domain2Vec-optimized mixtures improved downstream task performance by an average of 2.83%.
Validation loss sensitivity to data mixtures for a 1.6B model.
  • High Correlation: The predicted rankings of data mixtures by Domain2Vec showed a Spearman correlation of over 0.90 with actual model performance, proving the vector space accurately reflects reality.

Limitations and Future Work

While powerful, Domain2Vec relies heavily on the quality of its meta-domain vocabulary. If the initial 260 meta-domains don't capture a specific niche (e.g., a very specific legal or medical sub-field), the vectorization might be less accurate.

The authors also noted that while they used Huber Loss for simplicity, more complex distance measures like Wasserstein distance might yield even better results. Finally, the current classifier is optimized for English, Chinese, and Code; expanding this to a truly multilingual "Global2Vec" remains a task for the future.

Summary updated

BibTeX
@inproceedings{zhang2025domain,
  author = {Mozhi Zhang and Howe Tissue and Lu Wang and Xipeng Qiu},
  title = {{Domain2Vec: Vectorizing Datasets to Find the Optimal Data Mixture without Training}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=kJ5i29FejW},
}
Figure