Mechanisms of Projective Composition of Diffusion Models

Arwen Bradley, Preetum Nakkiran, David Berthelot, James Thornton, Joshua M. Susskind · OpenReview

Abstract

We study the theoretical foundations of composition in diffusion models, with a particular focus on out-of-distribution extrapolation and length-generalization. Prior work has shown that composing distributions via linear score combination can achieve promising results, including length-generalization in some cases. However, our theoretical understanding of how and why such compositions work remains incomplete. In fact, it is not even entirely clear what it means for composition to "work". This paper starts to address these fundamental gaps. We begin by precisely defining one possible desired result of composition, which we call projective composition. Then, we investigate: (1) when linear score combinations provably achieve projective composition, (2) whether reverse-diffusion sampling can generate the desired composition, and (3) the conditions under which composition fails. We connect our theoretical analysis to prior empirical observations where composition has either worked or failed, for reasons that were unclear at the time. Finally, we propose a simple heuristic to help predict the success or failure of new compositions.

Introduction

In generative AI, a primary goal is the ability to "mix and match" learned concepts. For instance, a user might wish to combine a model fine-tuned on a specific pet with another model trained on artistic styles to produce an "oil painting of my dog." While practitioners have observed that adding the "scores" (gradients of the log-probability) of different models often yields successful results, the theoretical underpinnings of this phenomenon have remained largely unexplored.

Conceptual overview of composition: combining a specific subject with an artistic style.

This research addresses two central mysteries in diffusion model composition:

  1. Out-of-Distribution (OOD) Generation: How can models trained exclusively on single objects combine to create images with multiple objects (length-generalization) that were never seen during training?
  2. Success vs. Failure: Why does composing certain concepts, like a specific dog and an oil painting style, work seamlessly, while others, like "Dog + Horse," result in incoherent outputs?

Theoretical Framework: Projective Composition

We introduce a formal definition for successful composition termed Projective Composition. A composed distribution is considered successful if, when viewed through the "lens" of a specific feature (such as style or a spatial coordinate), it matches the original model's intent for that feature.

To achieve this, we propose the Factorized Conditionals (FC) criterion. This criterion requires that:

  • Each model $p_i$ is "active" on a disjoint set of coordinates or features.
  • Outside of its active region, the model matches a common "background" distribution $p_b$.
  • Features are independent under the background distribution.

We prove that if these conditions are met, a linear combination of scores—the Composition Operator—provably results in a correct projective composition. Furthermore, we demonstrate Feature-space Composition: if there exists an invertible mapping to a space where these conditions hold, composing in the raw pixel space will still be effective, even if the mapping itself is unknown.

Experimental Methodology

We utilized controlled synthetic environments to isolate the mechanisms of composition:

  • CLEVR: A diagnostic dataset for visual reasoning. We created custom variants including a "background" set (zero objects), a single-object set, and a multi-object set (1-5 objects).
  • SDXL (Stable Diffusion XL): Employed for high-fidelity qualitative testing, such as composing specific subjects with diverse artistic styles.
  • CLIP Embeddings: Used to validate a practical heuristic for predicting composition success by measuring the orthogonality of text-based concepts.

Key Insights and Results

The Critical Role of Background

A significant finding is that the choice of the background distribution ($p_b$) is paramount. While prior works often utilized the unconditional distribution (Bayes composition), we show this frequently fails for length-generalization. Utilizing an "empty" or "cluttered" background that satisfies the FC criterion is significantly more effective.

Empirical validation of composition success across different background distributions and object counts.

Orthogonality and Entanglement

Composition succeeds when the "concept-space" vectors are orthogonal. If two concepts attempt to control the same features (e.g., two different animals attempting to occupy the same subject position), they become "entangled," leading to failure. We found that high cosine similarity between CLIP embeddings (e.g., "Dog" and "Cat") accurately predicts composition failure, while low similarity (e.g., "Dog" and "Hat") predicts success.

Length-Generalization

Models trained only on single objects were successfully composed to generate images containing up to nine objects in specified locations, provided the background was handled according to our theoretical framework. This demonstrates that length-generalization is a natural byproduct of correct projective composition.

Discussion and Limitations

While our theory provides a robust foundation, it assumes "perfect" score models and does not fully account for neural network approximation errors. The Factorized Conditionals assumption, while holding approximately in many scenarios, can be violated by real-world dependencies like shadows or occlusions. Future research will focus on developing samplers for non-orthogonal compositions and investigating how models can be explicitly trained to satisfy the FC criterion to enhance their inherent composability.

Summary updated

Abstract

We study the theoretical foundations of composition in diffusion models, with a particular focus on out-of-distribution extrapolation and length-generalization. Prior work has shown that composing distributions via linear score combination can achieve promising results, including length-generalization in some cases (Du et al., 2023; Liu et al., 2022). However, our theoretical understanding of how and why such compositions work remains incomplete. In fact, it is not even entirely clear what it means for composition to "work". This paper starts to address these fundamental gaps. We begin by precisely defining one possible desired result of composition, which we call projective composition. Then, we investigate: (1) when linear score combinations provably achieve projective composition, (2) whether reverse-diffusion sampling can generate the desired composition, and (3) the conditions under which composition fails. We connect our theoretical analysis to prior empirical observations where composition has either worked or failed, for reasons that were unclear at the time. Finally, we propose a simple heuristic to help predict the success or failure of new compositions.
BibTeX
@inproceedings{bradley2025mechanisms,
  author = {Arwen Bradley and Preetum Nakkiran and David Berthelot and James Thornton and Joshua M. Susskind},
  title = {{Mechanisms of Projective Composition of Diffusion Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=QV0PcBbfTd},
}
Figure