Abstract
Personalizing text-to-image models often involves a trade-off between subject fidelity and prompt editability. We introduce a "per-query" refinement technique that optimizes the model for a specific prompt and noise seed during inference. By utilizing a single 4-second gradient update focused on self-attention and cross-attention features, our method ensures that generated subjects maintain their identity while adhering to complex instructions. This approach addresses the common fidelity-editability trade-off in models like FLUX and SDXL by optimizing internal attention layers.
Introduction
Text-to-image personalization techniques like DreamBooth and LoRA enable users to integrate specific visual concepts—such as a unique toy or a personal pet—into generative models. However, these methods frequently encounter a "fidelity-editability" trade-off. Over-training leads to overfitting, where the model ignores the prompt in favor of the training environment. Conversely, under-training results in poor identity preservation. Standard training losses often fail to prioritize the specific features that define an object's unique identity.
Methodology
The proposed method introduces a lightweight, inference-time fine-tuning procedure. Rather than seeking a globally perfect model, we optimize for the specific prompt and noise seed requested by the user.
The Refinement Process
- Feature Extraction: A "draft" image is generated to extract internal features from Self-Attention layers (capturing identity) and Cross-Attention layers (mapping text to regions).
- DIFT Matching: Diffusion Hyperfeatures (DIFT) are used to establish correspondences between the reference subject and the draft image.
- Triple-Threat Loss: A composite loss function is applied, including $L_{SA}$ (Self-Attention Loss) for identity, $L_{CA}$ (Cross-Attention Loss) for spatial placement, and $L_{LDM}$ for image stability.
- Single-Step Update: Model parameters or LoRA weights are updated via a single gradient step, taking approximately 4 seconds on an NVIDIA H100.
Key Results
Our method demonstrates consistent improvements in both image alignment (CLIP-I) and text alignment (CLIP-T) across various backbones. Qualitatively, the refinement ensures that subjects look more like their reference images while successfully performing complex actions that baseline models often struggle to render.
Performance and Compatibility
The refinement process adds a manageable 4-second overhead to the generation pipeline. Crucially, the method is architecture-agnostic, showing strong performance on both U-Net based models (SD 1.5/2.1) and modern Transformer-based "Flow" models like FLUX.1.
Conclusion
Per-query visual concept learning offers a powerful "add-on" for high-quality personalization. By focusing on the specificity of the current generation task and supervising internal attention layers, we can overcome the traditional limitations of global fine-tuning. Future work will explore extending this refinement to multi-concept scenes and optimizing the computational overhead for production environments.
Summary updated