When we feed a prompt like "a brown cat and a black dog" into a text-to-image diffusion model, we intuitively expect the text encoder to produce distinct, isolated representations for each entity. We assume "brown" binds tightly to "cat" and "black" to "dog." However, downstream generative models frequently suffer from attribute bleeding—generating a black cat or a brown dog instead.
The root cause of this failure lies in the architectural mechanics of text encoders (such as CLIP). Instead of acting as discrete semantic maps, text encoders suffer from semantic entanglement and causal token pollution, where information leaks across token boundaries and pools in unexpected places.
Causal Attention and Sequential Pollution
Many modern text encoders utilize causal transformer architectures. By design, causal attention restricts each token to attending only to itself and preceding tokens. While this directional constraint is essential for autoregressive language modeling, it introduces a severe directional bias when generating static embeddings for image synthesis.
As shown by Chen et al., this directional information flow causes subsequent tokens to accumulate semantic data from everything that came before them. If a prompt mentions a cat and then a dog, the token representation for "dog" becomes contaminated by a weighted sum of the "cat" representation. This sequential accumulation prevents the model from maintaining independent representations for multiple entities, leading to hybrid or biased visual outputs.
Feng et al. similarly observe that this causal attention mechanism blends distinct concepts. Because tokens lack semantic isolation, downstream diffusion models struggle to disentangle individual entities from their specific modifiers during the cross-attention denoising process.
The Global Sponge: EOS and Padding Tokens
The leakage is not just sequential; it also pools globally. In fixed-length text encoding architectures, short prompts are padded with special tokens—such as the End-of-Sequence (EOS) or padding tokens—to reach a uniform length. Intuitively, one might treat these auxiliary tokens as neutral, empty placeholders. In reality, they act as semantic sponges.
Hu et al. demonstrate that the terminal token in text encoders acts as a global aggregator. Because it attends to the entire sequence, it absorbs and entangles information from all objects in a prompt, causing attributes to bleed across entities. This finding is echoed by Mun et al., who identify semantic entanglement within EOS tokens as a primary driver of attribute leakage in text-guided image editing. When the diffusion model cross-attends to these global tokens, it incorrectly applies attributes to unintended regions of the image.
Furthermore, padding tokens themselves carry significant semantic weight. Li et al. show that padding tokens retain a redundant summary of the entire prompt. This explains why negative constraints fail (e.g., "a man without glasses"): even if you remove or mask the word "glasses," the concept persists inside the global padding embeddings, causing the model to generate the very object the user wished to exclude.
The behavior of these padding tokens depends heavily on how the model was trained. Toker et al. conducted a mechanistic analysis revealing that when text encoders are fine-tuned jointly with a generative model, the network actively distributes semantic information into these nominally empty padding tokens to utilize the entire sequence length. Conversely, Zhuang et al. point out that these extended padding spaces are highly prone to information decay and context loss, blurring the unique identities of different objects and causing their attributes to entangle.
Downstream Consequences on Synthesis and Editing
When these contaminated text embeddings are passed to a diffusion model, the model cannot separate the overlapping signals. This compression of complex prompts into a fixed set of entangled tokens forces distinct concepts to overlap, as noted by Ma et al..
This problem becomes particularly acute during iterative image editing. For instance, Zhang et al. observe that simply concatenating a new object description to an original prompt causes semantic corruption; the text encoder processes the combined string as a single context, bleeding the new attributes into the existing scene.
This phenomenon isn't limited to text-to-image models either. In interpretability frameworks like Patchscopes, Ghandeharioun et al. show that when injecting hidden states into placeholder tokens, the original semantic information of the placeholder can persist and distort downstream interpretations in deeper layers of the network.
Restoring Semantic Isolation
Understanding why semantic leakage occurs has led to a wave of training-free, inference-time solutions designed to enforce boundaries between concepts:
- Token Manipulation: Hu et al. propose merging related tokens into composite representations to bypass the complex global aggregation of the terminal token.
- Embedding Optimization: Techniques like TEBOpt by Chen et al. optimize embeddings at inference time to balance information and counteract the sequential bias of causal encoders.
- Structural and Isolated Guidance: Feng et al. incorporate linguistic structures (like noun phrases) directly into cross-attention, while Ma et al. isolate the denoising paths for individual subjects entirely.
By treating padding, EOS, and causal tokens not as passive containers but as active, highly sensitive semantic carriers, these approaches successfully mitigate attribute bleeding and unlock precise, compositional control in generative models.
Key Foundational Work
Get What You Want, Not What You Don't: Image Content Suppression for Text-to-Image Diffusion Models (2024) — contributed 3 concept elements to this direction.
A Cat Is A Cat (Not A Dog!): Unraveling Information Mix-ups in Text-to-Image Encoders through Causal Analysis and Embedding Optimization (2024) — contributed 3 concept elements to this direction.
Magnet: We Never Know How Text-to-Image Diffusion Models Work, Until We Learn How Vision-Language Models Function (2024) — contributed 2 concept elements to this direction.