Accelerated Image Editing via Consistency-Aware Source Token Pruning

Jeongsol Kim, Jong Chul Ye, Yufei Wang, Jian WangNeurIPS 2026

TL;DR

Editing an image with modern multimodal transformers means feeding thousands of "source image" tokens into the network alongside your text prompt—and paying a steep quadratic tax in attention compute just to keep the background from changing. This paper introduces TokenDrop, a training-free trick that throws away most of those redundant background tokens and instead preserves the unedited regions using simple, virtually free algebra during the sampling step. You get up to a 2× speedup on high-resolution edits, and your backgrounds actually stay sharper than before.

Overview of TokenDrop architecture and representative speedups on Flux Kontext and Qwen-Image-Edit

What Problem Does This Paper Address?

If you ask an AI model to "make the red squirrel read a book," you want a squirrel with a novel, and you want the tree bark behind it to stay exactly as it was.

Modern transformer-based diffusion and flow models (like Flux Kontext and Qwen-Image-Edit) handle this by concatenating three things into one giant sequence: your text tokens, the noisy image tokens being denoised, and the source image tokens. While this unified approach yields great edits, self-attention scales quadratically with sequence length. Prepending thousands of source image tokens makes editing painfully slow—Flux Kontext, for example, takes 29 seconds to edit a $1024\times1024$ image on an A100 GPU, compared to just 13 seconds to generate an image from scratch.

Worse, most of that compute is spent attending to background pixels that aren't even supposed to change. Can we drop those redundant source tokens without the model forgetting what the original background looked like?

Methods

Standard flow-matching models generate images by solving an Ordinary Differential Equation (ODE) that nudges random noise toward a clean image step by step. At any step, we can peek ahead at the model's current best guess of the final clean image (known via Tweedie’s formula).

TokenDrop modifies this standard pipeline without any retraining or auxiliary neural networks, relying on two tightly coupled ideas:

  1. Regularized Sampling Update (The Safety Net): When the authors drop a subset of source image tokens from the transformer's input, the model loses fine background details. To fix this, they add a source-consistency regularization term directly into the ODE step. For any spatial location where a source token was dropped, the algorithm linearly interpolates between the model's clean estimate and the original source image latent. Because this has a closed-form, element-wise mathematical solution, its compute cost is practically zero, and its strength is scheduled to decay to zero as generation finishes so it doesn't fight legitimate edits.
  2. Deviation-Guided Adaptive Masking (The Selector): Which tokens do you drop? At each step, TokenDrop compares the model's current clean estimate against the source image. Regions changing drastically (the squirrel's paws becoming a book) have high deviation—those source tokens are kept so the transformer has context. Regions barely changing (the tree bark) have low deviation—those tokens are dropped and handed off to the regularized update. Using classic triangle thresholding on the deviation map, the algorithm automatically adapts how many tokens to drop based on whether the edit is tiny and local or large and sweeping.

Datasets

Because TokenDrop is entirely training-free, no training datasets were used. For evaluation, the authors tested Flux Kontext and Qwen-Image-Edit on two existing benchmarks:

  • PIEBench (Prompt-based Image Editing Benchmark)
  • GEdit-Bench (evaluated with the help of Qwen2.5-VL)

No new benchmarks were introduced.

Key Insights and Ideas

  • Dropping source tokens hurts memory, not comprehension: When the authors randomly dropped up to 90% of source tokens without regularization, text alignment (CLIP similarity) stayed surprisingly flat—the model still followed instructions! However, background PSNR plummeted, turning non-edited regions into blurry approximations. Source tokens mostly act as an expensive anchor for consistency.
  • The "Random Mask Collapse" trap: You might think randomly picking different tokens to drop at every step—paired with the source-consistency regularizer—would balance things out. The authors prove mathematically (and show visually) that this is a trap: randomly injecting source information everywhere over time creates a dominant drift that pulls the entire trajectory right back to the unedited source image. Adaptive masking isn't just an optimization; it's mathematically necessary to prevent the edit from collapsing.
  • Explicit math beats implicit attention for backgrounds: By enforcing spatial constraints directly in the ODE update rather than hoping attention layers copy pixels faithfully, TokenDrop often preserves unedited regions better than the full-token baseline.

Key Results

  • Inference Speed: On PIEBench ($1024\times1024$), TokenDrop improves inference speed by an average of 22.4% across models. On Qwen-Image-Edit, it drops an average of 65% of source tokens, cutting runtime from 116.1s down to 71.1s (and down to 69.2s in specific local edits—roughly a 1.7–1.8× speedup).
  • High-Res Scaling: Because self-attention dominates compute at higher resolutions, savings scale nicely: at $2048\times2048$ (4K UHD), local edits run up to 2× faster.
  • Quality & Consistency: On Qwen-Image-Edit (PIEBench), background PSNR drops by a negligible 0.3% and CLIP similarity by 0.6%, while perceptual and structural metrics (LPIPS, SSIM, and DINO similarity) actually improve over the full-token model.
  • Human Preference: In blind human evaluations, raters consistently preferred TokenDrop over both unregularized baselines and the original full-token model for source consistency, while rating text alignment as comparable. It also cleanly outperformed token-merging methods like ToMe, which degraded image quality at similar speedups.

Limitations and Future Work

  • Global Edits: TokenDrop thrives when there is a "non-edit region" to prune. When an instruction edits the entire canvas—such as global style transfer—adaptive thresholding may still discard tokens that were actually needed, making vanilla full-token inference (or unregularized random dropping) more suitable.
  • Future Directions: Because the regularized flow ODE formulation only assumes a transformer conditioned on reference tokens, the authors note it can naturally extend beyond 2D images to higher-dimensional tasks—like video or 3D generation—where token counts and attention bottlenecks are even more severe.

Summary updated

Abstract

Text-based image editing has recently been reinterpreted in large multimodal transformers as conditional generation, where source image tokens are concatenated with text and noise tokens. While effective, this design incurs substantial computational overhead in attention layers. To mitigate this inefficiency, we propose {\em TokenDrop}, an efficient editing framework that shift the computational burden from dense source-token conditioning to a lightweight regularized sampling update. By transferring the influence of source tokens into a closed-form sampling update, the method preserves source consistency with negligible cost. To support this regularized dynamics, we introduce a deviation-guided adaptive masking strategy that selectively drops redundant tokens while maintaining editing fidelity. Across FluxKontext and Qwen-Image-Edit, our training-free method achieves an average 22.4\% improvement in inference speed on PIEBench, while better preserving non-edited regions. The method delivers up to 1.8$\times$ speedup at 1024$^2$ resolution and 2$\times$ speedup at 2048$^2$ resolution. The code will also be released publicly.
BibTeX
@inproceedings{kim2026accelerated,
  author = {Jeongsol Kim and Jong Chul Ye and Yufei Wang and Jian Wang},
  title = {{Accelerated Image Editing via Consistency-Aware Source Token Pruning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=mrTRzrrt4V},
}
Figure