SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.19898 · CVPR · 2024

Structure Matters: Tackling the Semantic Discrepancy in Diffusion Models for Image Inpainting

Yang Wang, Meng Wang, Yong Rui, Haipeng Liu, Biao Qian, Denoise Denoise

arXiv · PDF · Open in the Atlas

Code that ran

11 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; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 11 failures of our instrument; 2 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/2403.19898.json · badge: /api/ran/2403.19898.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
htyjers/StrDiffusion canonical (classifier label)
classifier basis: census
11 ran · 2 no recorded run
FunctionStatusWhere it lives
dense Ran
ran; our contract draft was wrong, not the code
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/dense_layer.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from NVlabs/denoising-diffusion-gan, is pointer only (licence: NOASSERTION) · get_code("9f13fd20494eac47")
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 NVlabs/denoising-diffusion-gan, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

dict2str Ran
ran; our contract draft was wrong, not the code
htyjers/StrDiffusion/train/discriminator/config/inpainting/options.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from liyuantsao/BFSR, is pointer only (licence: NONE) · get_code("40c52ad98161c17b")
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 liyuantsao/BFSR, 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.

dict_to_nonedict Ran
ran; our contract draft was wrong, not the code
htyjers/StrDiffusion/train/discriminator/config/inpainting/options.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from liyuantsao/BFSR, is pointer only (licence: NONE) · get_code("ada7273eee7081c7")
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 liyuantsao/BFSR, 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_act Ran
ran; our contract draft was wrong, not the code
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/layers.py
code served (permissive licence) · get_code("db5f935a1d6b4c2c")
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 ReLU. 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)

class Config:
    def __init__(self, nonlinearity):
        self.model = self
        self.nonlinearity = nonlinearity

# Test with 'relu' as the nonlinearity
config = Config('relu')

ARGS = {
    'config': config
}
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 ReLU — a ReLU output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ReLU 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_weight Ran
ran; our contract draft was wrong, not the code
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/up_or_down_sampling.py
code served (permissive licence) · get_code("8db300b9f1afb2d3")
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 (3, 4, 5, 5) 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)

class MockModule(nn.Module):
    def __init__(self):
        super().__init__()
        self.params = {}
    
    def param(self, name, init_fn, shape):
        """Create or retrieve a parameter with given shape."""
        if name not in self.params:
            if init_fn is None:
                # Default initialization
                self.params[name] = torch.randn(shape)
            else:
                self.params[name] = init_fn(shape)
        return self.params[name]

def mock_kernel_init(shape):
    """Simple kernel initialization function."""
    return torch.ones(shape) * 0.1

module = MockModule()
shape = (3, 4, 5, 5)
weight_var = 'weight'
kernel_init = mock_kernel_init

ARGS = {
    'module': module,
    'shape': shape,
    'weight_var': weight_var,
    'kernel_init': kernel_init
}
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 (3, 4, 5, 5) — shape (3, 4, 5, 5) 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
kaiming_uniform_ Ran
ran; our contract draft was wrong, not the code
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/dense_layer.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from NVlabs/denoising-diffusion-gan, is pointer only (licence: NOASSERTION) · get_code("b42da332ce0ead42")
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 NVlabs/denoising-diffusion-gan, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

naive_downsample_2d Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/up_or_down_sampling.py
code served (permissive licence) · get_code("e0ca74cc0ccd0e50")
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, 4, 4, 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

torch.manual_seed(0)

# Create a small input tensor
# Shape: (batch=2, channels=4, height=8, width=6)
# Using distinct dimensions so we can verify the output shape
x = torch.randn(2, 4, 8, 6)

# Factor for downsampling
factor = 2

ARGS = {
    "x": x,
    "factor": factor,
}
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, 4, 4, 3) — shape (2, 4, 4, 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
naive_upsample_2d Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/up_or_down_sampling.py
code served (permissive licence) · get_code("f425357463a3de36")
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, 4, 6, 10) 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)

# Create a small input tensor: (batch=2, channels=4, height=3, width=5)
x = torch.randn(2, 4, 3, 5)

# Define the factor for upsampling
factor = 2

ARGS = {
    'x': x,
    'factor': factor,
}
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, 4, 6, 10) — shape (2, 4, 6, 10) 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
ncsn_conv1x1 Ran
ran; our contract draft was wrong, not the code
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/layers.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from SusanneSchaub/TPDM_Implant_Inpainting, is pointer only (licence: NONE) · get_code("85b2235eb7afaa4f")
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 SusanneSchaub/TPDM_Implant_Inpainting, 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.

variance_scaling Ran
ran; our contract draft was wrong, not the code
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/layers.py
code served (permissive licence) · get_code("3ac11bfe0ae80195")
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
import numpy as np

torch.manual_seed(0)

ARGS = {
    'scale': 2.0,
    'mode': 'fan_in',
    'distribution': 'normal',
    'in_axis': 1,
    'out_axis': 0,
    'dtype': torch.float32,
    'device': 'cpu'
}
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 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
variance_scaling_init_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/dense_layer.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from NVlabs/denoising-diffusion-gan, is pointer only (licence: NOASSERTION) · get_code("49cf191f770c146a")
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 NVlabs/denoising-diffusion-gan, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

gray_to_edge Not yet run
unverified (harvested, no recorded run)
htyjers/StrDiffusion/train/discriminator/config/inpainting/models/canny.py
code served (permissive licence) · get_code("f364b5647cd1f451")
How it ran

no invocation recorded.

