---
title: "L2 Regularization and Batch Norm"
description: "In a convolutional net where layers feed into batch normalization, an L2 penalty (weight decay) no longer regularizes those layers, because batch norm makes the output invariant to weight scale."
url: "https://swe.quest/articles/l2-regularization-and-batch-norm-1d8a06d41ed48cf7"
canonical: "https://blog.janestreet.com/l2-regularization-and-batch-norm/"
source: "Jane Street Tech Blog"
published: "2019-01-29"
difficulty: "hard"
kind: "Research"
reading_minutes: 16
tags: ["model-training","machine-learning"]
---

# L2 Regularization and Batch Norm

A post on [Jane Street Tech Blog](https://swe.quest/sources/jane-street.md), published 2019-01-29, 16 min read, Research. Original: [https://blog.janestreet.com/l2-regularization-and-batch-norm/](https://blog.janestreet.com/l2-regularization-and-batch-norm/)

## Summary

In a convolutional net where layers feed into batch normalization, an L2 penalty (weight decay) no longer regularizes those layers, because batch norm makes the output invariant to weight scale. Instead, weight decay controls the effective learning rate: gradients scale as 1/α when weights scale by α, so the effective step size relative to the weights scales as 1/α². Without decay, weights grow through random-walk drift and the effective learning rate collapses. A ResNet-20 CIFAR-10 experiment in TensorFlow supports this. Removing L2 from the conv layers dropped accuracy from about 91% to 89.5%, with weight-norm growth and shrinking relative step sizes, and adjusting per-layer learning rates can replicate the effect of weight decay.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Model training](https://swe.quest/tags/model-training.md) (AI & ML)
- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)

## Prerequisites

- stochastic gradient descent
- batch normalization
- L2 regularization
- convolutional neural networks ([easy posts on Machine learning](https://swe.quest/tags/machine-learning.md?difficulty=easy))

## Keywords

batch normalization, weight decay, L2 regularization, ResNet-20, CIFAR-10, TensorFlow

## Related posts

- [Towards demystifying the creativity of diffusion models](https://swe.quest/articles/towards-demystifying-the-creativity-of-diffusion-models-b65392995a4ab4c2.md): Google Research · 2026-07-15 · Hard · 7 min read · Machine learning, Model training
  Diffusion models generalize beyond their training data because neural networks learn a smoothed version of the score function rather than the exact empirical one, which would only reproduce training samples.
- [A study of sequence weighting at scale](https://swe.quest/articles/a-study-of-sequence-weighting-at-scale-de592286785581cb.md): Jane Street Tech Blog · 2026-09-14 · Hard · 9 min read · Model training, LLMs, Machine learning
  How strongly a language model's per-sequence loss reduction tracks that sequence's training weight changes non-monotonically with scale, as measured by a fitted effective sequence weight exponent p\*.
- [Supercharging transformer residual connections](https://swe.quest/articles/supercharging-transformer-residual-connections-cfa196a28b957618.md): Google Research · 2026-11-23 · Hard · 7 min read · LLMs, Model training, Machine learning
  DeepCrossAttention (DCA) replaces the fixed point-wise summation of transformer residual connections with learned, per-token routing over all preceding layer outputs.
- [Fixing Gradient Accumulation](https://swe.quest/articles/fixing-gradient-accumulation-48a9d96c28c11b53.md): Hugging Face · 2024-10-16 · Medium · 4 min read · Model training, Python, Debugging
  Gradient accumulation in the transformers Trainer did not match full-batch training because the default model loss averaged per-batch cross-entropy instead of summing token losses across all accumulated batches and dividing by the total count of non-padding tokens.
- [Beyond LoRA: Can you beat the most popular fine-tuning technique?](https://swe.quest/articles/beyond-lora-can-you-beat-the-most-popular-fine-tuning-technique-ce7bf6b22fef0efd.md): Hugging Face · 2026-06-18 · Medium · 13 min read · Model training, LLMs, Evaluation
  LoRA accounts for roughly 95–98% of PEFT usage across Hugging Face Hub model cards and image-generation checkpoints, but controlled benchmarks in the PEFT library show it is often not the best tradeoff.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
