Inferensys

Glossary

OV Circuit

The computational pathway formed by the output and value projection matrices that determines what information an attention head copies from the source token to the destination token.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
TRANSFORMER MECHANISTIC ANALYSIS

What is an OV Circuit?

The OV circuit is the computational pathway in a transformer attention head that determines what information is copied from a source token to the destination token's residual stream.

An OV circuit is the functional subgraph formed by the output (O) and value (V) projection matrices within a transformer attention head. While the QK circuit determines which tokens to attend to, the OV circuit determines what information is read from the source token's residual stream and written into the destination token's representation. The V matrix projects the source token's residual stream state into a value vector, and the O matrix transforms the weighted sum of these value vectors into the output that gets added back to the destination token's residual stream.

Mechanistic interpretability research reveals that OV circuits often encode copying behavior—the V matrix reads specific subspaces of the source token's representation, and the O matrix writes that information into corresponding subspaces of the destination token. In induction heads, the OV circuit copies the token immediately following a previous occurrence, enabling in-context learning. The effective transformation is the low-rank product W_O W_V, which can be analyzed via singular value decomposition (SVD) to identify the principal semantic directions being read and written across token positions.

OUTPUT-VALUE PATHWAY

Key Characteristics of the OV Circuit

The OV circuit is the computational pathway formed by the Output (W_O) and Value (W_V) projection matrices. It determines what information an attention head copies from the source token to the destination token, effectively acting as the read-out mechanism for the transformer's memory.

01

The Copying Mechanism

The OV circuit's primary function is to transform the source token's residual stream into a format suitable for addition to the destination token. It dictates the semantic content of the information transfer.

  • W_V projects the source token's representation into a value vector.
  • W_O projects the weighted sum of value vectors back into the residual stream dimension.
  • The composition W_O W_V defines the head's vocabulary of writable outputs.
02

Eigenvalue Analysis of W_O W_V

Performing Singular Value Decomposition (SVD) on the OV circuit matrix reveals the principal directions of information transfer. The top singular vectors often correspond to interpretable semantic transformations.

  • High singular values indicate dominant copying behaviors.
  • Low singular values suppress irrelevant information.
  • This decomposition is central to identifying induction heads and their copying patterns.
03

OV Circuit vs. QK Circuit

The attention head's behavior is fully described by the interaction of two independent circuits:

  • QK Circuit: Determines where to attend. It computes the attention pattern using query and key projections.
  • OV Circuit: Determines what to write. It computes the content to be moved from source to destination.

A head can attend broadly (QK) but write a very specific token (OV), or vice versa.

04

Logit Attribution with the OV Circuit

The direct effect of an attention head on the output logits can be computed by applying the unembedding matrix directly to the OV output. This is called direct logit attribution.

  • Formula: logit_effect = W_U @ W_O @ v
  • This isolates the head's contribution to the final token prediction.
  • It reveals if a head promotes or suppresses specific tokens, such as copying the next token in an induction head.
05

Path Patching the OV Circuit

Activation patching isolates the OV circuit's causal role. By replacing the value vectors from a corrupted run with clean values, researchers can measure the circuit's specific contribution.

  • Patching only the OV output proves sufficiency.
  • This technique validates that the OV circuit is the minimal pathway for a specific behavior.
  • It distinguishes the OV circuit's role from the MLP layers' contributions.
06

Interaction with the Residual Stream

The OV circuit writes its output directly into the residual stream of the destination token. This additive update is the mechanism by which information is moved between token positions.

  • The residual stream accumulates OV outputs from all heads.
  • Each head's OV circuit operates independently in a sum of components.
  • The dimensionality of W_O matches the residual stream, ensuring seamless addition.
OV CIRCUIT DEEP DIVE

Frequently Asked Questions

Explore the most common questions about the Output-Value circuit, the computational pathway that determines what information an attention head copies from a source token to a destination token in transformer architectures.

An OV circuit is the computational pathway formed by the output (W_O) and value (W_V) projection matrices in a transformer attention head that determines what information gets copied from a source token to a destination token. The mechanism operates in two stages: first, the value matrix W_V projects each token's residual stream representation into a value vector that encodes the information available for copying. Second, after the attention pattern (determined by the QK circuit) computes a weighted average of these value vectors, the output matrix W_O projects the result back into the residual stream dimensionality. Crucially, the OV circuit can be understood as a linear transformation applied to the source token's representation—the effective OV matrix W_O * W_V defines a function that reads from the residual stream at the attended-to position and writes a transformed version to the attended-from position. This pathway is what allows attention heads to perform operations like copying names, moving grammatical features, or suppressing irrelevant information.

ATTENTION SUB-CIRCUITS

OV Circuit vs. QK Circuit

A comparison of the two primary computational pathways within a transformer attention head that govern information movement and attention pattern formation.

FeatureOV CircuitQK Circuit

Primary Function

Determines what information is copied from the source token to the destination token

Determines which previous tokens the head attends to by computing attention scores

Weight Matrices Involved

Output projection (W_O) and Value projection (W_V)

Query projection (W_Q) and Key projection (W_K)

Computational Role

Transforms and writes information into the residual stream

Computes pairwise dot-product similarity for attention distribution

Interaction Target

Residual stream of the destination token

Residual stream of the source token

Output

A vector added to the destination token's residual stream

A probability distribution over source tokens

Interpretability Focus

What semantic content is moved

Which token positions are relevant

Causal Intervention Effect

Ablation prevents specific information from being copied

Ablation prevents the head from focusing on specific positions

Matrix Decomposition

SVD reveals low-rank subspaces for copying specific features

SVD reveals principal directions of query-key matching

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.