Interactive Explainer
Augmentation & Mixup
Twenty-four points is not much of a training set, and a classifier will draw a nervous, jagged boundary through the empty space between them. Two cheap tricks manufacture more data from what you already have: augmentation scatters plausible neighbors around each point, and mixup places soft-labeled points along the lines between points. Toggle each one and watch the boundary relax into a wide, confident margin.
Two ways to invent training data
A model only ever sees the training points you give it; everywhere else it guesses. Both augmentation and mixup attack that emptiness by synthesizing new labeled examples — but they fill different geometry.
- Data augmentation applies label-preserving perturbations — a jitter, small rotation, or rescale — to each example. A cat photo shifted two pixels is still a cat, so we get a fresh point $\tilde{x} = x_i + \varepsilon$ carrying the same hard label. This inflates a little cloud around every training point.
- Mixup blends two examples and their labels linearly:
A point halfway between a blue example and an orange one is labeled “half blue, half orange.” Instead of clouds around points, mixup lays down a continuum of soft-labeled points along the segments between examples, teaching the model to change its prediction linearly and gently as you move from one class to the other.
Fill in the manifold
Two classes, twelve points each, and a soft nearest-neighbor classifier whose decision landscape is painted underneath: blue where it predicts class A, orange for class B, and pale where it is unsure — that pale ribbon is the margin. Turn on augmentation and mixup and watch the synthesized points (small dots) reshape that landscape.
Same goal, different geometry
Both methods are data-space regularizers: they don't touch the loss or the weights, they enlarge the region of input space the model is held accountable for. But they enlarge it differently, and that difference is the whole lesson.
- Augmentation grows balls around points. It encodes an invariance you already believe (“a small jitter doesn't change the class”), so it thickens each class's support and kills the model's freedom to overfit to a single pixel-perfect example.
- Mixup grows segments between points. By demanding $f\big(\lambda x_i + (1-\lambda)x_j\big) \approx \lambda y_i + (1-\lambda)y_j$, it forces the prediction to vary linearly between examples. That linear ramp is a wide, calibrated margin — and it discourages the wildly overconfident extrapolation plain training loves.
- Both shrink the gap between what the model saw and what it will be tested on — the same generalization goal as weight decay or dropout, reached by editing the data instead of the model.