Guida all'Attenzione Relativa di Gruppo per l'Editing di Immagini
Group Relative Attention Guidance for Image Editing
October 28, 2025
Autori: Xuanpu Zhang, Xuesong Niu, Ruidong Chen, Dan Song, Jianhao Zeng, Penghui Du, Haoxiang Cao, Kai Wu, An-an Liu
cs.AI
Abstract
Di recente, l'editing di immagini basato su modelli Diffusion-in-Transformer ha conosciuto uno sviluppo rapido. Tuttavia, i metodi di editing esistenti spesso mancano di un controllo efficace sul grado di modifica, limitando la loro capacità di ottenere risultati più personalizzati. Per affrontare questa limitazione, investigiamo il meccanismo di MM-Attention all'interno del modello DiT e osserviamo che i token Query e Key condividono un vettore di bias che dipende solo dal layer. Interpretiamo questo bias come rappresentante del comportamento di editing intrinseco del modello, mentre la differenza (delta) tra ciascun token e il suo corrispondente bias codifica i segnali di editing specifici del contenuto. Sulla base di questa intuizione, proponiamo il Group Relative Attention Guidance (GRAG), un metodo semplice ma efficace che rivaluta i valori delta di token diversi per modulare l'attenzione del modello sull'immagine di input rispetto all'istruzione di editing, consentendo un controllo continuo e granulare sull'intensità dell'editing senza alcuna ottimizzazione aggiuntiva. Esperimenti estensivi condotti su framework di editing di immagini esistenti dimostrano che GRAG può essere integrato con poche righe di codice (fino a quattro), migliorando costantemente la qualità dell'editing. Inoltre, rispetto alla comunemente usata Classifier-Free Guidance, GRAG raggiunge un controllo più fluido e preciso sul grado di modifica. Il nostro codice sarà rilasciato su https://github.com/little-misfit/GRAG-Image-Editing.
English
Recently, image editing based on Diffusion-in-Transformer models has
undergone rapid development. However, existing editing methods often lack
effective control over the degree of editing, limiting their ability to achieve
more customized results. To address this limitation, we investigate the
MM-Attention mechanism within the DiT model and observe that the Query and Key
tokens share a bias vector that is only layer-dependent. We interpret this bias
as representing the model's inherent editing behavior, while the delta between
each token and its corresponding bias encodes the content-specific editing
signals. Based on this insight, we propose Group Relative Attention Guidance, a
simple yet effective method that reweights the delta values of different tokens
to modulate the focus of the model on the input image relative to the editing
instruction, enabling continuous and fine-grained control over editing
intensity without any tuning. Extensive experiments conducted on existing image
editing frameworks demonstrate that GRAG can be integrated with as few as four
lines of code, consistently enhancing editing quality. Moreover, compared to
the commonly used Classifier-Free Guidance, GRAG achieves smoother and more
precise control over the degree of editing. Our code will be released at
https://github.com/little-misfit/GRAG-Image-Editing.