KV-Edit: Training-Free Image Editing for Precise Background Preservation

Tianrui Zhu, Shiyi Zhang, Jiawei Shao, Yansong Tang
2/24/2025
cs.CV

No official code found. Best implementation: Xilluill/KV-Edit (389 stars, Apache-2.0, last commit 2025-05-21). 1 more below.

Abstract

Background consistency remains a significant challenge in image editing tasks. Despite extensive developments, existing works still face a trade-off between maintaining similarity to the original image and generating content that aligns with the target. Here, we propose KV-Edit, a training-free approach that uses KV cache in DiTs to maintain background consistency, where background tokens are preserved rather than regenerated, eliminating the need for complex mechanisms or expensive training, ultimately generating new content that seamlessly integrates with the background within user-provided regions. We further explore the memory consumption of the KV cache during editing and optimize the space complexity to $O(1)$ using an inversion-free method. Our approach is compatible with any DiT-based generative model without additional training. Experiments demonstrate that KV-Edit significantly outperforms existing approaches in terms of both background and image quality, even surpassing training-based methods. Project webpage is available at https://xilluill.github.io/projectpages/KV-Edit

View on arXivView PDF

Code Implementations(2)

Xilluill/KV-EditCommunity100%
Apache-2.0

[ICCV 2025] Official implementation for KV-Edit: Training-Free Image Editing for Precise Background Preservation

38920PythonFeb 25, 20251 years agoApache-2.0
aigcfluximage-editingimage-inversionrectified-flow+1 more
Apache-2.0

KV-Edit: Training-Free Image Editing for Precise Background Preservation,you can use it in comfyUI

603PythonMar 9, 20251 years agoApache-2.0

Similar Papers

Cite this paper

@article{zhu2025kvedit,
  title  = {KV-Edit: Training-Free Image Editing for Precise Background Preservation},
  author = {Tianrui Zhu and Shiyi Zhang and Jiawei Shao and Yansong Tang},
  year   = {2025},
  eprint = {2502.17363},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.17363v3}
}

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/2502.17363.svg)](https://codeofpaper.com/paper/2502.17363)

Discussion