§7.5–7.7Noise Robustness · Label Smoothing · Semi-Supervised & Multi-Task Learning

Part II DL pp. 242–245 · ~5 min read

  • noise robustness
  • label smoothing
  • semi-supervised learning
  • multi-task learning

§7.5 Noise robustness

Section 7.4 injected noise into the inputs as augmentation; for infinitesimal variance that turns out to be equivalent to a penalty on the weight norm. But noise injection can be much more powerful, especially when the noise goes on the weights — a common trick in recurrent nets, interpretable as a stochastic Bayesian treatment of weight uncertainty. Take a regression net trained on squared error, and add a small perturbation WN(0,ηI)\boldsymbol{W}\sim\mathcal{N}(0,\eta\boldsymbol{I}) to the weights each step. For small η\eta, minimizing the noisy cost is equivalent to minimizing the clean cost plus a regularizer:

Term by term

J~W    J  +  ηEp(x,y)[Wy^(x)2]\tilde{J}_{\boldsymbol{W}} \;\approx\; J \;+\; \eta\,\mathbb{E}_{p(\boldsymbol{x},y)}\big[\, \lVert \nabla_{\boldsymbol{W}}\, \hat{y}(\boldsymbol{x}) \rVert^2 \,\big]
J=E[(y^(x)y)2]J = \mathbb{E}[(\hat{y}(\boldsymbol{x}) - y)^2]the ordinary squared-error objectivedata fit
ηE[Wy^2]\eta\,\mathbb{E}[\lVert\nabla_{\boldsymbol{W}}\hat{y}\rVert^2]the induced regularizer: it penalizes how much the OUTPUT moves when the weights wiggle — sensitivity of ŷ to Wthe penalty
flat minima\Rightarrow \text{flat minima}so training is pushed to regions where small weight perturbations barely change the output — minima surrounded by FLAT basins, not sharp onesthe effect

Explore what “prefers flat minima” means: both wells below are equally deep, but a weight perturbation of ±σ\pm\sigma raises the loss far more in the sharp one:

Weight noise penalizes sharp minima: a ±σ perturbation barely raises the loss in the flat basin but a lot in the sharp one
lowlossweight wsharpflat
Δloss at sharp min = 0.765
Δloss at flat min = 0.105
sharp / flat = 7.3×

Both wells have the same depth, but a ±σ weight perturbation raises the loss far more in the sharp basin. Weight-noise regularization adds exactly a term proportional to the output's sensitivity, so it prefers the flat minimum — points that are minima surrounded by flat regions.

Why flatness generalizes

A flat minimum means the function the network computes is insensitive to small changes in its parameters — and, loosely, to small changes in the data that shift those parameters. That robustness is exactly what we want from a model that must work on unseen inputs. (For plain linear regression y^=wx+b\hat{y}=\boldsymbol{w}^\top\boldsymbol{x}+b the term collapses to ηE[x2]\eta\,\mathbb{E}[\lVert\boldsymbol{x}\rVert^2], which does not depend on the parameters — so it has no gradient and no effect. The interesting behavior needs a nonlinear net.)

§7.5.1 Smoothing the labels

Datasets contain label mistakes, so blindly maximizing logp(yx)\log p(y\mid \boldsymbol{x}) on a wrong yy is harmful. Label smoothing softens the classification targets: instead of a hard one-hot, use 1ϵ1-\epsilon for the correct class and ϵk1\frac{\epsilon}{k-1} for each of the other k1k-1 classes, then apply the usual cross-entropy. Slide ϵ\epsilon:

Hard one-hot targets (ε=0) vs smoothed targets: 1−ε for the correct class, ε/(k−1) for the rest
01c10.03correct0.90c30.03c40.03
correct target = 1 − ε = 0.90
others = ε/(k−1) = 0.033

At ε = 0 the targets are hard 0/1 — but a softmax can never output exactly 0 or 1, so maximum likelihood keeps growing the weights forever. Softened targets give it a reachable goal while still preferring the correct class.

The motivation is subtle: a softmax can never output exactly 0 or 1, so maximum-likelihood training with hard targets never converges — it just keeps driving the weights larger, making ever more extreme predictions. Label smoothing gives the model a reachable target, discouraging that runaway without discouraging correct classification. It has been used since the 1980s and features in modern nets (Szegedy et al., 2015).

§7.6 Semi-supervised learning

Semi-supervised learning uses both unlabeled examples from P(x)P(\boldsymbol{x}) and labeled examples from P(x,y)P(\boldsymbol{x}, y) to estimate P(yx)P(y\mid\boldsymbol{x}). In deep learning this usually means learning a representation h=f(x)\boldsymbol{h}=f(\boldsymbol{x}) where examples of the same class land close together — unsupervised structure (tight input-space clusters) becomes a cue for grouping. Rather than bolting separate unsupervised and supervised components together, one can build a model whose generative part (for P(x)P(\boldsymbol{x}) or P(x,y)P(\boldsymbol{x}, y)) shares parameters with the discriminative part (for P(yx)P(y\mid\boldsymbol{x})), then trade off the criteria logP(yx)-\log P(y\mid\boldsymbol{x}) and logP(x)-\log P(\boldsymbol{x}). The generative term acts as a prior: it asserts that the structure of P(x)P(\boldsymbol{x}) is tied to the structure of P(yx)P(y\mid\boldsymbol{x}), and tuning how much of it to include can beat purely generative or purely discriminative training.

§7.7 Multi-task learning

Multi-task learning improves generalization by pooling the examples of several tasks — sharing part of the model acts as a soft constraint that pushes the shared parameters toward values that generalize. The classic architecture (fig 7.2) sends a common input through shared lower layers to a representation h(shared)\boldsymbol{h}^{(\text{shared})}, then splits into task-specific heads:

Fig 7.2 — multi-task learning: shared lower layers feed task-specific heads; some factors (h³) explain the input but serve no task
xh(sh)
Lower layers pool statistical strength across tasks; upper layers specialize. h³ is an unsupervised factor that explains input variation but predicts neither task.

The parameters divide into two kinds: task-specific ones (the upper layers, which benefit only from their own task’s examples) and generic shared ones (the lower layers, which benefit from the pooled data of all tasks). The shared part gets far more effective examples, so its statistical strength — and generalization — improves, provided the tasks really do share something. The underlying prior belief: among the factors that explain the variation across the tasks’ data, some are shared.

Next: early stopping (the most common regularizer of all) and parameter tying & sharing — early stopping & parameter sharing.

Check yourself — noise robustness, label smoothing, semi-supervised & multi-task

1.Adding small Gaussian noise to the WEIGHTS is (for small η) equivalent to what regularizer, and what does it favor?

2.In FlatMinimaLab, raise σ. Why does the loss increase much more at the sharp minimum than at the flat one, even though both wells are equally deep?

3.Why does maximum-likelihood training with HARD 0/1 softmax targets never really converge, and how does label smoothing help?

4.In the fig 7.2 multi-task architecture, which parameters benefit from the pooled data of ALL tasks?

5.How does the shared generative + discriminative parametrization make semi-supervised learning work?

5 questions