ChatPaper.aiChatPaper

Групповое относительное внимание для редактирования изображений

Group Relative Attention Guidance for Image Editing

October 28, 2025
Авторы: Xuanpu Zhang, Xuesong Niu, Ruidong Chen, Dan Song, Jianhao Zeng, Penghui Du, Haoxiang Cao, Kai Wu, An-an Liu
cs.AI

Аннотация

В последнее время методы редактирования изображений на основе моделей Diffusion-in-Transformer (DiT) получили быстрое развитие. Однако существующие подходы часто не обеспечивают эффективного контроля над степенью редактирования, что ограничивает возможность достижения более кастомизированных результатов. Для решения этой проблемы мы исследуем механизм MM-Attention в модели DiT и обнаруживаем, что токены Query и Key имеют общий вектор смещения, зависящий только от слоя. Мы интерпретируем это смещение как отражение inherentного поведения модели при редактировании, в то время как разность (дельта) между каждым токеном и соответствующим ему смещением кодирует содержательно-специфичные сигналы редактирования. На основе этого наблюдения мы предлагаем Group Relative Attention Guidance (GRAG) — простой, но эффективный метод, который перевзвешивает дельта-значения различных токенов, чтобы модулировать фокус модели на входном изображении относительно инструкции редактирования. Это позволяет осуществлять непрерывный и детализированный контроль интенсивности редактирования без какой-либо донастройки. Многочисленные эксперименты, проведенные в рамках существующих фреймворков редактирования изображений, демонстрируют, что GRAG может быть интегрирован с помощью всего четырех строк кода, последовательно улучшая качество редактирования. Более того, по сравнению с широко используемым Classifier-Free Guidance, GRAG обеспечивает более плавный и точный контроль над степенью редактирования. Наш код будет доступен по адресу 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.
PDF251December 1, 2025