Per-Query Visual Concept Learning

Ori Malca, Dvir Samuel, Gal ChechikarXiv 2025 · DOI

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

  1. 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).
  2. DIFT Matching: Diffusion Hyperfeatures (DIFT) are used to establish correspondences between the reference subject and the draft image.
  3. 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.
  4. 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.

Figure 1: A personalized puppet subject successfully rendered in a complex "playing piano" pose while maintaining high identity fidelity.
Figure 2: Examples of complex prompt adherence, showing distinct subjects (gnome and sloth) in detailed library environments with specific lighting effects.

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

BibTeX
@misc{malca2025per,
  author = {Ori Malca and Dvir Samuel and Gal Chechik},
  title = {{Per-Query Visual Concept Learning}},
  year = {2025},
  eprint = {2508.09045},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.09045},
}
Figure