liveBook · Manning

L2 norm

Also called magnitude, Euclidean norm, 2-norm

The L2 norm of a vector is its Euclidean length, calculated as the square root of the sum of the squares of its components.

How 7 Manning books explain it

Grokking Machine Learning

The L2 norm of a vector is the square root of the sum of the squared values of its components.

How it is used
Uses squared model coefficients as a complexity measure in regularization to help reduce overfitting.
How deep it goes
Defines the complexity measure, explains coefficient shrinkage, and excludes model bias from the calculation.
Examples
Uses movie recommendation coefficients and a polynomial regression exercise to illustrate complexity and ridge error.
What you can do after
Apply L2 regularization by adding a coefficient-complexity measure to regression error during training.

Read how Grokking Machine Learning explains l2 norm →

Natural Language Processing in Action, Second Edition

The L2 norm of a vector is the square root of the sum of the squares of its components.

How it is used
Supports measuring vector length, Euclidean distance, normalization, and cosine-based comparison in NLP vector spaces.
How deep it goes
Defines the formula, explains geometric consequences, and demonstrates NumPy normalization without deriving deeper linear-algebra theory.
Examples
Uses two-dimensional vector geometry, a four-element NumPy vector, TF vectors, and normalized sentence embeddings.
What you can do after
Apply it via NumPy to calculate vector lengths, normalize embeddings, and support cosine-similarity computations.

Read how Natural Language Processing in Action, Second Edition explains l2 norm →

Grokking Machine Learning, Second Edition

The L2 norm of a vector is its Euclidean length, computed as the square root of the sum of squared components.

How it is used
Balances regression accuracy against model complexity when regularizing models to reduce overfitting.
How deep it goes
Defines L2 norm through squared coefficients, excludes bias, and illustrates coefficient shrinkage without formal mathematics.
Examples
Works through two regression models’ squared-coefficient totals and assigns a ridge-error calculation exercise.
What you can do after
Apply it to calculate a ridge regression complexity term and favor small, nonzero coefficients with few features.

Read how Grokking Machine Learning, Second Edition explains l2 norm →

Rearchitecting LLMs

The L2 norm is the square root of the sum of squared vector components, measuring vector magnitude with greater emphasis on large components.

How it is used
Uses activation intensity as dynamic importance when selecting neurons for width pruning.
How deep it goes
Defines the square-root-of-squared-components calculation and reduces batch and sequence dimensions to per-neuron scores.
Examples
Compares alternating positive and negative activations with a single activation spike and evenly spread values.
What you can do after
Apply PyTorch activation norms to score MLP neurons by observed usage during calibration for width pruning.

Read how Rearchitecting LLMs explains l2 norm →

Math for Web Design

Magnitude is the scalar length or size of a vector, representing the straight-line distance it covers.

How it is used
Measures the length of a movement vector for element positioning and consistent-speed movement.
How deep it goes
Defines magnitude with a 2D formula and implements it in JavaScript, including its use in normalization.
Examples
Uses a Vector2 class with magnitude(), normalize(), and a CSS translation method.
What you can do after
Apply it via JavaScript to measure a 2D offset and normalize it for directional movement.

Read how Math for Web Design explains l2 norm →

Math and Architectures of Deep Learning

The Euclidean norm measuring a vector's length by squaring components, summing them, and taking the square root.

How it is used
Measures vector magnitude, model prediction error, and weight size used for regularization.
How deep it goes
Defines the formula, dot-product relationship, geometric meaning, normalization use, and regularization role without deriving matrix norms.
Examples
Uses error vectors across training data, right-triangle geometry, unit-vector normalization, and weight penalties.
What you can do after
Evaluate vector magnitude, interpret prediction error, normalize vectors, and understand L2 weight regularization.

Read how Math and Architectures of Deep Learning explains l2 norm →

LLM Evaluation and Alignment, The Foundational Ideas

The L2 norm is the Euclidean length of a vector, calculated as the square root of the sum of the squares of its components.

How it is used
Defines vector magnitude before contrasting Euclidean distance with cosine similarity for embedding-based semantic evaluation.
How deep it goes
Defines the square-root-of-squared-components calculation and explains why magnitude can mislead in high-dimensional embeddings.
Examples
Uses weather-related sentences and geometric vectors with different lengths but similar directions.
What you can do after
Evaluate when vector magnitude may distort semantic comparisons and understand why cosine similarity can be preferred.

Read how LLM Evaluation and Alignment, The Foundational Ideas explains l2 norm →

Also covered in

What to know first

Related concepts

Questions about l2 norm

What is l2 norm?

The L2 norm of a vector is its Euclidean length, calculated as the square root of the sum of the squares of its components.

Which Manning books explain l2 norm?

Grokking Machine Learning, Natural Language Processing in Action, Second Edition, Grokking Machine Learning, Second Edition, Rearchitecting LLMs, Math for Web Design, Math and Architectures of Deep Learning and LLM Evaluation and Alignment, The Foundational Ideas.

What should I know before learning l2 norm?

Manning books that teach l2 norm usually introduce array, embedding, inner product and language model first.

What is l2 norm also called?

L2 norm is also called magnitude, Euclidean norm or 2-norm.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.