Finding Shortcut-Breaking Examples When Some Classes Are Rare

Many methods that make classifiers robust to shortcuts share one recipe. First, briefly train a plain model, which tends to pick up the easy but misleading cue, such as a background or a topic word. Next, collect the examples that model gets wrong. Finally, retrain while giving those examples extra weight. The recipe assumes that "wrong" means "contradicts the shortcut." That assumption breaks when some classes are rare. A briefly trained model also gets most examples of a rare class wrong, simply because the class is rare. The error set then fills with ordinary rare-class examples and mislabeled noise rather than shortcut-breaking ones. Dialect identification is a natural test case because it has both problems at once. Small regional varieties are dwarfed by dominant standards, and models are known to latch onto topic and author artifacts instead of dialect features.

The proposal is to separate two jobs that current methods merge. The model whose mistakes reveal the shortcut is trained without any class rebalancing, so that it learns the shortcut quickly and cleanly. Its mistakes are then scored after removing the effect of class frequency, and ranked only against other examples of the same class. A density check then removes clusters that look like label noise. The work will measure, on dialect benchmarks with planted shortcuts whose true groups are known, how pure each identification rule's error set is as class imbalance grows. It then tests whether purer error sets lead to better accuracy on the worst-off groups.

Core Claim

The claim is that in long-tailed problems, the failure of error-set methods is mostly an identification failure, not a retraining failure. That failure has a specific fix: correct the error scores for class frequency and compare examples only within their class. This decoupling is what is new.

It is distinct from simply rebalancing the first-stage model. Rebalancing does reduce rarity-driven errors. But repeatedly resampling a handful of rare-class examples lets the model memorize them early, which plausibly erases the very signal of shortcut reliance we want to read off. Whether that is true is an empirical question, and the main experiment is designed to settle it. If class-balanced first-stage training identifies shortcut-breaking examples equally well, the claim fails and we will report that.

Concretely, let $f(x)$ be the logits of an early-stopped, unbalanced model, $\pi_c$ the training frequency of class $c$, and $\tau$ a scale fixed to 1 by default. Each example $(x, y)$ gets a prior-corrected loss

$$s(x,y) = \ell\big(y,\; f(x) - \tau \log \pi\big),$$

where $\ell$ is cross-entropy and $\log \pi$ is the vector of log class frequencies. This is the standard logit-adjustment correction, applied here only at scoring time, not during training. The error set for class $c$ is the top $q$ fraction of class-$c$ examples ranked by $s$, so every class contributes in proportion to its own size. On that candidate set we apply the error-density filter from Towards Inter-class and Intra-class Imbalance in Class-imbalanced Learning. We keep sparse, moderately-to-highly wrong examples and down-weight dense high-error clusters, which that paper shows are mostly label noise. The second-stage model is then retrained with these examples upweighted, as in JTT.

Why This Gap Is Real

Three lines of work frame the problem.

Just Train Twice supplies the method skeleton. It retrains with an upweighted error set from an early-stopped model, and reports that the worst group appears 15.9 times more often in that set than in the data. Its benchmarks, however, are binary or near-balanced. It never asks what happens when the class prior, rather than the shortcut, explains most errors.

Spread Spurious Attribute motivates the proposal. It documents "self-confirmation bias": with fixed confidence thresholds, pseudo-labels concentrate on majority groups. It fixes this with per-group thresholds, but those require a seed of group labels and a known spurious attribute. Our per-class ranking is the label-free analogue for error sets. It needs only class labels, which are always available.

When Does Group Invariant Learning Survive Spurious Correlations? constrains the design. Its Label Balance Criterion shows that inferred groups with skewed label ratios let invariance objectives be satisfied trivially. Per-class quantile selection guarantees that the upweighted set has the same label proportions as the training data, which addresses one way that criterion gets violated.

Two further results constrain what we can expect. Severing Spurious Correlations with Data Pruning shows that shortcuts take hold mainly when the true ("core") feature is hard to learn. It prunes the same fraction of high-loss examples from every class. For a class with a few hundred examples, deleting hard ones may delete the rare dialect evidence. We therefore upweight rather than prune, and test pruning directly. Towards Inter-class and Intra-class Imbalance shows that standard hard-example mining collapses beyond 20% label noise while its density-based variant holds at 50%. That paper is tabular-only and has no notion of a structured spurious attribute. We carry its noise filter into text, where dialect labels assigned at the user or region level are known to be noisy.

On the dialect side, two findings motivate the regime. Adapting MARBERT reports persistent over-prediction of majority dialects even with adapters. ba휌tti at GeoLingIt reports models latching onto author and topic artifacts. Together they make dialect identification a setting where class rarity and shortcuts coexist.

Research Program

The first component is a controlled benchmark in which the true groups are known. We take the 21-country NADI 2021 data (21,000 training tweets) and the 11-variety ITDI VarDial 2022 data. For each, we plant a shortcut in the style of the injected tokens used by Causal Fine-Tuning under Latent Confounded Shift. That paper ties a suffix token to a label at 90% in training and flips it at test time. Here, each class is assigned a marker that co-occurs with it at rate $\rho$. Markers are either a neutral token or, more realistically, a topic word drawn from another class's frequent vocabulary.

We then subsample to create long-tailed versions with imbalance ratios from 1:1 to 100:1. We also inject controlled label noise at 0, 10, and 30%. Because the marker is planted, every example carries a known group: class crossed with whether the marker is present. This lets us measure exactly what fraction of an error set is shortcut-breaking.

