Inferensys

Glossary

Singular Value Decomposition (SVD)

A matrix factorization technique that decomposes weight matrices into interpretable rank-one components, revealing the principal directions of information transformation in neural network circuits.
Overhead shot of a beautifully lit strategy meeting in a modern WeWork hot desk area, designers and executives gathered around a live AI system diagram projected on smart table surface.
MATRIX FACTORIZATION

What is Singular Value Decomposition (SVD)?

A foundational linear algebra technique that factorizes any matrix into constituent components, revealing the principal directions of variance and enabling the compression and interpretation of complex transformations.

Singular Value Decomposition (SVD) is a matrix factorization method that decomposes a matrix $W$ into three matrices: $W = U \Sigma V^T$, where $U$ and $V$ are orthogonal matrices containing left and right singular vectors, and $\Sigma$ is a diagonal matrix of non-negative singular values. This decomposition reveals the fundamental geometric structure of the linear transformation, identifying the orthogonal axes of maximum stretching.

In transformer mechanistic analysis, SVD is applied to weight matrices—specifically the OV (Output-Value) circuit and QK (Query-Key) circuit—to decompose them into a sum of rank-one components. Each rank-one component represents an independent information pathway, allowing researchers to isolate and interpret the principal semantic directions along which an attention head reads from and writes to the residual stream.

MATRIX DECOMPOSITION

Key Properties of SVD for Circuit Analysis

Singular Value Decomposition (SVD) factorizes a weight matrix into interpretable rank-one components, revealing the principal directions of information transformation in transformer circuits.

01

Decomposing OV and QK Circuits

SVD factorizes a weight matrix W into UΣVᵀ. In the OV circuit (W_O W_V), the right singular vectors (columns of V) represent the directions in the residual stream that the head reads from, while the left singular vectors (columns of U) represent the directions it writes to. The singular values in Σ quantify the strength of each read-write pair. For QK circuits (W_Qᵀ W_K), SVD reveals the principal query-key directions that dominate attention score computation.

02

Identifying Principal Semantic Axes

The top singular vectors of an attention head's OV matrix often correspond to interpretable semantic operations:

  • Copying behavior: A head that copies token information will have a dominant singular vector aligned with the identity-like mapping in the residual stream.
  • Inhibition: Negative singular values (or vectors with opposing signs) can reveal how a head suppresses specific token representations.
  • Concept subspaces: The span of the top-k singular vectors defines the low-dimensional subspace in which the head performs its primary function, filtering out noise.
03

Rank Analysis and Head Specialization

The effective rank of a weight matrix—the number of singular values above a noise threshold—indicates how many independent read-write operations an attention head performs:

  • Rank-1 heads: Often correspond to simple copying or primitive operations. Induction heads frequently exhibit near rank-1 OV matrices.
  • High-rank heads: Perform more complex, compositional transformations, potentially multiplexing multiple functions.
  • Singular value decay: A sharp drop-off after the first few singular values suggests the head's behavior is dominated by a small number of principal directions, making it amenable to mechanistic interpretation.
04

SVD for Weight Matrix Editing

SVD enables precise surgical interventions on model weights:

  • Rank-one updates: The ROME (Rank-One Model Editing) technique uses SVD to insert new factual associations into MLP layers by adding a rank-one matrix to W_proj, modifying only the singular vectors associated with the target knowledge.
  • Pruning: Zeroing out small singular values compresses the matrix while preserving its dominant behavior, useful for removing redundant or noisy components.
  • Subspace projection: Projecting activations onto or away from specific singular vector subspaces allows causal testing of whether a particular direction is necessary for a behavior.
05

Comparing Heads via Singular Vector Alignment

The canonical correlation or subspace alignment between the singular vectors of different attention heads quantifies functional similarity:

  • Heads with highly aligned top singular vectors likely perform redundant or synergistic operations.
  • Orthogonal singular vector subspaces indicate heads that specialize in distinct, non-interfering functions.
  • This alignment metric is used in circuit discovery to cluster heads into functional groups and identify the minimal set of heads required for a specific task.
06

SVD of the Embedding and Unembedding Matrices

Applying SVD to the embedding matrix W_E and unembedding matrix W_U reveals the principal semantic axes of the token vocabulary:

  • The singular vectors of W_E define the directions along which token semantics vary most significantly.
  • The Logit Lens technique effectively projects intermediate residual stream states onto the singular vectors of W_U to interpret the model's evolving predictions.
  • The alignment between W_E and W_U singular vectors (often tied via weight tying) shows how the model maps input semantics to output logits through a shared representational space.
MECHANISTIC ANALYSIS

Frequently Asked Questions

Core questions about applying matrix factorization to decode the principal directions of information flow in transformer weight matrices.

Singular Value Decomposition (SVD) is a matrix factorization technique that decomposes a weight matrix ( W ) into three matrices—( U ), ( \Sigma ), and ( V^T )—such that ( W = U \Sigma V^T ). In mechanistic interpretability, this decomposition reveals the principal directions of information transformation within a neural network layer. The left singular vectors (columns of ( U )) form an orthonormal basis for the output space, the right singular vectors (rows of ( V^T )) form an orthonormal basis for the input space, and the diagonal matrix ( \Sigma ) contains the singular values ( \sigma_i ), which quantify the strength or importance of each corresponding rank-one component. By analyzing the top singular vectors, researchers can identify the dominant linear transformations performed by OV circuits (output-value pathways) and QK circuits (query-key pathways) in transformer attention heads, effectively separating a complex weight matrix into a sum of interpretable, independent operations.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.