Group Robustness and DRO
In Lesson 4, Nadia's fraud model met an input unlike anything it had trained on, and you learned to flag it. That was a strange transaction. This lesson is about the opposite and more unsettling failure: transactions that look completely ordinary, on which the model is confident, correct on average, and quietly wrong for an entire group of real customers.
Nadia's model is right about 88% of the time overall. Her manager is happy. Then she splits that number by customer segment and finds that for international customers, the model is right only 11% of the time, worse than flipping a coin. Nothing looks broken. The average hid a group in freefall.
By the end of this lesson you will be able to:
- Explain how a strong average accuracy can conceal a subgroup the model fails, and compute worst-group accuracy
- Spot a spurious feature whose relationship with the label reverses for a minority, and see why it is the cause
- Change the training objective from average loss (ERM) to worst-group loss (DRO), and implement it as reweighting in R
- Read the worst-group versus average tradeoff as a deliberate choice, and name where DRO stops working
Prerequisites: you finished Lesson 4: Out-of-Distribution and Novelty Detection, you can fit and read a logistic regression, and you are comfortable with a weighted average. No fairness or robustness theory is assumed; every term is defined here.
One model, two very different customers
Each lesson runs in its own R session, so we rebuild Nadia's world from scratch. Her fraud model reads two standardized features of every transaction. The first, risk, is a genuine, causal fraud signal built from the account's own history: higher means genuinely riskier, for everyone. The second, night_score, measures how far into the server's night the transaction landed. It looks useful, and for most customers it is.
The catch is the customer base. Ninety percent of transactions are domestic, in the same timezone as Nadia's servers. The other ten percent are international, many hours ahead. That single fact is about to matter enormously.
Now Nadia trains the model she has trained a hundred times, a logistic regression on both features, and checks its overall accuracy the way her dashboard does.
Eighty-eight percent. On paper this is a good model, and if Nadia stops reading here, it ships.