Latent Diffusion U-Net Representations Contain Positional Embeddings and Anomalies

Jonas Loos, Lorenz Linhardt

TL;DR

This paper investigates the internal representations of Stable Diffusion models, revealing that they encode learned positional information and exhibit peculiar "corner artifacts" and "high-norm anomalies." These findings suggest that while powerful for generation, these representations might not be directly transferable to downstream tasks requiring precise spatial semantics without careful consideration.

What Problem Does This Paper Address?

The incredible success of diffusion models, particularly Stable Diffusion, in generating photorealistic images has led to a surge of interest in leveraging their internal representations for various downstream tasks like classification or semantic correspondence. However, the robustness and suitability of these representations for such tasks are not fully understood. Previous work has hinted at limitations, such as texture bias or issues with linguistic binding. This paper aims to systematically analyze the internal workings of Stable Diffusion's U-Net representations to uncover potential idiosyncrasies that could hinder their application in tasks demanding precise spatial understanding.

Methods

The authors extract intermediate representations from the U-Net layers of Stable Diffusion models (SD-1.5, SD-2.1, and SD-Turbo). They employ a standard diffusion process where an image is noised to a certain timestep, and the U-Net's activations are recorded. To analyze these representations, they use two primary techniques:

  • Representational Similarity Analysis: This involves computing cosine similarities between tokens (spatial locations within a representation) to understand how similar different parts of the representation are.
  • Euclidean Norm Analysis: This measures the magnitude of the representation vectors at different spatial locations.

Additionally, they train linear probes to quantify the presence of learned positional embeddings by attempting to predict spatial coordinates from the representations. They also devise specific experiments to isolate and analyze corner artifacts and high-norm anomalies, often by comparing representations of cropped versus uncropped images.

Datasets

The paper uses a subset of the ImageNet dataset for evaluation. Specifically, they select 100 randomly chosen images from 5 classes: German shepherd, boxer, tiger cat, pickup, and volcano. These classes were chosen to represent a mix of high and low similarity concepts. The images are center-cropped and resized to 512x512 pixels to match the default input size of SD-1.5.

Key Insights and Ideas

  • Learned Positional Embeddings: Contrary to the expectation that diffusion models might learn purely semantic features, the paper demonstrates that intermediate U-Net layers explicitly encode positional information. This embedding is linearly extractable, meaning a simple linear model can predict a token's spatial location from its representation. This is significant because it suggests that spatial location is a fundamental component of how these models process information, not just a byproduct.
  • Corner Artifacts: Tokens located at the corners and borders of representations exhibit unusually high similarity to each other, even when the image content is unrelated. This "corner artifact" is observed across different images and even between tokens from different images, implying it's a structural property of the learned representations rather than a response to specific image content.
  • High-Norm Anomalies: Certain groups of neighboring tokens, particularly in the up-sampling blocks, show abnormally high Euclidean norms and mutual similarity. These anomalies appear to be independent of local image content and might represent a form of learned "register" or storage for global information, as suggested by future work.

Key Results

  • Positional Embedding Accuracy: Linear probes achieve over 90% accuracy in predicting spatial locations for lower U-Net blocks (down2 to up1), indicating a strong positional signal.
  • Corner/Border Similarity: The relative similarity of corner tokens is increased across multiple layers, suggesting a consistent bias.
  • High-Norm Anomalies Prevalence: Approximately 25% of images analyzed for SD-1.5 contain at least one high-norm anomaly in the up1-block. These anomalous tokens have significantly higher norms compared to the average token norm.
  • Model Consistency: The observed phenomena (positional embeddings, corner artifacts, high-norm anomalies) are found to be consistent across different Stable Diffusion models evaluated (SD-1.5, SD-2.1, and SD-Turbo), suggesting these are fundamental properties of this architecture.

Limitations and Future Work

The authors acknowledge that the immediate impact of these phenomena on downstream task performance needs further evaluation. They suggest that future work should:

  • Evaluate Concrete Impact: Empirically assess how these identified representation properties affect performance on large-scale, real-world downstream applications.
  • Investigate Causes: Explore the underlying reasons for these phenomena and their role in the generative process. For instance, are corner artifacts an integral part of the positional embedding mechanism?
  • Hypothesize Function: Consider potential functional roles for these anomalies, such as high-norm tokens acting as "registers" for global information.

Summary updated

BibTeX
@inproceedings{loos2025latent,
  author = {Jonas Loos and Lorenz Linhardt},
  title = {{Latent Diffusion U-Net Representations Contain Positional Embeddings and Anomalies}},
  booktitle = {DeLTa @ ICLR},
  year = {2025},
  url = {https://openreview.net/forum?id=BCFNrZcqEL},
}
Figure