parse Not yet run
unverified (harvested, no recorded run)
htyjers/StrDiffusion/train/discriminator/config/inpainting/options.py
code served (permissive licence) · get_code("2178a45bccb10af5")
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, 11 are also present in other papers whose code we hold (11 with at least one paper dated earlier, 2 the same month, 11 later) and 2 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
variance_scaling 28 other papers
16 dated earlier, 12 later
2106.05527 (2021-06)
Soft Truncation: A Universal Training Technique of Score-based Diffusion Model for High Precision Score Estimation
2110.05243 (2021-10)
Score-based diffusion models for accelerated MRI
2205.01490 (2022-05)
Subspace Diffusion Generative Models
and 25 more not named here
dict2str 23 other papers
18 dated earlier, 1 the same month, 3 later, 1 same year, order not determinable
1905.02716 (2019-05)
EDVR: Video Restoration with Enhanced Deformable Convolutional Networks
1907.03222 (2019-07)
IRNet: A General Purpose Deep Residual Regression Framework for Materials Discovery
2005.05650 (2020-05)
Invertible Image Rescaling
and 20 more not named here
dict_to_nonedict 19 other papers
14 dated earlier, 1 the same month, 3 later, 1 same year, order not determinable
1609.04802 (2016-09)
Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network
1905.02716 (2019-05)
EDVR: Video Restoration with Enhanced Deformable Convolutional Networks
2006.14200 (2020-06)
SRFlow: Learning the Super-Resolution Space with Normalizing Flow
and 16 more not named here
ncsn_conv1x1 19 other papers
9 dated earlier, 10 later
2106.05527 (2021-06)
Soft Truncation: A Universal Training Technique of Score-based Diffusion Model for High Precision Score Estimation
2110.05243 (2021-10)
Score-based diffusion models for accelerated MRI
2205.01490 (2022-05)
Subspace Diffusion Generative Models
and 16 more not named here
get_act 16 other papers
9 dated earlier, 7 later
2106.05527 (2021-06)
Soft Truncation: A Universal Training Technique of Score-based Diffusion Model for High Precision Score Estimation
2110.05243 (2021-10)
Score-based diffusion models for accelerated MRI
2205.01490 (2022-05)
Subspace Diffusion Generative Models
and 13 more not named here
get_weight 6 other papers
2 dated earlier, 4 later
2211.13449 (2022-11)
Fast Sampling of Diffusion Models via Operator Learning
2303.05456 (2023-03)
Restoration based Generative Models
2407.12718 (2024-07)
SlimFlow: Training Smaller One-Step Diffusion Models with Rectified Flow
and 3 more not named here
naive_downsample_2d 5 other papers
1 dated earlier, 4 later
2303.05456 (2023-03)
Restoration based Generative Models
2407.12718 (2024-07)
SlimFlow: Training Smaller One-Step Diffusion Models with Rectified Flow
2412.04987 (2024-12)
FlowPolicy: Enabling Fast and Robust 3D Flow-based Policy via Consistency Flow Matching for Robot Manipulation
and 2 more not named here
naive_upsample_2d 5 other papers
1 dated earlier, 4 later
2303.05456 (2023-03)
Restoration based Generative Models
2407.12718 (2024-07)
SlimFlow: Training Smaller One-Step Diffusion Models with Rectified Flow
2412.04987 (2024-12)
FlowPolicy: Enabling Fast and Robust 3D Flow-based Policy via Consistency Flow Matching for Robot Manipulation
and 2 more not named here
dense 3 other papers
2 dated earlier, 1 later
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2303.05456 (2023-03)
Restoration based Generative Models
2508.19857 (2025-08)
Quantum latent distributions in deep generative models
kaiming_uniform_ 3 other papers
2 dated earlier, 1 later
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2303.05456 (2023-03)
Restoration based Generative Models
2508.19857 (2025-08)
Quantum latent distributions in deep generative models
variance_scaling_init_ 3 other papers
2 dated earlier, 1 later
2006.11239 (2020-06)
Denoising Diffusion Probabilistic Models
2303.05456 (2023-03)
Restoration based Generative Models
2508.19857 (2025-08)
Quantum latent distributions in deep generative 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

Denoising diffusion probabilistic models (DDPMs) for image inpainting aim to add the noise to the texture of the image during the forward process and recover the masked regions with the unmasked ones of the texture via the reverse denoising process. Despite the meaningful semantics generation, the existing arts suffer from the semantic discrepancy between the masked and unmasked regions, since the semantically dense unmasked texture fails to be completely degraded while the masked regions turn to the pure noise in diffusion process, leading to the large discrepancy between them. In this paper, we aim to answer how the unmasked semantics guide the texture denoising process; together with how to tackle the semantic discrepancy, to facilitate the consistent and meaningful semantics generation. To this end, we propose a novel structure-guided diffusion model for image inpainting named StrDiffusion, to reformulate the conventional texture denoising process under the structure guidance to derive a simplified denoising objective for image inpainting, while revealing: 1) the semantically sparse structure is beneficial to tackle the semantic discrepancy in the early stage, while the dense texture generates the reasonable semantics in the late stage; 2) the semantics from the unmasked regions essentially offer the time-dependent structure guidance for the texture denoising process, benefiting from the time-dependent sparsity of the structure semantics. For the denoising process, a structure-guided neural network is trained to estimate the simplified denoising objective by exploiting the consistency of the denoised structure between masked and unmasked regions. Besides, we devise an adaptive resampling strategy as a formal criterion as whether the structure is competent to guide the texture denoising process, while regulate their semantic correlations. Extensive experiments validate the merits of StrDiffusion over the state-of-the-arts. Our code is available at https://github.com/htyjers/StrDiffusion.

For agents

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

get_harvested_code_for_paper("2403.19898")
get_code_for_paper("2403.19898")
have("2403.19898")

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

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

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

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

Connect an agent — have() is free.