Interpretable Diffusion Models with B-cos Networks
Nicola Bernold, Moritz Vandenhirtz, Alice Bizeul, Julia E. Vogt · 2025
Read Interpretable Diffusion Models with B-cos Networks by Nicola Bernold, Moritz Vandenhirtz, Alice Bizeul, Julia E. Vogt (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2507-03846.txt.
Introduction
Nicola Bernold, Moritz Vandenhirtz, Alice Bizeul, and Julia Vogt present an image generator in two thousand twenty-five whose reasoning can be inspected. Diffusion models build pictures by clearing noise step by step under the guidance of a text prompt. They often drop or garble parts of the prompt, and those slips are hard to catch automatically.
The team rebuilt the generator from modules with a built-in explanation trait. Each word of the prompt yields a map showing which pixels it influenced. That makes prompt-to-image mismatches visible at a glance. The authors show the model still produces high-quality images while giving useful insight into alignment. The work points toward generators whose failures can be diagnosed rather than guessed at.
Catalog record
| CREATOR | Nicola Bernold, Moritz Vandenhirtz, Alice Bizeul, Julia E. Vogt |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 37 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2507-03846
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Interpretable Diffusion Models with B-cos Networks Nicola Bernold, Moritz Vandenhirtz, Alice Bizeul, Julia E. Vogt Abstract Text-to-image diffusion models generate images by iteratively denoising random noise, conditioned on a prompt. While these models have enabled impressive progress in image generation, they often fail to accurately reflect all semantic information described in the prompt—failures that are difficult to detect automatically. In this work, we introduce a diffusion model architecture built with B-cos modules that offers inherent interpretability. Our approach provides insight into how individual prompt tokens affect the generated image by producing explanations that highlight the pixel regions influenced by each token. We demonstrate that B-cos diffusion models can produce high-quality images while providing meaningful insights into prompt-image alignment. 1 Introduction Text-to-image generative models have achieved impressive results, yet, interpreting their decision process remains a significant challenge, making prompt adjustments a tedious manual process ( Xu et al. 2024 ) . Various post-hoc explanation techniques, such as LIME ( Ribeiro et al. 2016 ) , SHAP ( Lundberg & Lee 2017 ) , or LRP ( Bach et al. 2015 ) , have been proposed to better understand deep neural networks. However, these approaches often fall short of faithfully representing the underlying behavior of the models they aim to explain ( Böhle et al. 2022 ) . Hence, inherently interpretable deep neural networks have attracted growing interest ( Böhle et al. 2024 ; Rio-Torto et al. 2024 ) . Unlike post-hoc explanation methods, these models are designed with built-in architectural constraints that enable the model to produce a faithful explanation for its output. Integrating interpretable modules into existing architectures can be challenging, often requiring tedious adjustments or being infeasible due to the constraints these modules impose. To address this, Böhle et al. 2022 introduce B-cos networks, which serve as drop-in replacements for standard neural network components. This design allows interpretable elements to be seamlessly incorporated into existing architectures with minimal impact on predictive performance, while providing faithful visualizations of input-output relationships and even neuron-level explanations. So far, B-cos networks have primarily been developed for discriminative tasks in computer vision and natural language processing ( Böhle et al. 2024 ) . In this work, we extend B-cos networks to text-to-image diffusion models. While diffusion models ( Ho et al. 2020 ; Song et al. 2021 ) have emerged as the state of the art for generating images, they remain difficult to interpret and evaluate. In particular, assessing how accurately the semantic concepts expressed in the prompt are reflected in the generated images is a key challenge—one that hinders the evaluation of image-text alignment. Our work seeks to address these challenges through the following contributions: 1. We identify key considerations and challenges of integrating B-cos networks into text-to-image diffusion models, which provides a foundation for future work. 2. We integrate B-cos networks into Stable Diffusion and demonstrate its generative capabilities as well as faithful attribution of relevant input tokens. 3. Leveraging its inherent interpretability, we show that the proposed method can identify failure generations where the model’s outputs do not align with its prompt. 2 Background Neural networks can be locally approximated by an affine transformation of the form f(x)=W(x)x+b(x) , where W(x) and b(x) are input-dependent tensors that provide a faithful summary of the model’s behavior at a given point ( Srinivas & Fleuret 2019 ) . To transform this observation into a basis for model explanations, B-cos networks ( Böhle et al. 2024 ) aim to eliminate the bias term b(x) , ensuring that W(x) alone encapsulates the full information of the model’s computations. For an image classifier logit, W(x) has the shape of an image and thus can directly be visualized. However, such visualizations typically only display local features, which do not correspond to the global, human-understandable concepts in the image. To address this, B-cos networks employ the so-called B-cos transformation in place of the traditional neurons: \begin{split}f_{\text{B-cos}}(x;w)&=\left(\lvert\text{cos}(x,w)\rvert^{B-1}\times\hat{w}\right)^{T}x\\ &=w^{T}(x)x\end{split} (1) with hyperparameter B , the cosine similarity \text{cos}(x,w) between x and w , and \hat{w}\!=\!\frac{w}{||w||_{2}} , w scaled to unit-norm. Such B-cos transformations are thus accurately summarised by a single linear transformation W(x)\text{ s.t. }f(x)=W(x)x . As there is no implicit or explicit bias term, this summary is complete and for B>1 , the cosine similarity puts additional pressure on the input-weight alignment which has been shown to make the explanations more human interpretable and lead to a better localization of the task-relevant input features. These properties also extend to layers and stacks of such transformations which implies that arbitrarily complex B-cos networks can be summarised by a single dynamic linear transformation. The input-weight alignment property is the key concept of B-cos networks: B\gg 1\land\lvert f_{\text{B-cos}}(x;w)\lvert\gg 0\implies\lvert cos(x,w)\rvert\approx 1 (2) This means that if the output of the B-cos transform is non-negligible, the weights are aligned with the input. Or in other words, the explanation, which is based on the scaled weights, corresponds roughly to the relevant input for a particular output neuron. 3 B-cos Diffusion Models To leverage the interpretable qualities of B-cos networks for diffusion models, the neural network backbone needs to be replaced by a B-cos network. Ideally, this should be a drop-in procedure such that it can be used together with any architectures and techniques that have been shown to work well for conventional diffusion models. In the following sections we discuss further considerations, challenges, and solutions for diffusion models in general, but also focus on text-to-image Stable Diffusion 2.1 ( Rombach et al. 2022 ) for more specific details. For a more thorough discussion of related work, we refer to Appendix A . 3.1 Inputs and Biases Neural networks themselves often contain learnable or constant biases, which are removed when transforming a neural network architecture into a B-cos network. However, when generating images with a conditional diffusion model, the neural network backbone is applied multiple times and various operations are performed between the individual inference runs to turn the predictions into the sample at the next timestep. These computations outside of the neural networks still introduce biases and the end-to-end B-cos summary thus is no longer complete. Specifically, given a noisy image x_{t} at timestep t with conditioning c , the U-Net predicts some quantity which is used to compute the predicted mean \hat{\mu}(x_{t},c,t;\theta) , such that x_{t-1} can be sampled from some distribution: x_{t-1}\sim\mathcal{N}(\hat{\mu}(x_{t},c,t;\theta),\sigma_{t}I) (3) The noise introduced through this step is a bias which cannot be explained with respect to any of the inputs. However, applying deterministic sampling schemes, such as e.g. DDIM ( Song et al. 2021 ) with \sigma_{t}=0 , allow us to fully avoid introducing new biases by sampling from a distribution between the U-Net inferences. Moreover, the diffusion model backbone has multiple inputs. For example a text-to-image diffusion model backbone receives a noisy image, an encoded text prompt and a timestep encoding as input. B-cos explanations are designed to explain how a single input affects the output. Thus, the multiple inputs practically behave like biases towards each other. Omitting the noisy image or the conditioning as input cannot be done without fundamentally modifying the architecture such that it is no longer a conditional diffusion model. However, previous work has shown empirically that the inclusion of a positional encoding still