SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.17363 · ICCV · 2025

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

Jiawei Shao, Yansong Tang, Shiyi Zhang, Tianrui Zhu

arXiv · PDF · Open in the Atlas

Code that ran

16 of 31 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (12 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 14 have no contract verdict; 2 failures of our instrument; 15 no recorded run), measured 2026-11-24; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2502.17363.json · badge: /api/ran/2502.17363.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Xilluill/KV-Edit marked official in Papers with Code
Papers with Code archive
16 ran · 15 no recorded run
FunctionStatusWhere it lives
AutoEncoderParams Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("b9f8b9efb85110e4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, AutoEncoderParams: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class AutoEncoderParams:
    resolution: int
    in_channels: int
    ch: int
    out_ch: int
    ch_mult: list
    num_res_blocks: int
    z_channels: int
    scale_factor: float
    shift_factor: float

ARGS = {
    "resolution": 32,
    "in_channels": 3,
    "ch": 128,
    "out_ch": 3,
    "ch_mult": [1, 2, 4, 8],
    "num_res_blocks": 2,
    "z_channels": 4,
    "scale_factor": 0.18215,
    "shift_factor": 0.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type AutoEncoderParams — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a AutoEncoderParams output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DoubleStreamBlock Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("bb78f70b285fe68a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, DoubleStreamBlock: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    'hidden_size': 16,
    'num_heads': 4,
    'mlp_ratio': 2.0,
    'qkv_bias': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DoubleStreamBlock — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a DoubleStreamBlock output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
EmbedND Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("ed75f4c283c8cade")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, EmbedND: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn
from einops import rearrange

torch.manual_seed(0)

ARGS = {
    'dim': 64,
    'theta': 10000,
    'axes_dim': [32, 32]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EmbedND — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a EmbedND output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
FluxParams Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("52004c455a1d9a71")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, FluxParams: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "in_channels": 4,
    "vec_in_dim": 8,
    "context_in_dim": 16,
    "hidden_size": 32,
    "mlp_ratio": 2.5,
    "num_heads": 4,
    "depth": 2,
    "depth_single_blocks": 3,
    "axes_dim": [8, 16, 24],
    "theta": 10000,
    "qkv_bias": True,
    "guidance_embed": False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type FluxParams — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a FluxParams output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
LastLayer Ran
ran on a synthesized input
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("78a0e843c3d244be")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np
from torch import nn

INIT_ARGS = {
    "hidden_size": 4,
    "patch_size": 3,
    "out_channels": 2,
}

# Create input tensors for forward pass
batch_size = 2
seq_len = 5
x = torch.randn(batch_size, seq_len, INIT_ARGS["hidden_size"])
vec = torch.randn(batch_size, INIT_ARGS["hidden_size"])

ARGS = {
    "x": x,
    "vec": vec,
}
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
MLPEmbedder Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("6b8321fc69032c6d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, MLPEmbedder: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "in_dim": 4,
    "hidden_dim": 8,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MLPEmbedder — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a MLPEmbedder output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
ModelSpec Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("8c6dbb17f9290a46")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, ModelSpec: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class AutoEncoderParams:
    resolution: int
    in_channels: int
    ch: int
    out_ch: int
    ch_mult: list
    num_res_blocks: int
    z_channels: int
    scale_factor: float
    shift_factor: float

@dataclass
class FluxParams:
    in_channels: int
    vec_in_dim: int
    context_in_dim: int
    hidden_size: int
    mlp_ratio: float
    num_heads: int
    depth: int
    depth_single_blocks: int
    axes_dim: list
    theta: int
    qkv_bias: bool
    guidance_embed: bool

@dataclass
class ModelSpec:
    params: FluxParams
    ae_params: AutoEncoderParams
    ckpt_path: str | None
    ae_path: str | None
    repo_id: str | None
    repo_flow: str | None
    repo_ae: str | None

flux_params = FluxParams(
    in_channels=4,
    vec_in_dim=768,
    context_in_dim=4096,
    hidden_size=3072,
    mlp_ratio=4.0,
    num_heads=24,
    depth=19,
    depth_single_blocks=38,
    axes_dim=[16, 56, 56],
    theta=10000,
    qkv_bias=True,
    guidance_embed=True
)

ae_params = AutoEncoderParams(
    resolution=512,
    in_channels=3,
    ch=128,
    out_ch=3,
    ch_mult=[1, 2, 4, 4],
    num_res_blocks=2,
    z_channels=4,
    scale_factor=0.18215,
    shift_factor=0.1
)

ARGS = {
    "params": flux_params,
    "ae_params": ae_params,
    "ckpt_path": None,
    "ae_path": None,
    "repo_id": None,
    "repo_flow": None,
    "repo_ae": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ModelSpec — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ModelSpec output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
Modulation Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("2e8de1895011c4a0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, Modulation: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch import Tensor
from dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class ModulationOut:
    shift: Tensor
    scale: Tensor
    gate: Tensor

class Modulation(nn.Module):

    def __init__(self, dim: int, double: bool):
        super().__init__()
        self.is_double = double
        self.multiplier = 6 if double else 3
        self.lin = nn.Linear(dim, self.multiplier * dim, bias=True)

    def forward(self, vec: Tensor) -> tuple[ModulationOut, ModulationOut | None]:
        out = self.lin(nn.functional.silu(vec))[:, None, :].chunk(self.multiplier, dim=-1)
        return (ModulationOut(*out[:3]), ModulationOut(*out[3:]) if self.is_double else None)

# Setup arguments
dim = 4
double = True

ARGS = {
    "dim": dim,
    "double": double
}

# Verify the setup works
modulation = Modulation(**ARGS)
test_vec = torch.randn(2, dim)
result = modulation(test_vec)
print(f"Result type: {type(result)}")
print(f"First ModulationOut shapes: shift={result[0].shift.shape}, scale={result[0].scale.shape}, gate={result[0].gate.shape}")
print(f"Second ModulationOut: {result[1]}")
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Modulation — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a Modulation output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
ModulationOut Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("8f8d9c986bd3147f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, ModulationOut: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import Tensor
from dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class ModulationOut:
    shift: Tensor
    scale: Tensor
    gate: Tensor

ARGS = {
    "shift": torch.randn(2, 4),
    "scale": torch.randn(2, 4),
    "gate": torch.randn(2, 4),
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ModulationOut — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ModulationOut output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
QKNorm Ran
ran on a synthesized input
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("1a2c8d9ca3918791")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import Tensor, nn

class RMSNorm(torch.nn.Module):

    def __init__(self, dim: int):
        super().__init__()
        self.scale = nn.Parameter(torch.ones(dim))

    def forward(self, x: Tensor):
        x_dtype = x.dtype
        x = x.float()
        rrms = torch.rsqrt(torch.mean(x ** 2, dim=-1, keepdim=True) + 1e-06)
        return (x * rrms).to(dtype=x_dtype) * self.scale

class QKNorm(torch.nn.Module):

    def __init__(self, dim: int):
        super().__init__()
        self.query_norm = RMSNorm(dim)
        self.key_norm = RMSNorm(dim)

    def forward(self, q: Tensor, k: Tensor, v: Tensor) -> tuple[Tensor, Tensor]:
        q = self.query_norm(q)
        k = self.key_norm(k)
        return (q.to(v), k.to(v))


INIT_ARGS = {
    'dim': 4
}

ARGS = {
    'q': torch.randn(2, 3, 4),
    'k': torch.randn(2, 3, 4),
    'v': torch.randn(2, 3, 4)
}

if __name__ == '__main__':
    model = QKNorm(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shapes:", output[0].shape, output[1].shape)
    print("Success!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
RMSNorm Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("b4affeaaac4bcdd4")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, RMSNorm: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from torch import nn

torch.manual_seed(0)

class RMSNorm(torch.nn.Module):

    def __init__(self, dim: int):
        super().__init__()
        self.scale = nn.Parameter(torch.ones(dim))

    def forward(self, x: torch.Tensor):
        x_dtype = x.dtype
        x = x.float()
        rrms = torch.rsqrt(torch.mean(x ** 2, dim=-1, keepdim=True) + 1e-06)
        return (x * rrms).to(dtype=x_dtype) * self.scale


ARGS = {
    "dim": 4
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type RMSNorm — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a RMSNorm output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SelfAttention Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("0c92e50f90ae4f64")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SelfAttention: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from einops import rearrange

torch.manual_seed(0)

# Define the supporting classes needed
class RMSNorm(torch.nn.Module):
    def __init__(self, dim: int):
        super().__init__()
        self.scale = nn.Parameter(torch.ones(dim))

    def forward(self, x: torch.Tensor):
        x_dtype = x.dtype
        x = x.float()
        rrms = torch.rsqrt(torch.mean(x ** 2, dim=-1, keepdim=True) + 1e-06)
        return (x * rrms).to(dtype=x_dtype) * self.scale

class QKNorm(torch.nn.Module):
    def __init__(self, dim: int):
        super().__init__()
        self.query_norm = RMSNorm(dim)
        self.key_norm = RMSNorm(dim)

    def forward(self, q: torch.Tensor, k: torch.Tensor, v: torch.Tensor) -> tuple:
        q = self.query_norm(q)
        k = self.key_norm(k)
        return (q.to(v), k.to(v))

class SelfAttention(nn.Module):
    def __init__(self, dim: int, num_heads: int=8, qkv_bias: bool=False):
        super().__init__()
        self.num_heads = num_heads
        head_dim = dim // num_heads
        self.qkv = nn.Linear(dim, dim * 3, bias=qkv_bias)
        self.norm = QKNorm(head_dim)
        self.proj = nn.Linear(dim, dim)

    def forward(self, x: torch.Tensor, pe: torch.Tensor) -> torch.Tensor:
        qkv = self.qkv(x)
        q, k, v = rearrange(qkv, 'B L (K H D) -> K B H L D', K=3, H=self.num_heads)
        q, k = self.norm(q, k, v)
        # attention function would go here but we're just testing initialization
        return self.proj(x)

# Create minimal valid arguments
batch_size = 2
seq_len = 3
dim = 4
num_heads = 2
num_freqs = 6  # frequency embeddings dimension

# Create input tensor: (batch_size, seq_len, dim)
x = torch.randn(batch_size, seq_len, dim)

# Create positional encoding tensor for RoPE
# Shape: (batch, heads, seq_len, head_dim//2, 1, 2)
head_dim = dim // num_heads
pe = torch.randn(batch_size, num_heads, seq_len, head_dim // 2, 1, 2)

ARGS = {
    'dim': dim,
    'num_heads': num_heads,
    'qkv_bias': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SelfAttention — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SelfAttention output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SingleStreamBlock Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("a8d997e0ba042d6a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SingleStreamBlock: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from einops import rearrange

torch.manual_seed(0)

# Define dimensions
hidden_size = 8
num_heads = 2
head_dim = hidden_size // num_heads  # 4
seq_len = 3
batch_size = 2

# Create input tensors
x = torch.randn(batch_size, seq_len, hidden_size)  # [2, 3, 8]
vec = torch.randn(batch_size, hidden_size)  # [2, 8]

# Create rotary embeddings (pe tensor for apply_rope)
# Shape should match what apply_rope expects: [B, H, seq_len, head_dim, 1, 2]
pe = torch.randn(batch_size, num_heads, seq_len, head_dim, 1, 2)

ARGS = {
    "hidden_size": hidden_size,
    "num_heads": num_heads,
    "mlp_ratio": 4.0,
    "qk_scale": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SingleStreamBlock — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SingleStreamBlock output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
SingleStreamBlock_kv Ran
ran on a synthesized input · constructed an object; no result was computed
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("c46eed3b4c31dbf0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned an instance of its own class, SingleStreamBlock_kv: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from torch import Tensor

torch.manual_seed(0)

# Define ARGS dictionary for SingleStreamBlock_kv
ARGS = {
    "hidden_size": 64,
    "num_heads": 4,
    "mlp_ratio": 4.0,
    "qk_scale": None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type SingleStreamBlock_kv — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a SingleStreamBlock_kv output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_lin_function Ran
ran; our contract draft was wrong, not the code
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("3f6652da855a2ea0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned function. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    "x1": 256.0,
    "y1": 0.5,
    "x2": 4096.0,
    "y2": 1.15,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
rope Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("16c24bf237fed814")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 5, dtype family float, shape (2, 3, 2, 2, 2) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
from einops import rearrange, repeat

torch.manual_seed(0)

# pos: Tensor - position indices, shape should be compatible with einsum '...n,d->...nd'
# Looking at the function, pos is used in einsum with omega (which has shape [dim//2])
# The output suggests pos should have shape like (batch, seq_len) or similar
# Let's make it (batch=2, seq_len=3) for a small example
pos = torch.arange(6, dtype=torch.float64).reshape(2, 3)

# dim: int - embedding dimension, must be even
# Used in: scale = torch.arange(0, dim, 2, dtype=torch.float64, device=pos.device) / dim
# And in rearrange with i=2, j=2, so dim must be divisible by 4
dim = 4

# theta: int - base for the frequency scale
# Used in: omega = 1.0 / theta ** scale
theta = 10000

ARGS = {
    "pos": pos,
    "dim": dim,
    "theta": theta,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 5, dtype family float, shape (2, 3, 2, 2, 2) — shape (2, 3, 2, 2, 2) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
DoubleStreamBlock_kv Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("bf0cff0597919d71")
How it ran

no invocation recorded.

Flux Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("59e8d7bc13f5d327")
How it ran

no invocation recorded.

Flux_kv Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("a1f2d96d59c14287")
How it ran

no invocation recorded.

Flux_kv_edit Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("62f545ac5e999258")
How it ran

no invocation recorded.

apply_rope Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("7b46f68f6e5e0e3d")
How it ran

no invocation recorded.

apply_rope_qk Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("5585849aeb0b2934")
How it ran

no invocation recorded.

attention Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("9e0102b5544f4909")
How it ran

no invocation recorded.

denoise_kv Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("e2bf41644ea4e949")
How it ran

no invocation recorded.

get_schedule Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("ddd6e35b84bfe270")
How it ran

no invocation recorded.

load_flow_model Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("98151b94782828d1")
How it ran

no invocation recorded.

only_Flux Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("85080c818ceef6ea")
How it ran

no invocation recorded.

print_load_warning Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("c728727909e45352")
How it ran

no invocation recorded.

time_shift Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("1b6eb944b965997b")
How it ran

no invocation recorded.

timestep_embedding Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("63c61fe6461924ad")
How it ran

no invocation recorded.

unpack Not yet run
unverified (harvested, no recorded run)
Xilluill/KV-Edit/models/kv_edit.py
code served (permissive licence) · get_code("a9451ac1452e533d")
How it ran

no invocation recorded.

Also present in other papers' code

Of 31 samples lifted from this paper's linked repositories, 31 carry a function identity and 0 do not. Of the 31 distinct functions with an identity, 17 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 10 the same month, 17 later) and 14 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
rope
brick of this paper's assembly: helper
8 other papers
3 dated earlier, 1 the same month, 4 later · 2 only as an assembly brick
2409.00587 (2024-09)
FLUX that Plays Music
2411.04746 (2024-11)
Taming Rectified Flow for Inversion and Editing
2412.07517 (2024-12)
FireFlow: Fast Inversion of Rectified Flow for Image Semantic Editing
and 5 more not named here
Modulation
brick of this paper's assembly: helper
5 other papers
2 the same month, 3 later · 3 only as an assembly brick
2502.01105 (2025-02)
LayerTracer: Cognitive-Aligned Layered SVG Synthesis via Diffusion Transformer
2502.04320 (2025-02)
ConceptAttention: Diffusion Transformers Learn Highly Interpretable Features
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
and 2 more not named here
ModulationOut
brick of this paper's assembly: helper
5 other papers
2 the same month, 3 later · 3 only as an assembly brick
2502.01105 (2025-02)
LayerTracer: Cognitive-Aligned Layered SVG Synthesis via Diffusion Transformer
2502.04320 (2025-02)
ConceptAttention: Diffusion Transformers Learn Highly Interpretable Features
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
and 2 more not named here
QKNorm
brick of this paper's assembly: helper
5 other papers
2 the same month, 3 later · 3 only as an assembly brick
2502.01105 (2025-02)
LayerTracer: Cognitive-Aligned Layered SVG Synthesis via Diffusion Transformer
2502.04320 (2025-02)
ConceptAttention: Diffusion Transformers Learn Highly Interpretable Features
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
and 2 more not named here
timestep_embedding
brick of this paper's assembly: helper
5 other papers
1 dated earlier, 1 the same month, 3 later · 1 only as an assembly brick
2412.07517 (2024-12)
FireFlow: Fast Inversion of Rectified Flow for Image Semantic Editing
2502.01105 (2025-02)
LayerTracer: Cognitive-Aligned Layered SVG Synthesis via Diffusion Transformer
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
and 2 more not named here
EmbedND
brick of this paper's assembly: helper
4 other papers
1 the same month, 3 later · 2 only as an assembly brick
2502.01105 (2025-02)
LayerTracer: Cognitive-Aligned Layered SVG Synthesis via Diffusion Transformer
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
2602.00883 (2026-02)
DIAMOND: Directed Inference for Artifact Mitigation in Flow Matching Models
and 1 more not named here
FluxParams
brick of this paper's assembly: helper
4 other papers
1 the same month, 3 later · 4 only as an assembly brick
2502.01105 (2025-02)
LayerTracer: Cognitive-Aligned Layered SVG Synthesis via Diffusion Transformer
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
2602.00883 (2026-02)
DIAMOND: Directed Inference for Artifact Mitigation in Flow Matching Models
and 1 more not named here
LastLayer
brick of this paper's assembly: helper
4 other papers
1 the same month, 3 later · 3 only as an assembly brick
2502.01105 (2025-02)
LayerTracer: Cognitive-Aligned Layered SVG Synthesis via Diffusion Transformer
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
2602.00883 (2026-02)
DIAMOND: Directed Inference for Artifact Mitigation in Flow Matching Models
and 1 more not named here
get_lin_function
brick of this paper's assembly: helper
4 other papers
2 dated earlier, 2 later
2411.04746 (2024-11)
Taming Rectified Flow for Inversion and Editing
2412.07517 (2024-12)
FireFlow: Fast Inversion of Rectified Flow for Image Semantic Editing
2504.17761 (2025-04)
Step1X-Edit: A Practical Framework for General Image Editing
and 1 more not named here
MLPEmbedder
brick of this paper's assembly: helper
3 other papers
3 later · 2 only as an assembly brick
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
2602.00883 (2026-02)
DIAMOND: Directed Inference for Artifact Mitigation in Flow Matching Models
2606.17584 (2026-06)
Root-Selecting Fixed-Point Inversion for Rectified Flows via Trajectory Straightness
RMSNorm
brick of this paper's assembly: helper
3 other papers
1 the same month, 2 later · 2 only as an assembly brick
2502.04320 (2025-02)
ConceptAttention: Diffusion Transformers Learn Highly Interpretable Features
2602.00883 (2026-02)
DIAMOND: Directed Inference for Artifact Mitigation in Flow Matching Models
2606.17584 (2026-06)
Root-Selecting Fixed-Point Inversion for Rectified Flows via Trajectory Straightness
SelfAttention
brick of this paper's assembly: helper
3 other papers
2 the same month, 1 later
2502.01105 (2025-02)
LayerTracer: Cognitive-Aligned Layered SVG Synthesis via Diffusion Transformer
2502.04320 (2025-02)
ConceptAttention: Diffusion Transformers Learn Highly Interpretable Features
2606.17584 (2026-06)
Root-Selecting Fixed-Point Inversion for Rectified Flows via Trajectory Straightness
time_shift
brick of this paper's assembly: helper
3 other papers
2 dated earlier, 1 later
2411.04746 (2024-11)
Taming Rectified Flow for Inversion and Editing
2412.07517 (2024-12)
FireFlow: Fast Inversion of Rectified Flow for Image Semantic Editing
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
get_schedule
brick of this paper's assembly: helper
2 other papers
2 later
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
2504.17761 (2025-04)
Step1X-Edit: A Practical Framework for General Image Editing
AutoEncoderParams
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
print_load_warning
brick of this paper's assembly: helper
1 other paper
1 later · 1 only as an assembly brick
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
unpack
brick of this paper's assembly: helper
1 other paper
1 later
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

ground 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 memory consumption of KV cache during editing and optimize the space complexity from O(N ) to O(1) using an inversionfree method. Our approach is compatible with any DiTbased generative model without additional training. Experiments demonstrate that KV-Edit significantly outperforms existing approaches in terms of both background and image This ICCV paper is the Open Access version, provided by the Computer Vision Foundation. Except for this watermark, it is identical to the accepted version; the final published version of the proceedings is available on IEEE Xplore.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2502.17363")
get_code_for_paper("2502.17363")
have("2502.17363")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2502.17363.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2502.17363.svg)](https://syntology.ai/paper/2502.17363)

Connect an agent — have() is free.