SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2412.12974 · 2024

Attentive Eraser: Unleashing Diffusion Model's Object Removal Potential via Self-Attention Redirection Guidance

arXiv · PDF · Open in the Atlas

Code that ran

9 of 13 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; 2 honoured the contract we drafted, 3 violated it and 1 has no contract verdict; 3 failures of our instrument; 4 no recorded run), measured 2026-11-22; 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/2412.12974.json · badge: /api/ran/2412.12974.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
anonym0u3/attentiveeraser canonical (classifier label)
classifier basis: census
9 ran · 4 no recorded run
FunctionStatusWhere it lives
Fourier_filter Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
anonym0u3/attentiveeraser/utils.py
code served (permissive licence) · get_code("4c4fb4372c440cb1")
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 4, dtype family float, shape (2, 3, 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 torch.fft as fft

torch.manual_seed(0)

# Create a small 4D tensor (B, C, H, W)
# Using distinct sizes: batch=2, channels=3, height=4, width=8
x_in = torch.randn(2, 3, 4, 8, dtype=torch.float32)

# threshold: integer value controlling the size of the low-frequency region to scale
threshold = 1

# scale: float value to multiply the low-frequency mask by
scale = 0.5

ARGS = {
    "x_in": x_in,
    "threshold": threshold,
    "scale": scale,
}
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 4, dtype family float, shape (2, 3, 4, 8) — shape (2, 3, 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
ceil_modulo Ran
ran, honoured the contract we drafted
anonym0u3/attentiveeraser/evaluation/lpips_score.py
code served (permissive licence) · get_code("c925ce390296992d")
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 int, ndim 0, dtype family int, shape () 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

torch.manual_seed(0)

# ceil_modulo takes two parameters: x and mod
# x should be an integer (used with % and // operators)
# mod should be an integer (used as divisor and multiplier)

ARGS = {
    "x": 10,
    "mod": 3
}
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 int, ndim 0, dtype family int, shape () — shape () 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
isinstance_str Ran
ran, violated the contract we drafted
anonym0u3/attentiveeraser/utils.py
code served (permissive licence) · get_code("cd5d5067de871c97")
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 bool, ndim 0, dtype family float, shape () 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

torch.manual_seed(0)

# Create a simple object to test isinstance_str
class CustomClass:
    pass

class DerivedClass(CustomClass):
    pass

# Create an instance of DerivedClass
obj = DerivedClass()

# Test with a class name that exists in the MRO
cls_name_valid = "DerivedClass"

# Test with a class name that exists in parent MRO
cls_name_parent = "CustomClass"

# Test with a class name that doesn't exist
cls_name_invalid = "NonExistentClass"

# Also test with built-in types
tensor = torch.randn(2, 4)
cls_name_tensor = "Tensor"

# Construct ARGS for the function
ARGS = {
    "x": obj,
    "cls_name": cls_name_valid
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () 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
l2 Ran
ran, violated the contract we drafted
anonym0u3/attentiveeraser/evaluation/lpips.py
code served (permissive licence) · get_code("cebd4a767f96722b")
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 float32, ndim 0, dtype family float, shape () 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 numpy as np
import torch

# Set seed for reproducibility
torch.manual_seed(0)

# Create two small numpy arrays as inputs
# The function computes L2 distance between normalized versions of p0 and p1
p0 = np.random.rand(2, 4).astype(np.float32) * 255.0
p1 = np.random.rand(2, 4).astype(np.float32) * 255.0

# range parameter with default value
range_val = 255.0

# Construct the ARGS dict with all function parameters
ARGS = {
    "p0": p0,
    "p1": p1,
    "range": range_val
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float32, ndim 0, dtype family float, shape () — shape () 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
load_image Ran
ran, honoured the contract we drafted
anonym0u3/attentiveeraser/evaluation/lpips_score.py
code served (permissive licence) · get_code("e6809c12159dbf7b")
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 ndarray, ndim 3, dtype family float, shape (3, 256, 256) 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 numpy as np
import PIL.Image as Image
import tempfile
import os

# Create a temporary image file for testing
temp_dir = tempfile.mkdtemp()
temp_image_path = os.path.join(temp_dir, "test_image.png")

# Create a simple RGB image and save it
test_array = np.random.randint(0, 256, (100, 100, 3), dtype=np.uint8)
test_image = Image.fromarray(test_array, mode='RGB')
test_image.save(temp_image_path)

ARGS = {
    'fname': temp_image_path,
    'mode': 'RGB',
    'eval_resolution': 256,
    'return_orig': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float, shape (3, 256, 256) — shape (3, 256, 256) 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
move_to_device Ran
ran; our contract draft was wrong, not the code
anonym0u3/attentiveeraser/evaluation/lpips_score.py
code served (permissive licence) · get_code("b30cecbde78e6922")
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 dict. 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)

# Create a small neural network module
class SimpleModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 3)
    
    def forward(self, x):
        return self.linear(x)

model = SimpleModel()

# Create tensors with distinct sizes
tensor1 = torch.randn(2, 4)
tensor2 = torch.randn(3, 5)

# Create various nested structures
nested_list = [tensor1, tensor2]
nested_tuple = (tensor1, tensor2)
nested_dict = {
    'tensor': tensor1,
    'model': model,
    'list': [tensor2, tensor1],
    'nested_dict': {'t': tensor2}
}

# Device to move to
device = 'cpu'

# Test with different object types
ARGS = {
    'obj': nested_dict,
    'device': device
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
normalize_tensor Ran
ran; our contract draft was wrong, not the code
anonym0u3/attentiveeraser/evaluation/lpips.py
code served (permissive licence) · get_code("15df2c2c65353c11")
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 2, dtype family float, shape (2, 4) 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

torch.manual_seed(0)

# Construct a small input tensor with shape (batch=2, dim=4)
in_feat = torch.randn(2, 4)

ARGS = {
    "in_feat": in_feat,
    "eps": 1e-10
}
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 2, dtype family float, shape (2, 4) — shape (2, 4) 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
pad_img_to_modulo Ran
ran on a synthesized input
anonym0u3/attentiveeraser/AAS/data.py
code served (permissive licence) · get_code("5db84139b1c887ad")
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 ndarray, ndim 3, dtype family float, shape (3, 8, 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 numpy as np

# Create a small test image with shape (channels, height, width)
# Using distinct dimensions: 3 channels, 5 height, 7 width
img = np.random.rand(3, 5, 7).astype(np.float32)

# Define modulo value
mod = 8

ARGS = {
    "img": img,
    "mod": mod,
}
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 ndarray, ndim 3, dtype family float, shape (3, 8, 8) — shape (3, 8, 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
psnr Ran
ran, violated the contract we drafted
anonym0u3/attentiveeraser/evaluation/lpips.py
code served (permissive licence) · get_code("e844cf206c6621e3")
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 float32, ndim 0, dtype family float, shape () 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 numpy as np

# Create two small image arrays with the same shape
# p0 and p1 should be numeric arrays (images or image-like data)
p0 = np.random.rand(2, 4).astype(np.float32) * 255.0
p1 = np.random.rand(2, 4).astype(np.float32) * 255.0

# peak is the maximum possible pixel value (typically 255 for 8-bit images)
peak = 255.0

ARGS = {
    "p0": p0,
    "p1": p1,
    "peak": peak
}
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 float32, ndim 0, dtype family float, shape () — shape () 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
get_frechet_inception_distance Not yet run
unverified (harvested, no recorded run)
anonym0u3/attentiveeraser/evaluation/fid.py
code served (permissive licence) · get_code("9a3ae445a49ae8f0")
How it ran

no invocation recorded.

pad_tensor_to_modulo Not yet run
unverified (harvested, no recorded run)
anonym0u3/attentiveeraser/AAS/data.py
code served (permissive licence) · get_code("223f8559389c0619")
How it ran

no invocation recorded.

regiter_attention_editor_diffusers Not yet run
unverified (harvested, no recorded run)
anonym0u3/attentiveeraser/AAS/AAS_utils.py
code served (permissive licence) · get_code("d321812b8f73ef4b")
How it ran

no invocation recorded.

regiter_attention_editor_ldm Not yet run
unverified (harvested, no recorded run)
anonym0u3/attentiveeraser/AAS/AAS_utils.py
code served (permissive licence) · get_code("431f768e76ae86fa")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 13 distinct functions with an identity, 8 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 1 the same month, 1 later) and 5 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
normalize_tensor 11 other papers
10 dated earlier, 1 the same month
2002.09219 (2020-02)
Stochastic Latent Residual Video Prediction
2103.16194 (2021-03)
Differentiable Drawing and Sketching
2111.14292 (2021-11)
Deblur-NeRF: Neural Radiance Fields from Blurry Images
and 8 more not named here
isinstance_str 10 other papers
7 dated earlier, 3 later
2303.17604 (2023-03)
Token Merging for Fast Stable Diffusion
2307.10373 (2023-07)
TokenFlow: Consistent Diffusion Features for Consistent Video Editing
2312.02212 (2023-12)
Portrait Diffusion: Training-free Face Stylization with Chain-of-Painting
and 7 more not named here
l2 6 other papers
6 dated earlier
2002.09219 (2020-02)
Stochastic Latent Residual Video Prediction
2111.14292 (2021-11)
Deblur-NeRF: Neural Radiance Fields from Blurry Images
2211.12046 (2022-11)
DP-NeRF: Deblurred Neural Radiance Field with Physical Scene Priors
and 3 more not named here
psnr 6 other papers
6 dated earlier
2002.09219 (2020-02)
Stochastic Latent Residual Video Prediction
2111.14292 (2021-11)
Deblur-NeRF: Neural Radiance Fields from Blurry Images
2211.12046 (2022-11)
DP-NeRF: Deblurred Neural Radiance Field with Physical Scene Priors
and 3 more not named here
regiter_attention_editor_ldm 4 other papers
4 dated earlier
2304.08465 (2023-04)
MasaCtrl: Tuning-Free Mutual Self-Attention Control for Consistent Image Synthesis and Editing
2311.16491 (2023-11)
$Z^*$: Zero-shot Style Transfer via Attention Rearrangement
2312.02212 (2023-12)
Portrait Diffusion: Training-free Face Stylization with Chain-of-Painting
and 1 more not named here
regiter_attention_editor_diffusers 3 other papers
3 dated earlier
2304.08465 (2023-04)
MasaCtrl: Tuning-Free Mutual Self-Attention Control for Consistent Image Synthesis and Editing
2311.16491 (2023-11)
$Z^*$: Zero-shot Style Transfer via Attention Rearrangement
2312.02212 (2023-12)
Portrait Diffusion: Training-free Face Stylization with Chain-of-Painting
ceil_modulo 1 other paper
1 same year, order not determinable
aaai_28503 (2024 (year only))
Step Vulnerability Guided Mean Fluctuation Adversarial Attack against Conditional Diffusion Models
pad_img_to_modulo 1 other paper
1 same year, order not determinable
aaai_28503 (2024 (year only))
Step Vulnerability Guided Mean Fluctuation Adversarial Attack against Conditional Diffusion Models

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

Recently, diffusion models have emerged as promising newcomers in the field of generative models, shining brightly in image generation. However, when employed for object removal tasks, they still encounter issues such as generating random artifacts and the incapacity to repaint foreground object areas with appropriate content after removal. To tackle these problems, we propose Attentive Eraser, a tuning-free method to empower pre-trained diffusion models for stable and effective object removal. Firstly, in light of the observation that the self-attention maps influence the structure and shape details of the generated images, we propose Attention Activation and Suppression (ASS), which re-engineers the self-attention mechanism within the pre-trained diffusion models based on the given mask, thereby prioritizing the background over the foreground object during the reverse generation process. Moreover, we introduce Self-Attention Redirection Guidance (SARG), which utilizes the self-attention redirected by ASS to guide the generation process, effectively removing foreground objects within the mask while simultaneously generating content that is both plausible and coherent. Experiments demonstrate the stability and effectiveness of Attentive Eraser in object removal across a variety of pre-trained diffusion models, outperforming even training-based methods. Furthermore, Attentive Eraser can be implemented in various diffusion model architectures and checkpoints, enabling excellent scalability. Code is available at https://github.com/Anonym0u3/AttentiveEraser.

For agents

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

get_harvested_code_for_paper("2412.12974")
get_code_for_paper("2412.12974")
have("2412.12974")

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

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

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

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

Connect an agent — have() is free.