Introduction
Standard training via empirical risk minimization (ERM) can produce models that achieve low error on average but high error on minority groups. This performance disparity often arises because models latch onto spurious correlations in the training data. Just Train Twice (JTT) is a simple, two-stage algorithm that significantly improves model robustness on these minority groups without requiring expensive group labels for the training set. By identifying examples misclassified by a simple, early-stopped model and upweighting them in a second round of training, JTT closes 73% of the performance gap between standard training and "oracle" methods that rely on full group annotations.
The Challenge of Spurious Correlations
Machine learning models trained via standard ERM often achieve high average accuracy but fail miserably on specific subgroups. This typically happens because the model learns shortcuts—spurious correlations—that hold true for the majority of the data but fail for minority groups.
For example, if most "waterbird" images in a dataset feature a water background, a model might learn to identify the background rather than the bird itself. Consequently, it will fail on the rare "waterbird on land" group. Existing solutions like Group Distributionally Robust Optimization (Group DRO) can fix this, but they require every training image to be labeled with its specific group (e.g., "waterbird on land"). This level of annotation is prohibitively expensive at scale. JTT aims to achieve similar robustness using only a tiny, labeled validation set for hyperparameter tuning.
Datasets and Evaluation
The authors evaluated JTT on four benchmarks known for challenging spurious correlations:
- Waterbirds: Classifying birds as waterbirds vs. landbirds (spurious correlation: background).
- CelebA: Classifying hair color as blond vs. non-blond (spurious correlation: gender).
- MultiNLI: Natural language inference (spurious correlation: presence of negation words).
- CivilComments-WILDS: Toxicity classification (spurious correlation: mentions of specific demographic identities).
The Just Train Twice (JTT) Algorithm
JTT is elegantly simple and consists of two distinct stages:
- Stage 1 (Identification): Train a standard ERM model for a very short time (just a few epochs). Because models tend to learn easy spurious correlations first, the examples it misclassifies at this early stage (the "error set") are highly likely to be the minority examples that defy those correlations.
- Stage 2 (Upweighting): Create a new training set where the examples from the error set are upweighted (counted multiple times). Train a final model from scratch on this reweighted data.
Unlike other robust methods like CVaR DRO, which dynamically change which points they focus on throughout training, JTT identifies a static set of "hard" points once and sticks with them.
Key Insights and Results
- ERM as a Heuristic: The core insight is that a poorly trained ERM model acts as a highly effective "minority group detector." The error set identified in Stage 1 is significantly enriched with the groups we care about. In the Waterbirds dataset, the worst-performing group appears 15.9x more frequently in the error set than in the original data.
- The Power of Stability: A key finding is that static upweighting beats dynamic upweighting. Dynamic methods often "forget" hard groups or get distracted by outliers, whereas JTT’s fixed focus allows the model to consistently learn the features that matter for the minority.
- Early Stopping is Critical: The number of epochs in Stage 1 is a vital hyperparameter. Training the identification model for too long allows it to eventually memorize the minority points, leaving an empty error set.
JTT consistently outperforms ERM and other "no-group-label" baselines. It improved worst-group accuracy by an average of 15.9% across the four datasets compared to ERM, recovering 73% of the performance gap between ERM and Group DRO. On the CelebA dataset, JTT achieved 81.1% worst-group accuracy—a massive jump from ERM’s 47.2%—while only losing about 7% in average accuracy.
Limitations and Future Directions
While JTT eliminates the need for group labels during training, it still requires them for a small validation set to tune the number of Stage 1 epochs and the upweighting factor. Furthermore, while the empirical results are strong, a formal theoretical understanding of why fixing the error set (static) outperforms dynamic reweighting remains an open question. Finally, the authors suggest JTT might be useful for other types of distribution shifts, such as domain generalization, presenting a fruitful area for future research.
Summary updated