Shared attention keeps SDXL from drifting between styles
A set of notebooks and demos that align visual style across image batches by sharing attention inside Stable Diffusion models.

What it does The repository contains notebooks and demos for a Google research technique that generates batches of images sharing a single visual style using SDXL, or copies a style from a reference photo. It also combines with ControlNet-Depth and MultiDiffusion to add depth conditioning or generate style-consistent panoramas with SD V2.
The interesting bit The clever part is treating attention maps as a shared resource across the batch to enforce a common aesthetic. The code also treats this as a modular layer: it slots into existing pipelines alongside ControlNet and MultiDiffusion without replacing the underlying model.
Key highlights
- Implements style alignment via shared attention for SDXL and Stable Diffusion V2.
- Supports style transfer from a reference image.
- Composes with ControlNet-Depth and MultiDiffusion for conditioned or panoramic output.
- Includes local browser demos and an online Hugging Face Space for ControlNet + StyleAligned.
- Explicitly flagged as not an officially supported Google product.
Caveats
- Two items on the roadmap are still open: multi-style support with MultiDiffusion and integration with DreamBooth.
- The code was validated only on a specific environment: Python 3.11, PyTorch 2.1, and Diffusers 0.16.
Verdict Worth exploring if you are tinkering with diffusion internals or need a quick way to enforce style consistency across a batch. Give it a pass if you need a finished, officially supported tool.
Frequently asked
- What is google/style-aligned?
- A set of notebooks and demos that align visual style across image batches by sharing attention inside Stable Diffusion models.
- Is style-aligned open source?
- Yes — google/style-aligned is open source, released under the Apache-2.0 license.
- What language is style-aligned written in?
- google/style-aligned is primarily written in Python.
- How popular is style-aligned?
- google/style-aligned has 1.3k stars on GitHub.
- Where can I find style-aligned?
- google/style-aligned is on GitHub at https://github.com/google/style-aligned.