NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Interpretable Diffusion Models with B-cos Networks

Nicola Bernold, Moritz Vandenhirtz, Alice Bizeul, Julia E. Vogt

TL;DR

This paper introduces a novel architecture for text-to-image diffusion models that integrates "B-cos networks" to provide inherent interpretability. This allows us to understand which parts of a text prompt influence specific regions of the generated image, helping to identify and potentially fix alignment failures.

What Problem Does This Paper Address?

Text-to-image diffusion models have become incredibly powerful, generating stunning visuals from textual descriptions. However, a major challenge is understanding why a model generates a particular image and whether it truly reflects the nuances of the prompt. Often, these models fail to capture all semantic details, leading to subtle but significant misinterpretations. Diagnosing these failures is difficult because current explanation methods are often "post-hoc" (applied after generation) and may not faithfully represent the model's internal workings. This makes it hard for users to adjust prompts effectively and for researchers to debug models. The paper aims to solve this by building interpretability directly into the diffusion model's architecture.

Methods

The core innovation is the integration of B-cos networks into the U-Net backbone of diffusion models. B-cos networks are designed to be drop-in replacements for standard neural network layers. Their key property is that they can be summarized by a single dynamic linear transformation, allowing for direct visualization of input-weight alignment. This means that if a B-cos layer's output is significant, its weights are aligned with the input, providing a direct link between input features and output.

The authors adapt this for diffusion models by:

  • Replacing standard layers with B-cos counterparts: This is done throughout the U-Net, the core component of diffusion models responsible for denoising.
  • Handling multiple inputs: Diffusion models take noisy images, text prompts, and timestep information. B-cos explanations are typically designed for single inputs. The authors address this by treating other inputs as biases, which is a known limitation but empirically shown to still yield good explanations.
  • Modifying cross-attention: Cross-attention is crucial for conditioning diffusion models on text. They integrate B-cos layers into the cross-attention mechanism to align conditioning with weights.
  • Custom input/target encoding: To ensure the B-cos summary captures more of the computation, they use a specific 6-channel encoding for images (RGB and their complements) and train the model to predict the original image ($x_0$) rather than the noise ($ \epsilon $).
  • Deterministic sampling (DDIM with $\sigma_t=0$): This is used during inference to avoid introducing additional noise, ensuring the B-cos summary can capture more of the model's computations.

The output of this B-cosified model is a "model summary" ($W(x)$) which, when combined with the prompt, can reconstruct an approximation of the generated image. This reconstruction, when normalized, closely matches the actual generated image, validating the faithfulness of the B-cos summary. Furthermore, they derive a "relevance score" for each prompt token, indicating its influence on the generated image.

Datasets

  • LAION-2B-en-aesthetics: A subset of this dataset was used for training. The authors specifically selected 20,000 image-caption pairs for five objects (banana, cat, goat, flamingo, penguin) based on high similarity scores to ensure strong prompt-image alignment.
  • LAION-2B-en-aesthetics (for evaluation): Used for quantitative evaluation via FID scores.

The paper does not introduce new benchmarks but uses existing datasets for training and evaluation.

Key Insights and Ideas

  • Inherent interpretability is achievable in diffusion models: By replacing standard layers with B-cos networks, it's possible to build models that offer faithful, sample-specific explanations without relying on post-hoc methods.
  • Token-level attributions reveal prompt influence: The B-cos framework allows us to pinpoint which words in a prompt are most responsible for specific visual features in the generated image. This is a significant step beyond just knowing if the overall prompt is aligned.
  • Identifying failure cases is straightforward: The relevance scores directly highlight when a prompt token has negligible influence on the output, even if it's a key concept (e.g., "shark" in a prompt that doesn't generate a shark). This is a more transparent alternative to existing CLIP-based scores.
  • Predicting $x_0$ is better for interpretability: Training the model to predict the original image ($x_0$) rather than the noise ($ \epsilon $) leads to better denoising capabilities and more faithful explanations, despite potential challenges with bias handling.
  • Padding tokens can dominate explanations: In models that use padding for fixed-length inputs (like CLIP embeddings), padding tokens can receive significant relevance scores, potentially obscuring the influence of actual prompt tokens.

Key Results

  • Generative Quality: The B-cos diffusion models can generate high-quality images, comparable to vanilla diffusion models, though some configurations (like B-cos Clip eps) were qualitatively better than others (predicting $x_0$). FID scores were in a similar range for vanilla and some B-cos models, with others showing a significant drop (e.g., B-cos Clip eps at 50.54 vs. Vanilla at 21.18).
  • Interpretability: Reconstructions from the B-cos model summary closely matched the generated images (MSE of 0.0045 for a sample), demonstrating the faithfulness of the explanations.
  • Token Relevance: Semantically meaningful tokens (e.g., "muffins," "flamingo") consistently received higher relevance scores than less meaningful ones (e.g., "a," "stock"), supporting the global faithfulness of the explanations.
  • Failure Case Identification: The method successfully identified a prompt ("a penguin with green hat") where the model failed to generate a shark, with the "shark" token receiving a negligible relevance score (0.18%).

Limitations and Future Work

  • Generative Performance Trade-off: The paper acknowledges that integrating B-cos networks currently leads to reduced generative performance compared to standard diffusion models.
  • Bias Handling: While B-cos networks aim to minimize bias, the diffusion process inherently introduces some biases that the model summary cannot fully capture. This can affect the reconstruction and interpretation, especially when predicting $\epsilon$.
  • Padding Token Influence: The significant relevance attributed to padding tokens in some configurations can make it harder to interpret the influence of actual prompt tokens.
  • Future Work: The authors suggest developing methods to overcome the trade-off between interpretability and generative performance. Further research could also explore more robust ways to handle biases and mitigate the influence of padding tokens.

Summary updated

BibTeX
@inproceedings{bernold2025interpretable,
  author = {Nicola Bernold and Moritz Vandenhirtz and Alice Bizeul and Julia E. Vogt},
  title = {{Interpretable Diffusion Models with B-cos Networks}},
  booktitle = {Repository},
  year = {2025},
  doi = {10.3929/ethz-c-000791992},
}
Figure