We will also report results on natural groups formed by clustering tweets on hashtags and topics. This is a weaker test, because those groups are only approximately the shortcut, and we will say so.

The second component is the analysis. We cross four identification rules with the imbalance ratio and the noise level. The rules are raw JTT errors, errors from a class-balanced first stage, prior-corrected scores with per-class ranking, and prior-corrected scores plus the density filter. For each combination we measure the precision and recall of shortcut-breaking examples in the error set. We expect raw-error precision to fall sharply as imbalance rises, and the corrected rule to stay closer to its balanced-data level.

The third component is the downstream comparison of retrained models. The fourth is a transfer check on the standard binary benchmarks: Waterbirds, CelebA, MultiNLI, and CivilComments-WILDS. There we confirm the method does no harm, and we build long-tailed variants by subsampling MultiNLI's three classes.

Baselines

The naive reference is plain fine-tuning of MARBERT (for Arabic) or an Italian BERT (for ITDI) with standard cross-entropy, plus the same model with class-weighted loss. This anchors how bad the planted shortcut makes things.

The strongest dialect-specific competitor is a tuned logistic regression on character and word n-grams with class weights, following The Curious Case of Logistic Regression. On the ITDI leaderboard it reached weighted F1-micro 0.6880, against 0.5760 for the best BERT model. On NADI, the reference is the adapter-plus-layer-attention ensemble of Adapting MARBERT, which reports country-level dev macro F1 of 34.03%. That number is on clean data. On planted-shortcut data we will rerun both systems ourselves, and there is no reported result on Lacuna for them in that condition.

The strongest shortcut-mitigation competitor without group labels is JTT, run with an identical backbone, epochs, and hyperparameter search budget. On CelebA it reports worst-group accuracy of 81.1%, against 47.2% for ERM, and Group DRO reaches 86.7% with full group labels per Distributionally Robust Neural Networks.

Two further baselines are not label-free, so they serve as upper references rather than direct competitors. Group DRO with oracle groups marks the ceiling. SSA, which reports 89.8% worst-group accuracy on CelebA using 0.6% group labels, is the label-efficient reference point.

The key ablation isolates the new ingredient. It is class-balanced JTT: JTT whose first stage is trained with inverse-frequency weighted random sampling, the technique credited with gains on NADI 2024 by AlexUNLP-STM. Its error set is used without prior correction. Further ablations drop the per-class ranking and drop the density filter separately.

All methods get the same validation budget. Following JTT, that budget is a small group-labeled validation set used for early stopping. We will also report results with a class-labeled-only validation set, because dialect development sets can be tiny; NADI 2024's had 107 examples.

Beating the baselines means two things. First, a statistically significant gain in worst-group macro F1 over both JTT and class-balanced JTT across seeds, at imbalance ratios of 20:1 and above. Second, no worse than a one-point loss in overall macro F1 relative to plain fine-tuning.

Why not just…?

Why not just train the first stage with class-balanced sampling? This is the most serious threat, and it may simply work. If it does, our decoupling adds nothing. The experiment settles it directly: we compare error-set precision for shortcut-breaking examples between class-balanced JTT and prior-corrected JTT at every imbalance ratio. Our hypothesis is that balanced sampling of very small classes causes early memorization, which hides shortcut reliance in exactly the rare classes. If the two rules produce equally pure error sets and equal downstream worst-group F1, we will report the cheaper method as the answer.

Why not just use a class-weighted linear n-gram model, which already beats transformers on dialect identification? Linear models do win on clean ITDI. But a planted or topical shortcut is itself an n-gram feature, so a linear model should latch onto it just as readily as a deep model. The planted-shortcut condition tests this directly. If logistic regression's worst-group F1 holds up, that is an important negative finding and we will lead with it. We will also apply our error-set reweighting to the linear model itself, so the comparison is about the method rather than the architecture.

Why not just prune hard examples instead of upweighting them? Data Pruning reaches 90.93% worst-group accuracy on Waterbirds, but it removes an equal fraction per class. We will run it with per-class pruning fractions matched to our error-set size and measure rare-class recall. Our prediction is that pruning hurts most at the highest imbalance ratios, where each removed example is a large share of its class.

Why not just tune weight decay and early stopping? The regularization analysis in Spurious Correlations in High Dimensional Regression shows that moderate regularization can increase shortcut reliance before it reduces it, so tuning on overall accuracy is unreliable. We include a heavily regularized, early-stopped plain model with the same search budget, so this alternative is measured rather than assumed away.

Decisive Checks

The central test is the error-set precision curve on planted NADI and ITDI data. If prior-corrected, per-class-ranked scoring does not keep markedly higher shortcut-breaking precision than both raw JTT and class-balanced JTT once imbalance exceeds about 20:1, the identification hypothesis is wrong.

The second test asks whether higher precision causes better results downstream. We retrain on error sets of controlled precision, mixing true shortcut-breaking examples with random same-class examples. This should show worst-group F1 rising with precision; if it does not, purity is not the bottleneck.

The third test is noise. At 30% injected label noise, the density filter should recover precision that per-class ranking alone loses, mirroring the tabular finding. If it does not, the noise component should be dropped from the method.

Finally, on standard Waterbirds and CelebA, the method should match JTT within seed variance. A drop there would indicate that the prior correction is harming balanced settings.