SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · aaai_28210 · AAAI · 2024

AdapEdit: Spatio-Temporal Guided Adaptive Editing Algorithm for Text-Based Continuity-Sensitive Image Editing

Bowen Zhou, Zhiyuan Ma, Guoli Jia

Open in the Atlas

Code that ran

8 of 12 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 3 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 4 failures of our instrument; 4 no recorded run), measured 2026-11-22; 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/aaai_28210.json · badge: /api/ran/aaai_28210.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
AnonymousPony/adap-edit canonical (classifier label)
classifier basis: census
8 ran · 4 no recorded run
FunctionStatusWhere it lives
aggregate_attention Ran
ran, honoured the contract we drafted
AnonymousPony/adap-edit/prompt-to-prompt_stable.py
code served (permissive licence) · get_code("5589c49ba7cefbe3")
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 3, dtype family float, shape (4, 4, 8) 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
import abc
from typing import Optional, Union, Tuple, List, Callable, Dict

torch.manual_seed(0)

LOW_RESOURCE = False

class AttentionControl(abc.ABC):

    def step_callback(self, x_t):
        return x_t

    def between_steps(self):
        return

    @property
    def num_uncond_att_layers(self):
        return self.num_att_layers if LOW_RESOURCE else 0

    @abc.abstractmethod
    def forward(self, attn, is_cross: bool, place_in_unet: str):
        raise NotImplementedError

    def __call__(self, attn, is_cross: bool, place_in_unet: str, query):
        if self.cur_att_layer >= self.num_uncond_att_layers:
            if LOW_RESOURCE:
                attn = self.forward(attn, is_cross, place_in_unet, query)
            else:
                h = attn.shape[0]
                attn[h // 2:] = self.forward(attn[h // 2:], is_cross, place_in_unet, query)
        self.cur_att_layer += 1
        if self.cur_att_layer == self.num_att_layers + self.num_uncond_att_layers:
            self.cur_att_layer = 0
            self.cur_step += 1
            self.between_steps()
        return attn

    def reset(self):
        self.cur_step = 0
        self.cur_att_layer = 0

    def __init__(self):
        self.cur_step = 0
        self.num_att_layers = -1
        self.cur_att_layer = 0

class AttentionStore(AttentionControl):

    @staticmethod
    def get_empty_store():
        return {'down_cross': [], 'mid_cross': [], 'up_cross': [], 'down_self': [], 'mid_self': [], 'up_self': []}

    def forward(self, attn, is_cross: bool, place_in_unet: str, query):
        key = f"{place_in_unet}_{('cross' if is_cross else 'self')}"
        if attn.shape[1] <= 32 ** 2:
            self.step_store[key].append(attn)
        return attn

    def between_steps(self):
        if len(self.attention_store) == 0:
            self.attention_store = self.step_store
        else:
            for key in self.attention_store:
                for i in range(len(self.attention_store[key])):
                    self.attention_store[key][i] += self.step_store[key][i]
        self.step_store = self.get_empty_store()

    def get_average_attention(self):
        average_attention = {key: [item / self.cur_step for item in self.attention_store[key]] for key in self.attention_store}
        return average_attention

    def reset(self):
        super(AttentionStore, self).reset()
        self.step_store = self.get_empty_store()
        self.attention_store = {}

    def __init__(self):
        super(AttentionStore, self).__init__()
        self.step_store = self.get_empty_store()
        self.attention_store = {}

def aggregate_attention(attention_store: AttentionStore, res: int, from_where: List[str], is_cross: bool, select: int):
    out = []
    attention_maps = attention_store.get_average_attention()
    num_pixels = res ** 2
    for location in from_where:
        for item in attention_maps[f"{location}_{('cross' if is_cross else 'self')}"]:
            if item.shape[1] == num_pixels:
                cross_maps = item.reshape(len(prompts), -1, res, res, item.shape[-1])[select]
                out.append(cross_maps)
    out = torch.cat(out, dim=0)
    out = out.sum(0) / out.shape[0]
    return out.cpu()

prompts = ['A man standing on the grass', 'A man sitting on the grass , holding a cup']

attention_store = AttentionStore()
attention_store.num_att_layers = 2
attention_store.cur_step = 2

res = 4
num_pixels = res ** 2

attn_tensor = torch.randn(2, num_pixels, 8)
attention_store.step_store['down_cross'].append(attn_tensor)
attention_store.step_store['down_cross'].append(attn_tensor)

attention_store.attention_store = {
    'down_cross': [attn_tensor.clone(), attn_tensor.clone()],
    'mid_cross': [],
    'up_cross': [],
    'down_self': [],
    'mid_self': [],
    'up_self': []
}

ARGS = {
    'attention_store': attention_store,
    'res': res,
    'from_where': ['down'],
    'is_cross': True,
    'select': 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 Tensor, ndim 3, dtype family float, shape (4, 4, 8) — shape (4, 4, 8) 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
diffusion_step Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AnonymousPony/adap-edit/ptp_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from TFNTF/PostEdit, is pointer only (licence: NONE) · get_code("a042902caede448b")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from TFNTF/PostEdit, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_matrix Ran
ran; our contract draft was wrong, not the code
AnonymousPony/adap-edit/seq_aligner.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Supercomputing-System-AI-Lab/InstantEdit, is pointer only (licence: NONE) · get_code("d167441d997c52ce")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Supercomputing-System-AI-Lab/InstantEdit, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_matrix Ran
ran, honoured the contract we drafted
AnonymousPony/adap-edit/seq_aligner.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Supercomputing-System-AI-Lab/InstantEdit, is pointer only (licence: NONE) · get_code("81db21bf982ca0fe")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Supercomputing-System-AI-Lab/InstantEdit, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_traceback_matrix Ran
ran, honoured the contract we drafted
AnonymousPony/adap-edit/seq_aligner.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from Supercomputing-System-AI-Lab/InstantEdit, is pointer only (licence: NONE) · get_code("beb8f6a30678a4d9")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from Supercomputing-System-AI-Lab/InstantEdit, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

latent2image Ran
ran; our contract draft was wrong, not the code
AnonymousPony/adap-edit/ptp_utils.py
code served (permissive licence) · get_code("e3c3bb87bbe9b4a7")
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) and returned ndarray, ndim 4, dtype family int, shape (2, 32, 32, 3) 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
import torch.nn as nn
import numpy as np

torch.manual_seed(0)

class MockVAE(nn.Module):
    def __init__(self):
        super().__init__()
        self.decoder_layer = nn.Linear(4, 768)
    
    def decode(self, latents):
        # latents shape: (batch, channels, height, width)
        # We need to return a dict with 'sample' key containing decoded image
        batch_size = latents.shape[0]
        # Return a tensor of shape (batch, 3, 32, 32) for RGB image
        sample = torch.randn(batch_size, 3, 32, 32)
        return {'sample': sample}

vae = MockVAE()
latents = torch.randn(2, 4, 8, 8)

ARGS = {
    'vae': vae,
    'latents': latents
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 4, dtype family int, shape (2, 32, 32, 3) — shape (2, 32, 32, 3) 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
sort_by_eq Ran
ran on a synthesized input
AnonymousPony/adap-edit/prompt-to-prompt_ldm.py
code served (permissive licence) · get_code("7836916f34f233cf")
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 numpy as np

def sort_by_eq(eq):
    def inner_(images):
        swap = 0
        if eq[-1] < 1:
            for i in range(len(eq)):
                if eq[i] > 1 and eq[i + 1] < 1:
                    swap = i + 2
                    break
        else:
            for i in range(len(eq)):
                if eq[i] < 1 and eq[i + 1] > 1:
                    swap = i + 2
                    break
        print(swap)
        if swap > 0:
            images = np.concatenate([images[1:swap], images[:1], images[swap:]], axis=0)
        return images
    return inner_

# Create valid arguments for sort_by_eq
eq = np.array([0.5, 2.0, 0.3, 1.5])

ARGS = {
    "eq": eq
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — 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
text_under_image Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
AnonymousPony/adap-edit/ptp_utils.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from TFNTF/PostEdit, is pointer only (licence: NONE) · get_code("85d5eb123674597d")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from TFNTF/PostEdit, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

aggregate_attention Not yet run
unverified (harvested, no recorded run)
AnonymousPony/adap-edit/prompt-to-prompt_ldm.py
code served (permissive licence) · get_code("1acfda981f18f522")
How it ran

no invocation recorded.

calculate_activation_statistics Not yet run
unverified (harvested, no recorded run)
AnonymousPony/adap-edit/metrics/fid_score.py
code served (permissive licence) · get_code("c70d258cbceaa86d")
How it ran

no invocation recorded.

calculate_frechet_distance Not yet run
unverified (harvested, no recorded run)
AnonymousPony/adap-edit/metrics/fid_score.py
code served (permissive licence) · get_code("0def50a351111624")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

get_activations Not yet run
unverified (harvested, no recorded run)
AnonymousPony/adap-edit/metrics/fid_score.py
code served (permissive licence) · get_code("dd23efc80f413d67")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 10 are also present in other papers whose code we hold (10 with at least one paper dated earlier, 0 the same month, 4 later) and 1 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
calculate_frechet_distance 74 other papers
51 dated earlier, 6 later, 17 same year, order not determinable
1610.09585 (2016-10)
Conditional Image Synthesis With Auxiliary Classifier GANs
1706.08500 (2017-06)
GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium
1807.11458 (2018-07)
To learn image super-resolution, use a GAN to learn how to do image degradation first
and 71 more not named here
text_under_image 14 other papers
6 dated earlier, 8 same year, order not determinable
2307.12493 (2023-07)
TF-ICON: Diffusion-Based Training-Free Cross-Domain Image Composition
2307.14352 (2023-07)
General Image-to-Image Translation with One-Shot Image Guidance
2309.14494 (2023-09)
Free-Bloom: Zero-Shot Text-to-Video Generator with LLM Director and LDM Animator
and 11 more not named here
latent2image 13 other papers
7 dated earlier, 6 same year, order not determinable
2305.15581 (2023-05)
Unsupervised Semantic Correspondence Using Stable Diffusion
2305.19164 (2023-05)
LANCE: Stress-testing Visual Models by Generating Language-guided Counterfactual Images
2308.06160 (2023-08)
DatasetDM: Synthesizing Data with Perception Annotations Using Diffusion Models
and 10 more not named here
get_matrix 11 other papers
6 dated earlier, 2 later, 3 same year, order not determinable
2208.01626 (2022-08)
Prompt-to-Prompt Image Editing with Cross Attention Control
2305.19164 (2023-05)
LANCE: Stress-testing Visual Models by Generating Language-guided Counterfactual Images
2307.14352 (2023-07)
General Image-to-Image Translation with One-Shot Image Guidance
and 8 more not named here
diffusion_step 10 other papers
6 dated earlier, 4 same year, order not determinable
2305.19164 (2023-05)
LANCE: Stress-testing Visual Models by Generating Language-guided Counterfactual Images
2308.06160 (2023-08)
DatasetDM: Synthesizing Data with Perception Annotations Using Diffusion Models
2309.14494 (2023-09)
Free-Bloom: Zero-Shot Text-to-Video Generator with LLM Director and LDM Animator
and 7 more not named here
get_traceback_matrix 10 other papers
5 dated earlier, 2 later, 3 same year, order not determinable
2305.19164 (2023-05)
LANCE: Stress-testing Visual Models by Generating Language-guided Counterfactual Images
2307.14352 (2023-07)
General Image-to-Image Translation with One-Shot Image Guidance
2308.06160 (2023-08)
DatasetDM: Synthesizing Data with Perception Annotations Using Diffusion Models
and 7 more not named here
get_matrix 9 other papers
5 dated earlier, 1 later, 3 same year, order not determinable
2305.19164 (2023-05)
LANCE: Stress-testing Visual Models by Generating Language-guided Counterfactual Images
2307.14352 (2023-07)
General Image-to-Image Translation with One-Shot Image Guidance
2308.06160 (2023-08)
DatasetDM: Synthesizing Data with Perception Annotations Using Diffusion Models
and 6 more not named here
calculate_activation_statistics 6 other papers
6 dated earlier
1912.07414 (2019-12)
Learning Canonical Representations for Scene Graph to Image Generation
2003.02567 (2020-03)
GANwriting: Content-Conditioned Generation of Styled Handwritten Word Images
2006.08198 (2020-06)
AutoGAN-Distiller: Searching to Compress Generative Adversarial Networks
and 3 more not named here
aggregate_attention 3 other papers
2 dated earlier, 1 same year, order not determinable
2211.09794 (2022-11)
Null-text Inversion for Editing Real Images using Guided Diffusion Models
2307.14352 (2023-07)
General Image-to-Image Translation with One-Shot Image Guidance
2404.04960 (2024-04)
PairAug: What Can Augmented Image-Text Pairs Do for Radiology?
get_activations 2 other papers
2 dated earlier
1912.07414 (2019-12)
Learning Canonical Representations for Scene Graph to Image Generation
2303.13062 (2023-03)
SIEDOB: Semantic Image Editing by Disentangling Object and Background

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-22.

Repositories linked to this paper

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

Abstract

With the great success of text-conditioned diffusion models in creative text-to-image generation, various text-driven image editing approaches have attracted the attention of many researchers. However, previous works mainly focus on discreteness-sensitive instructions such as adding, removing or replacing specific objects, background elements or global styles (i.e., "hard editing"), while generally ignoring subject-binding but semantically fine-changing continuitysensitive instructions such as actions, poses or adjectives, and so on (i.e., "soft editing"), which hampers generative AI from generating user-customized visual contents. To mitigate this predicament, we propose a spatio-temporal guided adaptive editing algorithm AdapEdit, which realizes adaptive image editing by introducing a soft-attention strategy to dynamically vary the guiding degree from the editing conditions to visual pixels from both temporal and spatial perspectives. Note our approach has a significant advantage in preserving model priors and does not require model training, fine-tuning, extra data, or optimization. We present our results over a wide variety of raw images and editing instructions, demonstrating competitive performance and showing it significantly outperforms the previous approaches. Code is available: https://github.com/AnonymousPony/adap-edit.

For agents

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

get_harvested_code_for_paper("aaai_28210")
get_code_for_paper("aaai_28210")
have("aaai_28210")

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

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

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

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

Connect an agent — have() is free.