Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Zai org CogVideo Activation Normalization

From Leeroopedia


Knowledge Sources
Domains Normalization, Normalizing_Flows
Last Updated 2026-02-10 00:00 GMT

Overview

Activation normalization (ActNorm) is an invertible per-channel affine transformation layer with data-dependent initialization that normalizes activations without dependence on mini-batch statistics at inference time.

Description

ActNorm was introduced as a replacement for Batch Normalization in flow-based generative models, where the requirement for invertibility precludes the use of operations that depend on batch statistics. Unlike BatchNorm, which normalizes using running mean and variance computed across the batch dimension, ActNorm learns fixed per-channel scale and bias parameters that are initialized once from the first training mini-batch and then optimized as regular parameters.

The initialization procedure ensures that, after the first forward pass, activations have approximately zero mean and unit variance per channel. This data-dependent initialization addresses the training instability that can occur with randomly initialized scale and bias, particularly in deep networks where poor initialization can lead to vanishing or exploding activations.

Key properties that distinguish ActNorm from BatchNorm:

  • No batch dependence at inference: The transformation is identical regardless of batch size, making it suitable for single-sample inference.
  • Invertibility: The transformation y=s(x+b) can be exactly inverted as x=y/sb, which is essential for normalizing flows.
  • Tractable Jacobian: The log-determinant of the Jacobian is analytically computable, enabling exact likelihood evaluation in flow models.

Usage

Use ActNorm in any architecture that requires:

  • Normalization without batch-size dependence (e.g., single-sample inference)
  • Invertible normalization for normalizing flow models
  • A drop-in replacement for BatchNorm in discriminator networks when batch statistics are unreliable (e.g., with very small batches)

Theoretical Basis

The ActNorm layer implements a per-channel affine transformation. Given input xB×C×H×W, the forward pass computes:

yc=sc(xc+bc)

where sc and bc are learnable per-channel scale and bias parameters (broadcast over spatial dimensions).

Data-dependent initialization: Given the first mini-batch x(0), the parameters are set as:

bc=μc(x(0)),sc=1σc(x(0))+ϵ

where μc and σc are the mean and standard deviation of channel c computed over all batch and spatial dimensions.

Log-determinant of the Jacobian: For flow-based models, the change-of-variables formula requires the log-determinant:

log|det(yx)|=HWc=1Clog|sc|

This follows because the Jacobian is a diagonal matrix with entries sc repeated H×W times per channel. The log-determinant is thus O(C) to compute, which is essential for efficient training of normalizing flows.

Inverse transformation: The reverse pass computes:

xc=ycscbc

This exact invertibility, combined with the tractable Jacobian, makes ActNorm a fundamental building block in architectures like Glow and other invertible neural networks.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment