Bias, variance & generalization
Underfitting vs overfitting, learning curves, regularization (L1/L2, early stopping). Diagnose from train/validation curves — the classic whiteboard probe.
The mental model
Bias and variance are the two ways a student can fail an exam. The high-bias student memorized one crude rule ("always pick C") — they get the same wrong answers on every practice test and the real exam alike. The high-variance student memorized every practice question verbatim — perfect on practice, lost the moment the wording changes. Generalization is passing the real exam, and the tradeoff exists because the cures are opposites: the crude-rule student needs a richer mental model (more capacity), the memorizer needs constraints (less capacity, or more varied practice).
Why this concept exists: without it you cannot read a learning curve, and reading learning curves is how practitioners decide what to do next — collect data, add features, regularize, or change model family. Every one of those actions helps exactly one failure mode and wastes money on the other. Teams without this diagnosis loop respond to "the model isn't good enough" by doing everything at once, which is how a two-week fix becomes a two-quarter project.
The formal anchor: expected test error decomposes into bias² + variance + irreducible noise. Bias is how far your model family's average prediction across hypothetical retrainings sits from the true function f(x), ignoring noise — the systematic miss. Variance is how much the prediction wobbles across retrainings on different samples — the sensitivity to which data you happened to draw. Noise is the floor no model touches. Train error well above the noise floor and the target points to bias; the train-validation gap is the main signal of variance. That two-number diagnosis — train error, and gap — is the whole clinical method.
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision