ICLR 2025 DeLTa Workshop | [Project Page] [OpenReview] [arXiv]
Diffusion models have demonstrated remarkable capabilities in synthesizing realistic images, spurring interest in using their representations for various downstream tasks. To better understand the robustness of these representations, we analyze popular Stable Diffusion models using representational similarity and norms. Our findings reveal three phenomena: (1) the presence of a learned positional embedding in intermediate representations, (2) high-similarity corner artifacts, and (3) anomalous high-norm artifacts. These findings underscore the need to further investigate the properties of diffusion model representations before considering them for downstream tasks that require robust features.
data/: Cached data generated byrun_experiments.pylabeler/: Labling Toolproject_page/: Files for the project pagecreate_dataset.py: Script to create the ImageNet subset used in the experimentsrun_experiments.py: Script to execute the experiments and generate the data filesplot.py: Script to create the final plotsrequirements.txt: Dependencies
We provide the full code to reproduce the quantitative experiments and plots in the paper. We include intermediate data files so that labeling the data and running the experiments is optional. It's important to run all code in the same environment and potentially on the same hardware, as different noise seeds lead to different anomalies.
- Install requirements:
pip install -r requirements.txt - Create the ImageNet subset:
python create_dataset.py - High-norm anomaly labeling (optional):
cd labeler- Follow
generate_norm_images.ipynbto generate the norm images for labeling - Run
python app.pyto start the labeling tool - Label the data in the browser (left click for anomalies (click on upper left token of the 2x2 anomalies), right click for next image)
- Follow
annotations_to_np.ipynbto convert the annotations to a numpy file
- Run experiments (optional):
- All experiments with default models (sd15, sd21, sdturbo):
python run_experiments.py - With specific models and experiments:
python run_experiments.py --models sd15 --experiments anomalies
- All experiments with default models (sd15, sd21, sdturbo):
- Plot results:
python plot.py
@inproceedings{loos2025latent,
title={Latent Diffusion U-Net Representations Contain Positional Embeddings and Anomalies},
author={Jonas Loos and Lorenz Linhardt},
booktitle={ICLR 2025 Workshop on Deep Generative Model in Machine Learning: Theory, Principle and Efficacy},
year={2025},
url={https://openreview.net/forum?id=BCFNrZcqEL}
}
Related projects:
