FreeFlux: Understanding and Exploiting Layer-Specific Roles in RoPE-Based MMDiT for Versatile Image Editing

Tianyi Wei, Yifan Zhou, Dongdong Chen, Xingang Pan
3/20/2025
cs.CV

No official code found. Best implementation: wtybest/FreeFlux (77 stars, last commit 2026-03-07).

Abstract

The integration of Rotary Position Embedding (RoPE) in Multimodal Diffusion Transformer (MMDiT) has significantly enhanced text-to-image generation quality. However, the fundamental reliance of self-attention layers on positional embedding versus query-key similarity during generation remains an intriguing question. We present the first mechanistic analysis of RoPE-based MMDiT models (e.g., FLUX), introducing an automated probing strategy that disentangles positional information versus content dependencies by strategically manipulating RoPE during generation. Our analysis reveals distinct dependency patterns that do not straightforwardly correlate with depth, offering new insights into the layer-specific roles in RoPE-based MMDiT. Based on these findings, we propose a training-free, task-specific image editing framework that categorizes editing tasks into three types: position-dependent editing (e.g., object addition), content similarity-dependent editing (e.g., non-rigid editing), and region-preserved editing (e.g., background replacement). For each type, we design tailored key-value injection strategies based on the characteristics of the editing task. Extensive qualitative and quantitative evaluations demonstrate that our method outperforms state-of-the-art approaches, particularly in preserving original semantic content and achieving seamless modifications.

View on arXivView PDF

Code Implementations(1)

wtybest/FreeFluxCommunity66%

[ICCV 2025] FreeFlux: Understanding and Exploiting Layer-Specific Roles in RoPE-Based MMDiT for Versatile Image Editing

772Python, Jupyter NotebookMar 18, 20257 months agoNOASSERTION

Similar Papers

Cite this paper

@article{wei2025freeflux,
  title  = {FreeFlux: Understanding and Exploiting Layer-Specific Roles in RoPE-Based MMDiT for Versatile Image Editing},
  author = {Tianyi Wei and Yifan Zhou and Dongdong Chen and Xingang Pan},
  year   = {2025},
  eprint = {2503.16153},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2503.16153v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2503.16153.svg)](https://codeofpaper.com/paper/2503.16153)

Discussion