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 ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 31 code samples harvested from 1 repository linked to this paper: 16 ran (of which 12 constructed an object rather than computing a result; 14 with no instrument failure: 0 honoured, 0 violated, 14 with no contract checked; 2 where Syntology's instrument failed) · 15 unverified. Where Syntology's instrument failed: 1 where our contract draft was wrong; 1 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 31 samples from 1 repository, 16 ran (14 with no instrument failure; 2 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written between 2026-09-22 and 2026-09-24 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

Xilluill/KV-Edit officialmentioned on GitHubpytorchSyntology: 31 samples, 16 ran (2 instrument-failed) · 15 unverified 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: 16 ran (of which 12 constructed an object rather than computing a result; 14 with no instrument failure: 0 honoured, 0 violated, 14 with no contract checked; 2 where Syntology's instrument failed) · 15 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

1ran · our draft was wrong
1ran; the contract check could not run
14ran
15unverified

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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. For 3 samples that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

Xilluill/KV-Edit official repository 31 samples, 16 ran (2 instrument-failed) · 15 unverified
AutoEncoderParams models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · b9f8b9efb85110e4 · report fixture: returned AutoEncoderParams · level recorded 2026-09-22
DoubleStreamBlock in 5 papers models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · bb78f70b285fe68a · report fixture: returned DoubleStreamBlock · level recorded 2026-09-22
EmbedND models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · ed75f4c283c8cade · report fixture: returned EmbedND · level recorded 2026-09-22
FluxParams models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 52004c455a1d9a71 · report fixture: returned FluxParams · level recorded 2026-09-22
LastLayer models/kv_edit.py ran Apache-2.0 (permissive) · 78a0e843c3d244be · report fixture: signature x:Tensor/3/float, vec:Tensor/2/float · returned Tensor · level recorded 2026-09-24
MLPEmbedder models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 6b8321fc69032c6d · report fixture: returned MLPEmbedder · level recorded 2026-09-22
ModelSpec models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 8c6dbb17f9290a46 · report fixture: returned ModelSpec · level recorded 2026-09-22
Modulation models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 2e8de1895011c4a0 · report fixture: returned Modulation · level recorded 2026-09-22
ModulationOut models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 8f8d9c986bd3147f · report fixture: returned ModulationOut · level recorded 2026-09-22
QKNorm models/kv_edit.py ran fingerprinted Apache-2.0 (permissive) · 1a2c8d9ca3918791 · report fixture: signature q:Tensor/3/float, k:Tensor/3/float, v:Tensor/3/float · returned tuple · level recorded 2026-09-24
RMSNorm in 61 papers models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · b4affeaaac4bcdd4 · report fixture: returned RMSNorm · level recorded 2026-09-22
SelfAttention in 66 papers models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · 0c92e50f90ae4f64 · report fixture: returned SelfAttention · level recorded 2026-09-22
SingleStreamBlock in 5 papers models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · a8d997e0ba042d6a · report fixture: returned SingleStreamBlock · level recorded 2026-09-22
SingleStreamBlock_kv models/kv_edit.py ran · metamorphic tier: deterministic Apache-2.0 (permissive) · c46eed3b4c31dbf0 · report fixture: returned SingleStreamBlock_kv · level recorded 2026-09-22
get_lin_function in 6 papers models/kv_edit.py ran · our draft was wrong Apache-2.0 (permissive) · 3f6652da855a2ea0 · report fixture: signature x1:float/0/float, y1:float/0/float, x2:float/0/float, y2:float/0/float · returned function · level recorded 2026-09-22
rope in 11 papers
census: 4 implementations from 5 papers, 1 distinct output on one shared input this sample: bucket 1 of 1, arg 1: rank 2, kind float, dtype float64
models/kv_edit.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant Apache-2.0 (permissive) · 16c24bf237fed814 · report fixture: signature pos:Tensor/2/float, dim:int/0/int, theta:int/0/int · returned Tensor · level recorded 2026-09-22
DoubleStreamBlock_kv models/kv_edit.py unverified Apache-2.0 (permissive) · bf0cff0597919d71 · report
Flux in 5 papers models/kv_edit.py unverified Apache-2.0 (permissive) · 59e8d7bc13f5d327 · report
Flux_kv models/kv_edit.py unverified Apache-2.0 (permissive) · a1f2d96d59c14287 · report
Flux_kv_edit models/kv_edit.py unverified Apache-2.0 (permissive) · 62f545ac5e999258 · report
apply_rope_qk models/kv_edit.py unverified Apache-2.0 (permissive) · 5585849aeb0b2934 · report
denoise_kv models/kv_edit.py unverified Apache-2.0 (permissive) · e2bf41644ea4e949 · report
get_schedule in 6 papers models/kv_edit.py unverified Apache-2.0 (permissive) · ddd6e35b84bfe270 · report
load_flow_model models/kv_edit.py unverified Apache-2.0 (permissive) · 98151b94782828d1 · report
only_Flux models/kv_edit.py unverified Apache-2.0 (permissive) · 85080c818ceef6ea · report
print_load_warning models/kv_edit.py unverified Apache-2.0 (permissive) · c728727909e45352 · report
time_shift in 7 papers models/kv_edit.py unverified Apache-2.0 (permissive) · 1b6eb944b965997b · report
unpack in 18 papers models/kv_edit.py unverified Apache-2.0 (permissive) · a9451ac1452e533d · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for KV-Edit (graph method: KV-Edit). 31 bricks; individually on a fixture: 16 ran (of which 12 constructed an object rather than computing a result; 14 with no instrument failure: 0 honoured, 0 violated, 14 with no contract checked; 2 where Syntology's instrument failed) · 15 unverified. The assembly has not been run end-to-end.

  1. Flux_kv_edit entry · level 0 · unverified · 62f545ac5e999258
  2. denoise_kv helper · level 0 · unverified · e2bf41644ea4e949
  3. get_schedule helper · level 0 · unverified · ddd6e35b84bfe270
  4. only_Flux helper · level 0 · unverified · 85080c818ceef6ea
  5. unpack helper · level 0 · unverified · a9451ac1452e533d
  6. Flux_kv model · level 0 · unverified · a1f2d96d59c14287
  7. get_lin_function helper · level 1 · ran · our draft was wrong · 3f6652da855a2ea0
  8. time_shift helper · level 0 · unverified · 1b6eb944b965997b
  9. load_flow_model helper · level 0 · unverified · 98151b94782828d1
  10. DoubleStreamBlock_kv model · level 0 · unverified · bf0cff0597919d71
  11. Flux helper · level 0 · unverified · 59e8d7bc13f5d327
  12. FluxParams helper · level 1 · ran · 52004c455a1d9a71
  13. SingleStreamBlock_kv model · level 1 · ran · c46eed3b4c31dbf0
  14. timestep_embedding helper · level 0 · unverified · 63c61fe6461924ad
  15. print_load_warning helper · level 0 · unverified · c728727909e45352
  16. DoubleStreamBlock helper · level 1 · ran · bb78f70b285fe68a
  17. attention helper · level 0 · unverified · 9e0102b5544f4909
  18. EmbedND helper · level 1 · ran · ed75f4c283c8cade
  19. LastLayer helper · level 1 · ran · 78a0e843c3d244be
  20. MLPEmbedder helper · level 1 · ran · 6b8321fc69032c6d
  21. SingleStreamBlock helper · level 1 · ran · a8d997e0ba042d6a
  22. Modulation helper · level 1 · ran · 2e8de1895011c4a0
  23. SelfAttention helper · level 1 · ran · 0c92e50f90ae4f64
  24. apply_rope helper · level 0 · unverified · 7b46f68f6e5e0e3d
  25. apply_rope_qk helper · level 0 · unverified · 5585849aeb0b2934
  26. rope helper · level 1 · ran; the contract check could not run (RAISES) · 16c24bf237fed814
  27. QKNorm helper · level 1 · ran · 1a2c8d9ca3918791
  28. ModulationOut helper · level 1 · ran · 8f8d9c986bd3147f
  29. RMSNorm helper · level 1 · ran · b4affeaaac4bcdd4
  30. AutoEncoderParams helper · level 1 · ran · b9f8b9efb85110e4
  31. ModelSpec helper · level 1 · ran · 8c6dbb17f9290a46

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2502.17363") returns these assemblies with each brick's role and wiring (how to connect).

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