DiT-based image editors often force a binary choice: apply the edit or leave it. There is no fader for intensity. If you want a slightly redder rose rather than "stop-sign red," you are out of luck. Group Relative Attention Guidance (GRAG) changes that.
GRAG is a training-free, plug-and-play method for models built on the Diffusion-in-Transformer (DiT) architecture. It adds a dial to a process that previously only had an on-off switch.
The mechanism is direct. Instead of altering model weights, GRAG reweights the difference between token attention and a shared attention bias. This intervention produces a continuous spectrum of editing strength. The math remains behind the scenes; the user simply gets a slider that works.
The result? If you prompt for a "redder rose," you can dial in the exact shade. If you want a "crochet bird," you get a smooth gradient from the original photo to a full yarn texture. When swapping "flowers" for "a surfboard," you control exactly how dominant the surfboard becomes in the frame.
GRAG integrates into existing DiT pipelines without retraining or fine-tuning. It has been validated with Qwen-Image-Edit and supports both single-image edits and batch processing via the PIE benchmark format.
Clone the repository and set up a clean environment:
git clone https://github.com/little-misfit/GRAG-Image-Editing.git
cd GRAG-Image-Editing/Qwen-Edit-GRAG
conda create -n grag python=3.10 -y
conda activate grag
pip install -r requirements.txt
The grag parameter is your primary control. Values between 0.8 and 1.7 typically yield the best results, and you can adjust the strength in increments as fine as 0.01.
sh inference.shsh PIE_test.shpython app.pyAll outputs are saved automatically to the results/ directory.
There is no catch. This is a lightweight wrapper that preserves your existing workflow while adding the nuance of traditional slider-based tools to DiT models. For anyone tired of all-or-nothing image edits, GRAG is a subtle but effective upgrade.
Sunshine Streaming Host Specs: What Hardware You Actually Need
Web Codegen Scorer: Test AI-Generated Web Code Quality Before You Ship
Qwen3-ASR-Studio: Real-Time Voice Recognition with PiP Mode
AhaSpeed VPN Review: High-Speed Performance, No Ads, and Unlimited Bandwidth
Any-LLM Review: A Unified Python Interface for Every AI Model
AI Interactive Fiction Generator Builds Stories You Actually Control
BuildAdmin: Vue 3 + ThinkPHP 8 Admin Panel with CRUD Generator
Graph-Code: Query Your Codebase via Natural Language with LLM-Powered RAG
KVoiceWalk: Clone Any Voice for Kokoro TTS Using Random Walks
n8n Automation: Over 400 AI Integrations in a Single Workflow
AutoGenLib: Generate Python Code on the Fly With OpenAI API
Dragon Ball RPG “Peak of Power” Review: Best Teams, Goku Skills, and F2P Guide