Introduction
In professional creative workflows—ranging from graphic novel illustration to game asset design—maintaining a consistent visual aesthetic across a series of images is a fundamental requirement. While modern diffusion models have reached unprecedented levels of photorealism and prompt adherence, achieving "style consistency" remains a significant hurdle. Even with identical style prompts, models often produce varying textures, color palettes, and artistic strokes across different generations.
Previous solutions like StyleAligned were developed for the older U-Net architectures (e.g., SDXL). However, as the industry shifts toward Diffusion Transformers (DiTs) such as Flux.1 and Stable Diffusion 3 (SD3), these legacy methods have encountered a "catastrophic failure mode." When applied to DiTs, existing techniques typically result in either a total loss of style or "mode collapse," where the model generates a near-exact replica of the reference image's layout while ignoring the unique content of the new prompt. AlignedGen is a training-free framework designed to resolve these issues, enabling robust style sharing within the DiT architecture without requiring fine-tuning or additional modules.
The Challenge: Positional Collisions in DiTs
The primary reason traditional style-sharing methods fail on DiTs is the use of Rotary Position Embeddings (RoPE). In U-Net models, spatial information is largely implicit in the convolutional layers. In contrast, DiTs use RoPE to explicitly track the coordinates of every pixel (token).
When a target image naively "attends" to a reference image to borrow its style, it often uses the same positional indices. This creates a "Positional Collision": the model perceives the reference features as belonging to the exact same spatial location as the target features. Consequently, the model tries to copy the structure and placement of objects rather than the abstract style. This leads to the observed mode collapse where the output is a structural clone of the reference.
The AlignedGen Framework
AlignedGen introduces three core innovations to decouple style from structure and ensure high-fidelity alignment.
1. Shifted Position Embedding (ShiftPE)
To resolve positional collisions, AlignedGen introduces Shifted Position Embedding (ShiftPE). Instead of allowing the target and reference images to share the same coordinate space, ShiftPE virtually places the reference image "next to" the target image by assigning it non-overlapping positional indices. By shifting the reference coordinates, the attention mechanism is forced to treat the reference as a separate entity. This allows the model to learn what the style looks like globally without attempting to replicate where specific elements are located.
2. Advanced Attention Sharing (AAS)
AlignedGen refines the attention mechanism through a suite of targeted modifications:
- Selective Attention Sharing (SAS): DiTs process both text and image tokens in a unified block. AlignedGen selectively shares only the keys and values from image tokens. By excluding text tokens from the sharing process, the model prevents "prompt contamination," ensuring the target image follows its own text description rather than being influenced by the reference's prompt.
- Key Scaling ($\lambda$): A modulation parameter acts as a "style volume" knob. This allows users to adjust the intensity of the style injection, providing a trade-off between strict style adherence and creative variation.
- Layer-Selective Application: The authors discovered that applying style sharing across all transformer layers disrupts the fundamental structure of the image. AlignedGen targets specific "Single Blocks" (specifically layers 19-57 in Flux.1) that are responsible for fine-grained details and textures, leaving the earlier layers to establish the primary composition.
3. External Reference Extraction
While AlignedGen works natively for model-generated images, it also supports user-provided external images. The framework utilizes a specialized algorithm that employs the forward diffusion process to extract approximate Query, Key, and Value features from any external image, allowing users to apply the style of a real photograph or painting to their generations.
Experimental Results
AlignedGen was evaluated against several state-of-the-art baselines, including IP-Adapter, StyleAligned, and CSGO, using a benchmark of 100 diverse artistic styles (e.g., isometric illustration, pixel art, and expressionism).
Quantitative Performance
Using DINO and CLIP embeddings to measure style consistency ($S_{sty}$) and text alignment ($S_{text}$), AlignedGen demonstrated superior performance:
- Text Alignment ($S_{text}$): 0.282
- Style Consistency ($S_{sty}$): 0.740
These metrics indicate that AlignedGen achieves the best balance in the field—maintaining the highest style similarity to the reference while remaining the most faithful to the unique text prompt of the target image. The researchers noted that DINO embeddings were particularly useful for this evaluation, as they are more sensitive to artistic textures and strokes than CLIP, which often confuses similar content for similar style.
User Preference and Compatibility
In a blind user study involving 40 participants, AlignedGen was overwhelmingly preferred, achieving an average ranking of 1.20 (where 1 is best). This significantly outperformed the next best method, IP-Adapter, which scored 2.04. Furthermore, the method proved its versatility by functioning seamlessly across Flux.1-dev, SD3, and SD3.5, and it remains compatible with secondary tools like ControlNet and Dreambooth.
Conclusion and Future Work
AlignedGen provides a robust, training-free solution for style consistency in the era of Diffusion Transformers. By identifying and fixing the "positional collision" inherent in RoPE-based models, it allows for sophisticated aesthetic control without the need for expensive fine-tuning.
While the method is highly effective, it does introduce some inference overhead due to the simultaneous processing of reference and target images. Future research may focus on optimizing this computational cost and extending these style-alignment techniques to video generation, where maintaining temporal style consistency remains a significant challenge.
Summary updated