Introduction
Training machine learning models on massive, imbalanced datasets—such as those used for click-through rate (CTR) prediction—often requires "negative sampling" to remain computationally feasible. This paper proves that the information in such data is primarily tied to the rare positive instances, introducing a mathematically optimal way to nonuniformly sample the negative instances. By utilizing a novel likelihood-based estimator with log-odds correction, the authors achieve higher accuracy and better stability than standard weighting methods, validating their approach on a real-world dataset with over 0.3 trillion instances.
The Challenge of Rare Events
In fields like online advertising or fraud detection, "rare events" are the norm. A system might log billions of ad impressions (negatives) but only a few thousand clicks (positives). Training on the full dataset is a computational nightmare, so practitioners rely on negative sampling: keeping all positive instances while retaining only a small fraction of the negatives.
However, most systems use uniform negative sampling, treating every negative instance as equally informative. This is rarely true. Furthermore, once data is subsampled, the model must be "corrected" so it doesn't underestimate the true probability of the rare event. The standard correction method, Inverse Probability Weighting (IPW), can be numerically unstable and inefficient. This paper seeks to identify the most "informative" negatives to sample and proposes a more robust way to correct the resulting bias.
Methodology
The authors approach the problem through the lens of asymptotic theory, developing their method through a logical progression:
- Information Theory of Rare Events: They first prove that the estimation error of a model is determined by the number of positive instances ($N_1$), rather than the total number of instances ($N$). This provides rigorous justification for discarding the vast majority of negative instances without losing significant signal.
- Optimal Nonuniform Sampling: They derive a sampling probability function designed to minimize the variance of the estimator. Essentially, it prioritizes sampling "hard" negatives—instances that the model might easily mistake for positives.
- Log-Odds Correction: Instead of using IPW (which multiplies the loss by a weight), the authors modify the likelihood function itself by adding a correction term to the log-odds. Because this correction happens inside a logarithm rather than as a multiplier, the estimator is much more robust to very small sampling probabilities that would otherwise cause IPW to "explode."
- Practical Pilot Estimation: Because optimal sampling depends on true model parameters that are initially unknown, they propose a two-step process: use a small "pilot" sample to get a rough estimate, then use that estimate to drive the nonuniform sampling for the full training run.
Key Insights and Results
The authors validated their approach using both synthetic data (testing various tail behaviors and model misspecifications) and a massive internal ByteDance CTR dataset containing over 0.3 trillion instances collected over a month.
- Efficiency Gains and Stability: In simulations, the proposed log-odds correction method (
optLik) consistently achieved lower Mean Squared Error (MSE) than uniform sampling or standard IPW, especially at very low sampling rates. Furthermore, it proved significantly more robust to "pilot misspecification" (when the initial rough estimate is slightly off) compared to weighted methods.
- Weighting vs. Correction: IPW is the standard, but it is flawed. If an informative instance is sampled with a 0.001% probability, IPW assigns it a weight of 100,000, which can ruin a gradient descent step. By using log-odds correction, the authors move the correction into a much more stable mathematical space.
- Real-World Impact: On the 0.3 trillion instance ByteDance dataset, the nonuniform sampling method significantly outperformed uniform sampling in terms of AUC (Area Under the Curve). The authors note that even a seemingly small AUC gain of 0.0005 on a dataset of this scale translates into significant revenue increases for production recommendation systems.
Limitations and Future Work
- Model Specification: The theoretical proofs assume the underlying model (e.g., logistic regression) is correctly specified. While empirical tests showed some robustness, the theory for "misspecified" models in this rare-event regime remains an open question.
- Positive Oversampling: The paper focuses exclusively on negative subsampling. How techniques like positive up-sampling or synthesis (e.g., SMOTE) interact with nonuniform sampling was not explored.
- The "Fixed Rarity" Assumption: The mathematics assume that as the dataset grows, the rarity of the event stays relatively constant compared to the features. This might not hold for "bursty" rare events, where an anomaly briefly becomes common in a specific sub-population.
Summary updated