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:
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
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