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

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

24 Feb 2025arXiv:2502.17363archive 2025-07-28

Tianrui Zhu, Shiyi Zhang, Jiawei Shao, Yansong Tang

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

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2502.17363")

Code

Syntology Ran 15 of 31 code samples harvested from 1 repository linked to this paper; 16 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 1 ran · fixture could not drive it; 13 ran with no contract checked.

By repository: official repository: 31 samples from 1 repository, 15 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Xilluill/KV-Edit officialmentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

31 samples harvested; 15 ran; 0 honoured the contract we drafted; 16 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
1ran · fixture could not drive it
13ran
16unverified

Licence: 0 of the 31 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from Xilluill/KV-Edit. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

AutoEncoderParams Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · b9f8b9efb85110e4 · report
DoubleStreamBlock Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · bb78f70b285fe68a · report
EmbedND Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · ed75f4c283c8cade · report
FluxParams Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 52004c455a1d9a71 · report
MLPEmbedder Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 6b8321fc69032c6d · report
ModelSpec Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 8c6dbb17f9290a46 · report
Modulation Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 2e8de1895011c4a0 · report
ModulationOut Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 8f8d9c986bd3147f · report
QKNorm Xilluill/KV-Edit/models/kv_edit.py official repository ran fingerprinted Apache-2.0 (permissive) · 1a2c8d9ca3918791 · report
RMSNorm Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · b4affeaaac4bcdd4 · report
SelfAttention Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 0c92e50f90ae4f64 · report
SingleStreamBlock Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · a8d997e0ba042d6a · report
SingleStreamBlock_kv Xilluill/KV-Edit/models/kv_edit.py official repository ran · metamorphic tier: deterministic Apache-2.0 (permissive) · c46eed3b4c31dbf0 · report
get_lin_function Xilluill/KV-Edit/models/kv_edit.py official repository ran · our draft was wrong Apache-2.0 (permissive) · 3f6652da855a2ea0 · report
rope Xilluill/KV-Edit/models/kv_edit.py official repository ran · fixture could not drive it Apache-2.0 (permissive) · 16c24bf237fed814 · report
DoubleStreamBlock_kv Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · bf0cff0597919d71 · report
Flux Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 59e8d7bc13f5d327 · report
Flux_kv Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · a1f2d96d59c14287 · report
Flux_kv_edit Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 62f545ac5e999258 · report
LastLayer Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 78a0e843c3d244be · report
apply_rope Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 7b46f68f6e5e0e3d · report
apply_rope_qk Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 5585849aeb0b2934 · report
attention Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 9e0102b5544f4909 · report
denoise_kv Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · e2bf41644ea4e949 · report
get_schedule Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · ddd6e35b84bfe270 · report
load_flow_model Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 98151b94782828d1 · report
only_Flux Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 85080c818ceef6ea · report
print_load_warning Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · c728727909e45352 · report
time_shift Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 1b6eb944b965997b · report
timestep_embedding Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · 63c61fe6461924ad · report
unpack Xilluill/KV-Edit/models/kv_edit.py official repository unverified Apache-2.0 (permissive) · a9451ac1452e533d · report

Tasks

Text-based Image Editing

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Text-based Image Editing PIE-Bench KV-Edit Background LPIPS 9.92 #1 of 18 Archive leaderboard report
Text-based Image Editing PIE-Bench KV-Edit Background PSNR 35.87 #1 of 18 Archive leaderboard report
Text-based Image Editing PIE-Bench KV-Edit CLIPSIM 25.63 #1 of 18 Archive leaderboard report
Text-based Image Editing PIE-Bench KV-Edit Structure Distance 1.98 #1 of 18 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections