Skip to main content
QUICK REVIEW

[Paper Review] Circuit Mechanisms for Spatial Relation Generation in Diffusion Transformers

BinXu Wang, Jingxuan Fan|arXiv (Cornell University)|Jan 9, 2026
Generative Adversarial Networks and Image SynthesisComputer Science0 citations
TL;DR

The paper investigates how Diffusion Transformers generate spatial relations between objects, revealing two distinct circuits depending on text encoder (random embeddings vs. T5), and demonstrates causal, interpretableHead-level mechanisms governing relation and object generation.

ABSTRACT

Diffusion Transformers (DiTs) have greatly advanced text-to-image generation, but models still struggle to generate the correct spatial relations between objects as specified in the text prompt. In this study, we adopt a mechanistic interpretability approach to investigate how a DiT can generate correct spatial relations between objects. We train, from scratch, DiTs of different sizes with different text encoders to learn to generate images containing two objects whose attributes and spatial relations are specified in the text prompt. We find that, although all the models can learn this task to near-perfect accuracy, the underlying mechanisms differ drastically depending on the choice of text encoder. When using random text embeddings, we find that the spatial-relation information is passed to image tokens through a two-stage circuit, involving two cross-attention heads that separately read the spatial relation and single-object attributes in the text prompt. When using a pretrained text encoder (T5), we find that the DiT uses a different circuit that leverages information fusion in the text tokens, reading spatial-relation and single-object information together from a single text token. We further show that, although the in-domain performance is similar for the two settings, their robustness to out-of-domain perturbations differs, potentially suggesting the difficulty of generating correct relations in real-world scenarios.

Motivation & Objective

  • Understand how diffusion-based text-to-image models generate spatial relations between multiple objects.
  • Identify circuits and heads responsible for translating text relations into image layouts.
  • Compare mechanisms when using random text embeddings versus a pretrained text encoder (T5).
  • Assess robustness of the learned circuits to out-of-domain perturbations.

Proposed method

  • Train from scratch Diffusion Transformer models with varying sizes on a minimal two-object spatial relation task.
  • Compare three text encoders: random embeddings (RTE), RTE without positional encoding, and a pretrained T5 encoder.
  • Develop Attention Synopsis to summarize cross-attention patterns across layers, heads, and time steps.
  • Perform ablations and causal manipulations on identified heads to establish their roles.
  • Analyze how T5-based models integrate relational information into object tokens via embedding space manipulations.
Figure 1 : Schematics of the model and task . Our T2I model architecture adopted the design of PixArt [ 5 ] . There are three main components: the text encoder that processes tokenized natural language prompts into text embeddings, the VAE that processes image inputs into image tokens, and the Diffu
Figure 1 : Schematics of the model and task . Our T2I model architecture adopted the design of PixArt [ 5 ] . There are three main components: the text encoder that processes tokenized natural language prompts into text embeddings, the VAE that processes image inputs into image tokens, and the Diffu

Experimental results

Research questions

  • RQ1What circuits or heads implement spatial relation generation in Diffusion Transformers?
  • RQ2How does the choice of text encoder affect the internal mechanisms for relation generation?
  • RQ3Are the relation-generation mechanisms robust to perturbations in the prompt?
  • RQ4Can causal interventions demonstrate the necessity of identified heads for accurate spatial layouts?
  • RQ5How do RTE-based and T5-based DiTs differ in interpretability and generalization?

Key findings

  • RTE-based DiTs use a two-stage circuit with a spatial relation head and an object-generation head to place objects accurately.
  • The spatial relation head (L2H8) creates spatial gradients via a QK-inspired circuit that binds relation words to image regions.
  • The object-generation head (L4H3) links object shapes to their tagged locations, and ablating these heads disrupts corresponding aspects of generation.
  • A VO (visual-embedding) injection from the relation head into the object head is sufficient to induce correct object placement, showing causal linkage.
  • T5-based DiTs encode relational information in contextual shape tokens, enabling generation from a single token but reducing disentanglement and prompt robustness.
  • Attention Synopsis reveals clear, separable circuits in RTE-based models, while T5-based models rely on embedded relational cues within object tokens, leading to different interpretability and robustness profiles.
Figure 2 : Training dynamics of the T2I models (DiT-B) . A) and B) Both models trained with random token embedding and T5 can achieve good accuracy on the task. Solid lines shows the result of model using exponential moving averaged ( ema ) weights, while dashed line shows the non-averaged weights.
Figure 2 : Training dynamics of the T2I models (DiT-B) . A) and B) Both models trained with random token embedding and T5 can achieve good accuracy on the task. Solid lines shows the result of model using exponential moving averaged ( ema ) weights, while dashed line shows the non-averaged weights.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.