Skip to content

Training, adaptation, compression, and systems techniques · Training, fine-tuning, adaptation, compression, and systems techniques · TRN007 · Training method

Batch normalization

Normalizes intermediate activations with minibatch statistics and learns an affine transformation.

Partly runs in CodeSplash (Experimental) Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

A CodeSplash method covers part of this entry; some options or variants aren't built yet. The methods that run it are Experimental.

Do it in CodeSplash Run it on your own data. It's in the Experimental lane in the app.

Availability
Partly runs in CodeSplash (Experimental)
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.tabnet. 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

Normalizes intermediate activations with minibatch statistics and learns an affine transformation.

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

Reduction axes define batch/spatial statistics per channel; running statistics normally serve inference.

Assumptions

Training/evaluation mode changes behavior. Small, correlated, or heterogeneous batches make estimated moments unstable. Synchronization across devices is an explicit design choice.

Formula / computational definition

y=γ⊙x−μBσB2+ϵ+β.y=\gamma\odot\frac{x-\mu_B}{\sqrt{\sigma_B^2+\epsilon}}+\beta.

Parameters and notation

Learned: gamma and beta. Estimated state: running mean/variance. Hyperparameters: epsilon, running-stat momentum, axes, synchronized versus local statistics, affine option.

Fitting, fine-tuning, and adaptation

For fine-tuning, decide separately whether to update affine weights and running statistics. Freezing weights alone may still update buffers in training mode; domain recalibration must use an allowed dataset.

How to use and calibrate

Check train/eval consistency and subgroup effects under batch composition shifts. Example: adapt an image backbone to a new camera without corrupting stored normalization moments.

Example application

adapt an image backbone to a new camera without corrupting stored normalization moments.

Interpretation / pitfalls

Watch out

The original internal-covariate-shift explanation is not a universal causal account of its benefit. Validation data must not inadvertently update running statistics.

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.

Python

Component demo, not a trained model — numerical mechanism demonstration. · needs numpy

import numpy as np
X=np.array([[1.,2.],[3.,4.],[5.,8.]])
print((X-X.mean(0))/np.sqrt(X.var(0)+1e-5))
R

Component demo, not a trained model — numerical mechanism demonstration.

X <- rbind(c(1,2),c(3,4),c(5,8)); mu <- colMeans(X); centered <- sweep(X,2,mu)
print(sweep(centered,2,sqrt(colMeans(centered^2)+1e-5),"/"))

Sources

From the CodeSplash reference, entry TRN007.