Mechanisms of Projective Composition of Diffusion Models

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

TL;DR

This paper provides a rigorous theoretical foundation for composing pretrained diffusion models at inference time via linear score combinations. By introducing the concept of projective composition, the authors explain how diffusion models can achieve out-of-distribution extrapolation and length-generalization, while highlighting the crucial, often overlooked role of the background distribution.

What Problem Does This Paper Address?

A major appeal of diffusion models is the ability to compose different concepts (e.g., combining a specific object with a specific artistic style, or placing multiple objects in a single scene) at inference time without retraining. This is typically done by linearly combining the score outputs of multiple models.

Empirically, this works surprisingly well, even enabling length-generalization—for instance, taking a model trained only on single-object images and using it to generate scenes with multiple objects. However, a formal mathematical understanding of why or how this works has been missing. Existing formulations, like the "simple product" or "Bayes composition," fail theoretically because they mathematically restrict the output distribution to the support of the individual models, making true out-of-distribution (OOD) generation impossible.

This paper bridges the gap between theory and practice by formalizing what it means for a composition to "work" and defining the exact conditions required for success.

Methods

The authors introduce three key theoretical components:

  1. Projective Composition: Instead of defining a composition by how it is constructed, the authors define it by its properties. A distribution is a valid projective composition if, when projected onto specific feature spaces or coordinate subsets, its marginal distributions match those of the individual component models.
  2. Factorized Conditionals (FC): The authors prove that linear score combination successfully yields a projective composition if the component distributions are independent along disjoint subsets of coordinates (masks) and match a common reference distribution—the background distribution ($p_b$)—everywhere else.
  3. Feature-Space Composition: Real-world concepts (like "oil painting style") aren't cleanly separated by pixel coordinates. The authors extend their theory to non-linear feature spaces via invertible transforms (diffeomorphisms). They prove that the score composition operator is reparameterization-equivariant, meaning that composing scores in pixel space automatically achieves the correct composition in an underlying latent feature space.
  4. CLIP-Based Orthogonality Heuristic: To make the theory practical, the authors propose a simple heuristic: checking the orthogonality of mean difference vectors of concepts within CLIP space to predict whether two concepts will successfully compose.

Datasets

The authors evaluated their framework using:

  • Custom CLEVR Datasets: Generated using the CLEVR dataset procedure to create controlled environments containing 0 objects (empty background), 1 object (at specific 2D locations or with specific colors), and cluttered scenes containing 1 to 5 objects. Images were downsampled to $128 \times 128$ pixels.
  • SDXL (Stable Diffusion XL): Used to demonstrate style and content composition by combining a base SDXL model conditioned on style prompts with an SDXL model fine-tuned on a specific subject (the author's dog).

Key Insights and Ideas

  • The Background Matters: A common practice in prior work was using an unconditional model as the baseline subtraction term in the score combination formula. The authors show that this "Bayes composition" approach fails for length-generalization. Instead, using an explicit empty background model or a properly matched reference distribution is vital for isolating the "score delta" of each concept.
  • Distribution vs. Sampling Disconnect: A fascinating mathematical nuance uncovered is that even if a perfect projective composition exists at time $t=0$ in a latent feature space, standard reverse-diffusion sampling might still fail. If the feature transformation is non-orthogonal, the forward diffusion process distorts the features, making the sampling trajectory highly non-smooth and causing standard samplers to fail.
  • Concept Orthogonality: Concepts that control entirely different attributes (e.g., "dog" vs. "red hat") exhibit high orthogonality in feature space and compose easily. Concepts that compete for the same semantic features (e.g., "dog" vs. "horse") are entangled and fail to compose.

Key Results

  • Length-Generalization: When composing single-object models using an empty background (satisfying the FC condition), the model successfully generated up to 6+ objects in specified locations—a setting entirely out-of-distribution for the training data. Conversely, using an unconditional background (Bayes composition) completely failed, often producing zero objects.
Figure 3: Attempted compositional length-generalization up to 9 objects. We attempt to compose via linear score combination the distributions p1 through p9 shown on the far left, where each pi is conditioned on a specific object location as described below. Settings (A) and (C) approximately satisfy the conditions of our theory of projective composition, and thus are expected to length-generalize at least somewhat, while setting (B) does not even approximately satisfy our conditions and indeed fails to length-generalize. Experiment (A): In this experiment, the distributions pi each contain a single object at a fixed location, and the background pb is empty. In this case any successful composition of more than one object represents length-generalization. We find that composition succeeds up to several objects, but then degrades as number of objects increases (see Section 5.3 for details). Experiment (B): Here the distributions pi are identical to (A), but the background pb is chosen as the unconditional distribution (i.e. a single object at a random location)— this the “Bayes composition” (Section 3). This composition entirely fails— remarkably, trying to compose many objects often produces no objects! Experiment (C): Here each distribution pi contains an object at a fixed location i, and 0-4 other objects (sampled uniformly) in random locations. The background distribution pb is a distribution of 1-5 objects (sampled uniformly) in random locations. In this case length-generalization means composition of more than 5 objects. This composition can length-generalize, but artifacts appear for large numbers of objects. See Section 5.3 for further discussion, and Table 1 for a quantitative analysis. In Section L we explore another configuration that improves length-generalization quality.
  • Color Composition Constraints: In experiments combining object colors, yellow objects successfully composed with blue, cyan, and magenta objects, but failed with red or green. The theory perfectly predicted this: in RGB space, yellow shares red and green channels with a gray background, leaving only the blue channel orthogonal and available for clean composition.
Figure 5: Composing yellow objects with objects of other colors. Yellow objects successfully compose with blue, cyan and magenta objects but not with brown, gray, green, or red objects. Per the histograms (left), in RGB-colorspace yellow has R, G distributed like the background (gray) while B has a distinct distribution peaked closer to zero. Taking Myellow ≈{B}, Theorem 5.3 predicts that standard dif- fusion can sample from compositions of yellow with any color where the B channel is distributed like the background: namely, blue, cyan, magenta per the histograms. (Other col- ors may theoretically compose per Theorem 6.1, but be difficult to sample.) (Additional samples in Figure 11.)
  • Real-World Style Transfer: The authors successfully generated high-quality images blending the specific identity of a dog with a Van Gogh style using SDXL score composition, validating the feature-space theory.
Figure 1: Composing diffusion models via score combina- tion. Given two diffusion models, it is sometimes possible to sample in a way that composes content from one model (e.g. your dog) with style of another model (e.g. oil paintings). We aim to theoretically understand this empirical behavior. Figure generated via score composition with SDXL fine- tuned on the author’s dog; details in Appendix C.

Limitations and Future Work

  • Strict Factorization Assumptions: The theoretical proofs rely on exact independence or perfect factorization, which rarely holds perfectly in complex, real-world image distributions where objects cast shadows or occlude one another.
  • Sampling Difficulties: While the paper proves that composition works well in orthogonal feature spaces, it shows that standard diffusion samplers struggle when features are non-orthogonal. Developing advanced samplers or finding perfectly disentangled latent spaces remains an open challenge for future work.

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