Abstract
In multi-domain training, researchers typically assign a single scalar weight to each data source. This paper demonstrates that this approach conflates two distinct goals: generalization and optimization. By decomposing domain weighting into loss weights (to handle data reliability) and sampling weights (to manage optimization efficiency), we can achieve superior model performance and training stability. We introduce ERMA for loss weighting and VA sampling for variance reduction, validating these methods across synthetic and real-world datasets.
1. Introduction
Modern machine learning models are increasingly trained on diverse datasets aggregated from various sources, such as Wikipedia, GitHub, and web crawls. These domains vary significantly in quality, reliability, and information density. The conventional method for managing this diversity is to assign a single "importance weight" to each domain, which dictates both its contribution to the loss function and its frequency in the training batches.
This paper argues that this one-dimensional approach is fundamentally flawed. A single weight cannot simultaneously optimize for the "what" (the target objective) and the "how" (the optimization path). We propose a two-dimensional weighting framework that separates loss weights from sampling weights.
2. The Two Dimensions of Weighting
The authors identify two primary roles for domain weights:
2.1 Generalization via Loss Weights
Loss weights determine how much a specific domain should influence the final model parameters. This is primarily a question of reliability. If a domain is "noisy" (e.g., contains mislabeled data or low-quality content), it should have a lower loss weight to prevent the model from overfitting to errors. The goal here is to improve the model's ability to generalize to unseen, clean data.
2.2 Optimization via Sampling Weights
Sampling weights determine how frequently the optimizer looks at a domain during training. This is a question of efficiency and variance reduction. If a domain is highly redundant, we may want to sample it less frequently to save computation, even if it is highly reliable. Conversely, domains with high gradient variance—where the model is still learning significant information—require more frequent sampling to stabilize the training process.
3. Proposed Methodology
The paper introduces two distinct algorithms to manage these weights:
3.1 ERM Aware Weighting (ERMA)
For loss weighting, the authors propose ERMA. In linear settings, this simplifies to a "One-shot FGLS" (Feasible Generalized Least Squares) approach that estimates noise variance dynamically. For non-linear models like neural networks, ERMA uses a mirror descent update rule. It adjusts weights based on the mean and variance of losses observed in each domain, effectively downweighting domains that exhibit high noise and low reliability.
3.2 Variance Aware (VA) Sampling
For sampling weights, the authors introduce VA sampling. This method focuses on variance reduction within Stochastic Gradient Descent (SGD). By calculating the variance of gradients for each domain, VA sampling allocates more samples to domains with "jumpy" or unpredictable gradients. This leads to a smoother optimization landscape and faster convergence.
4. Experimental Evaluation
The proposed framework was tested across three distinct environments:
- Synthetic Linear Regression: Establishing theoretical performance against classical statistical baselines like the Aitken estimator.
- Logistic Regression: Measuring the cosine distance to ground-truth parameters in non-linear classification.
- Modified MNIST: A controlled experiment where the MNIST dataset was split into groups, with one group intentionally corrupted by 20% label noise.
In the Modified MNIST task, ERMA successfully identified the noisy domain and reduced its influence, leading to significantly higher classification accuracy compared to uniform weighting. In regression tasks, the combination of VA sampling and ERMA reached lower error rates faster than standard SGD.
5. Key Insights
A critical finding of the research is the failure of the "Single Weight Proxy." When the authors attempted to merge the two weights into a single sampling weight (by multiplying them), the performance was inferior to the two-dimensional approach. This confirms that loss and sampling weights are complementary rather than redundant; loss weights act on the objective function, while sampling weights act on the stochastic noise of the solver.
6. Conclusion and Future Work
Separating loss and sampling weights provides a principled foundation for multi-domain training. While the current implementation introduces some computational overhead for gradient variance calculation and requires tuning of new hyperparameters, the benefits in stability and accuracy are substantial.
Future research will focus on extending these methods to autoregressive language models (LLMs), where data points are not independent, and exploring ways to automate hyperparameter selection to make these techniques more accessible for massive-scale training runs.
Summary updated