Style Aligned Image Generation via Shared Attention
Introduction: The Challenge of Stylistic Consistency
Large-scale text-to-image (T2I) models, such as Stable Diffusion XL (SDXL), have revolutionized digital content creation. However, a persistent challenge remains: maintaining a consistent visual style across a series of generated images. When a user requests a "toy train in origami style" followed by a "toy car in origami style," the model often interprets the "origami" descriptor differently for each subject. One might appear as a complex, multi-colored paper sculpture, while the other is a minimalist white fold.
Achieving a unified "brand" or "artistic voice" typically requires computationally expensive fine-tuning methods like DreamBooth or StyleDrop, or labor-intensive manual prompt engineering. StyleAligned introduces a novel, zero-shot technique to enforce this consistency "on the fly" during the generation process, requiring no additional training or optimization.
Methodology: Style is in the Attention
The core innovation of StyleAligned is a strategic modification to the self-attention layers within transformer-based diffusion models. The authors posit that an image's "style" is largely encoded in how its internal features interact.
1. Shared Attention Mechanism
In standard diffusion, each image in a batch processes its own features independently. StyleAligned breaks this isolation by forcing every "target" image in a batch to attend to a single "reference" image. This allows the stylistic DNA of the reference—its textures, color palettes, and stroke patterns—to flow into the generation of the other subjects.
2. Adaptive Instance Normalization (AdaIN)
A significant risk of shared attention is "content leakage," where the target image begins to physically resemble the reference (e.g., a car taking on the silhouette of a train). To mitigate this, StyleAligned employs Adaptive Instance Normalization (AdaIN). By normalizing the queries ($Q$) and keys ($K$) of the target images using the statistics of the reference image, the mechanism ensures that the attention focuses on stylistic relationships rather than raw pixel copying.
3. Zero-Shot and Inversion Capabilities
Because these modifications occur during inference, StyleAligned is entirely zero-shot. Furthermore, by utilizing DDIM inversion, the method can extract the style from an existing real-world image and apply it to new, generated content, making it a versatile tool for artists and designers.
Key Insights
- Semantic Alignment: The shared attention mechanism is remarkably "intelligent." The model naturally aligns semantically similar regions; for instance, the "wheels" of a generated car will attend to the "wheels" of a reference train. This allows for a style transfer that respects the underlying structure of the new object.
- The Power of a Single Reference: The researchers found that "full attention sharing" (where all images attend to each other) often leads to style collapse or excessive content leakage. Restricting the flow to a single reference image provides the optimal balance between stylistic unity and subject diversity.
Evaluation and Results
StyleAligned was benchmarked against a variety of established methods, including StyleDrop, DreamBooth-LoRA, and IP-Adapter, using a set of 100 diverse prompts.
- Quantitative Performance: Using DINO embeddings to quantify style consistency, StyleAligned significantly outperformed all zero-shot and encoder-based baselines. Crucially, it maintained high text alignment (measured via CLIP scores), ensuring that the images remained faithful to their specific prompts while adopting the shared style.
- User Preference: In a large-scale study involving 2,400 judgments, human participants preferred StyleAligned over StyleDrop (SDXL) 67.1% of the time and over DreamBooth-LoRA 61.3% of the time.
- Ecosystem Integration: The method is "plug-and-play," showing successful integration with other popular diffusion tools like ControlNet for structural guidance and MultiDiffusion for creating consistent panoramic scenes.
Conclusion and Future Directions
StyleAligned offers a lightweight yet powerful solution to the consistency problem in T2I generation. While it excels at capturing textures and artistic mediums, the authors note that it currently offers less control over structural or shape similarity. Future work may explore ways to synchronize the geometric "skeleton" of images alongside their stylistic surface. Additionally, the method's performance is tied to the quality of the initial reference image and the accuracy of current inversion techniques, areas that remain ripe for further research.
Summary updated