TL;DR
Empirical risk minimization fits a model by averaging its loss on the training examples, which are only a few points in a large space. Vicinal risk minimization replaces each training point with a small cloud of nearby points, drawn from a chosen neighbourhood, and averages the loss over those clouds. It solves the problem that a model can fit the exact training points while behaving badly just next to them. It matters because it states, as a training objective, the idea that a prediction should stay the same for inputs that are close together.
Builds on: Empirical Risk Minimization, Gaussian (Normal) Distribution · Leads to: Mixup, Data Augmentation
Where it's used
- Image classifiers. A photograph of a cat stays a cat after a small shift, a slight change in brightness, or a little pixel noise. Training on random versions of each photo, with the same label, is the everyday form of vicinal training. Most data augmentation pipelines for image networks do this without naming the objective.
- Sensor data. A thermometer reading of 20.0 degrees may really be anywhere within half a degree of that. A model that predicts heating demand from temperature should not change its answer sharply over that range. Training on noisy copies of each reading is a direct way to encode that the reading is only approximate.
- Mixup training. In 2018, Hongyi Zhang and colleagues proposed mixup, which blends two training examples and their labels. Their paper describes mixup as a particular choice of vicinal distribution, so the method is a concrete case of this idea where the neighbourhood is a line segment between two points.
How it works
Take a one-dimensional problem with one training example, and target . The model is the rule , which fits the example exactly. Empirical risk minimization would say that this model has zero loss, and stop there. The loss is a number that measures how wrong a prediction is. Here it is the squared loss, the square of the gap between the prediction and the target. Vicinal training asks what happens near .
- Start with the training point. The pair is . The model predicts , so the squared loss is . Check: the prediction matches the target exactly.
- Choose a neighbourhood. Draw a small random offset from a normal distribution with mean 0 and standard deviation . The neighbour is . The label stays , because a small change in the input does not change the answer we want. Check: the offset is usually within about a unit of 0 when .
- Look at two neighbours. Take , so . The model predicts , and the loss is . Take , so . The model predicts , and the loss is . Check: both neighbours have loss 1, not 0. The model is wrong just next to its training point.
- Average over the neighbourhood. Each offset has the same chance of being chosen as its negative, so the average loss of the two neighbours is . Check: this average is the vicinal risk for this one training point, and it is much larger than the empirical risk of 0.
- Find the reason. The model has slope 2. Moving the input by moves the prediction by , and the squared error of that move averages to . The steeper the model, the more its predictions move under noise, and the more vicinal training penalises it.
flowchart LR P["Training point (x, y)"] --> N["Random neighbour x plus noise"] N --> F["Model prediction f(neighbour)"] F --> L["Loss against the same y"] L --> A["Average over neighbours"]
The diagram shows the path for one training point. The loss is computed on the neighbour, against the original label, and the average over neighbours is what the training objective minimises.
The math
Let be training pairs. A vicinal distribution is an average of local distributions, one per training point, where is the vicinity of the -th point. The vicinal risk of a rule is the expected loss under this distribution,
Here is the loss, which scores how wrong the prediction is against the label .
Step 1 in symbols: the vicinity
A common choice for the vicinity of a point with continuous inputs is a Gaussian cloud, with the label kept fixed: Here is the normal density centred on with variance , and is the Dirac delta, which puts all the label mass on . The width sets the size of the neighbourhood.
Step 2 in symbols: the risk as an average over neighbourhoods
Substituting the vicinity into the definition gives Each training point contributes the average loss over its own cloud. The expectation here is an average over the random offset .
Step 3 in symbols: the linear case
Take and squared loss . For one point, Take the expectation. The middle term has , so it vanishes, and because the offset has variance . This gives
Step 4 in symbols: the penalty
Averaging over the points gives the exact identity where is the ordinary empirical risk. The extra term depends only on the slope and the noise size. It grows with the square of the slope, so steep rules pay more. Setting removes the term, and the vicinity collapses to the training points themselves. That is the ERM case, which is why ERM is the limit of vicinal risk minimization as the neighbourhood shrinks to a point.
Worked examples
- Take one training pair , the model , and noise with .
- The empirical risk is .
- Apply the identity from Step 4 with : .
- Check by hand: the neighbours and have losses and . Their average is .
- Interpretation: the model fits the training point perfectly, but a random neighbour is off by one unit of squared error on average. Vicinal training sees this and penalises the slope.
- Take two training pairs and , and the rule , so . Use noise with , so .
- The empirical risk is the average of and , which is .
- The penalty is .
- The vicinal risk is .
- Check by hand: for the first point, . For the second, , because the cross term has mean 0. The average is , which agrees with step 4.
- Interpretation: the penalty is the same for every point, because it depends only on the slope. Training on the vicinal risk therefore prefers rules whose slope is not too large.
- A home-energy model predicts daily heating use from the outside temperature reading , in degrees, with slope kWh per degree.
- The thermometer error is roughly Gaussian with standard deviation degrees, so .
- The penalty term is kWh squared.
- Suppose the model is refitted with slope kWh per degree and the same noise. The penalty becomes kWh squared.
- Interpretation: a steeper slope is more sensitive to the thermometer error, and the vicinal objective charges for that sensitivity. A flatter slope is cheaper under noise, but it may fit the real data worse.
- Try it: with and , the penalty is . What is the penalty if the thermometer error doubles to degree, with the same slope ? Answer: kWh squared. Doubling the noise multiplies the penalty by four, because the penalty depends on .
Common mistakes and tradeoffs
It is tempting to think that vicinal risk minimization is the same as data augmentation. In fact data augmentation is a practical recipe, which trains on random transformed copies of the data, and vicinal risk is the objective that such training approximately minimises. The objective fixes what the neighbourhood means, while augmentation is a way of sampling from it.
It is also tempting to think that a larger neighbourhood always helps. In fact the neighbourhood must be one where the label really does not change. A neighbourhood that moves points across a decision boundary asks the model to predict a label that the new point does not have, and this can hurt accuracy. The penalty in the linear case also shows the tradeoff: a larger noise width adds a larger penalty, which can underfit a model that needs its slope.
Use vicinal training when you know which changes should not alter the answer, such as small shifts of an image, or small errors in a sensor. Do not use it when the neighbourhood is not known, or when a small change does change the label, such as a single pixel that decides between two digits. Alternatives include plain empirical risk minimization with an explicit penalty on the weights, which is simpler but encodes smoothness only through the penalty, and Dropout, which adds noise inside the network rather than to the inputs.
History
Vladimir Vapnik's work on statistical learning theory in the 1990s made empirical risk minimization the central principle of the field, together with the question of when the training average can be trusted on new data. Vapnik and colleagues asked whether a better training objective could use knowledge about the neighbourhood of each point, and in 2001 Olivier Chapelle, Jason Weston, Léon Bottou and Vapnik published the vicinal risk formulation with the vicinity written as a distribution around each training point.
The idea was used in practice for many years under the name of input noise and data augmentation, which made models more robust to small changes. The 2018 mixup paper by Zhang and colleagues gave a simple vicinal distribution based on blending pairs of examples, and it became a widely used training method for image classifiers. Its popularity made the vicinal view a common way to explain augmentation and regularisation.
Recap
- Empirical risk minimization averages the loss on the training points only.
- Vicinal risk minimization averages the loss over a random neighbourhood of each training point, with the label kept or blended.
- For a linear model with squared loss and Gaussian input noise, the vicinal risk equals the empirical risk plus .
- Shrinking the neighbourhood to zero recovers ERM, and a larger neighbourhood adds a larger penalty.
- Read next: Mixup, which uses a blend of two examples as its neighbourhood, and Data Augmentation, the practical recipe that samples from neighbourhoods like these.
Check yourself
QuestionWhy does ERM stop at zero loss for a model that fits its training points exactly, and why does vicinal training not?Show answer
ERM only evaluates the loss at the training points, so an exact fit gives zero empirical risk. Vicinal training also evaluates the loss at random neighbours of each point. For a model with a non-zero slope, the neighbours are not fitted exactly, so their loss is positive and the vicinal risk is larger than zero.
QuestionA linear model has slope , the noise width is , and the empirical risk is . What is the vicinal risk under squared loss?Show answer
The penalty is . The vicinal risk is .
QuestionWhy does the penalty term get larger when the slope gets steeper?Show answer
Under noise, the prediction moves by times the offset, so a larger slope moves the prediction further. The squared error of that move is , and its average is . The penalty grows with the square of the slope because the prediction is linear in the slope.
QuestionA team adds random rotations of up to 90 degrees to training images of handwritten digits, keeping the labels. A digit 6 rotated by 180 degrees can look like a 9. Is this a good vicinity, and why?Show answer
Not for this task. The vicinity should be a set of inputs where the label does not change. A large rotation can turn a 6 into a 9, so the label is no longer correct for the neighbour. Small rotations may be fine, but the team must pick the range so that the label stays true across it.
QuestionA model is trained on a vicinal objective with a very small neighbourhood. What does its behaviour approach, and why?Show answer
It approaches ordinary empirical risk minimization. As goes to 0, the Gaussian vicinity collapses onto the training points, and the average over neighbours becomes the average over the points themselves. The penalty also goes to 0.