Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN014 · Training method
Label smoothing
Replaces hard classification targets with a mixture of the target label and a reference distribution.
In CodeSplash
A CodeSplash method runs this entry in Python and R. Set it up from the method's page.
- Convolutional neural network (CNN) Experimental
- Domain-adversarial network (DANN) Experimental
- Deep ensemble Experimental
- FT-Transformer Experimental
- Graph neural network (GCN, GraphSAGE, GAT, GIN) Experimental
- Image classifier (pretrained ResNet-50 or DINOv2) Experimental
- Neural controlled differential equation (irregular sequences) Experimental
- Set model (Deep Sets, Set Transformer) Experimental
- TabM (parameter-efficient MLP ensemble) Experimental
- TabNet (attentive feature selection) Experimental
- Text encoder (MiniLM + linear head) Not verified yet
- Deep neural network (torch MLP) Verified in Python and R
Do it in CodeSplash Run it on your own data, in Python or R.
- Availability
- Runs in CodeSplash
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- Verified in Python and R through learn.cnn, learn.dann, learn.deep_ensemble, learn.ft_transformer, learn.gnn, learn.neural_cde, learn.set_model, learn.tabm, learn.tabnet, learn.torch_mlp. The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Replaces hard classification targets with a mixture of the target label and a reference distribution.
Question / hypotheses
Does this intervention improve the intended quality, adaptation, resource, or reliability objective under a controlled comparison? It defines a method, not an intrinsic null-hypothesis test.
Architecture / computational structure
The network is unchanged; only the cross-entropy target distribution changes.
Assumptions
Choose the smoothing distribution and ignored-label handling explicitly. Uniform smoothing may be inappropriate when classes have structured relations or highly skewed prevalence.
Formula / computational definition
Parameters and notation
Learned: network weights. Hyperparameters: epsilon, reference distribution, class count, masking. Some implementations distribute smoothing mass over non-target classes instead, giving a different formula.
Fitting, fine-tuning, and adaptation
Tune epsilon on validation accuracy and calibration; for language models exclude ignored/padding tokens correctly. Changing targets can affect distillation and confidence interpretation.
How to use and calibrate
Inspect confidence distributions and validation log loss. Example: reduce overly sharp class predictions during image or speech classification.
Example application
reduce overly sharp class predictions during image or speech classification.
Interpretation / pitfalls
Watch out
Label smoothing is not a calibrated uncertainty model. It can suppress informative probability differences; applying it indiscriminately to noisy labels does not solve label corruption.
Python and R code examples
Scope: numerical mechanism demonstration. Validation: Python executed successfully on the supplied synthetic inputs; R reviewed but not executed (Rscript unavailable).
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — numerical mechanism demonstration. · needs numpy
import numpy as np
C=3; eps=.1; y=1; q=np.full(C,eps/C); q[y]+=1-eps; p=np.array([.1,.8,.1])
print(q,-np.sum(q*np.log(p)))
Component demo, not a trained model — numerical mechanism demonstration.
C <- 3; eps <- .1; y <- 2; q <- rep(eps/C,C); q[y] <- q[y]+1-eps; p <- c(.1,.8,.1)
print(q); print(-sum(q*log(p)))
Sources
- Primary/official source 1arxiv.org
From the CodeSplash reference, entry TRN014.