SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2303.16765 · 2023

MDP: A Generalized Framework for Text-Guided Image Editing by Manipulating the Diffusion Path

arXiv · PDF · Open in the Atlas

Code that ran

6 of 6 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 3 have no contract verdict; 3 failures of our instrument; 0 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/2303.16765.json · badge: /api/ran/2303.16765.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
qianwangx/mdp-diffusion canonical (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
ashutosh1919/mdp-diffusion community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
FunctionStatusWhere it lives
latents_to_pil Ran
ran; our contract draft was wrong, not the code
qianwangx/mdp-diffusion/utils.py
code served (permissive licence) · get_code("7753b6193ae841a4")
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 list, ndim 4, dtype family int; 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 torch.nn as nn
from PIL import Image

torch.manual_seed(0)

class MockVAE(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(4, 48)
    
    def decode(self, latents):
        # latents shape: (batch, 4)
        # output should be (batch, 3, 8, 8) for a typical VAE decode
        batch_size = latents.shape[0]
        # Expand latents to match expected output shape
        decoded = self.linear(latents)  # (batch, 48)
        # Reshape to (batch, 3, 4, 4)
        decoded = decoded.view(batch_size, 3, 4, 4)
        return type('obj', (object,), {'sample': decoded})()

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

ARGS = {
    'vae': vae,
    'latents': latents,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
PIL, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 4, dtype family int — a list output has no array shape of its own; none is stated
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_512 Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
qianwangx/mdp-diffusion/null_text_inversion.py
code served (permissive licence) · get_code("01b9b8df6096cefb")
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 3, dtype family int, shape (512, 512, 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 numpy as np
from PIL import Image

# Create a small test image as a numpy array (4x3x3 RGB image)
test_image = np.random.randint(0, 256, (4, 3, 3), dtype=np.uint8)

ARGS = {
    "image_path": test_image,
    "left": 0,
    "right": 0,
    "top": 0,
    "bottom": 0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 int, shape (512, 512, 3) — shape (512, 512, 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
load_512 Ran
ran on a synthesized input
ashutosh1919/mdp-diffusion/mdp/utils/utils.py
code served (permissive licence) · get_code("d099ac62798e1048")
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 int, shape (512, 512, 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 numpy as np
from PIL import Image
import io

# Create a small test image as a numpy array (4 rows, 3 cols, 3 channels - RGB)
test_image = np.random.randint(0, 256, size=(10, 8, 3), dtype=np.uint8)

# Alternatively, we could test with a string path, but since we can't do file I/O,
# we'll use the numpy array directly as the function accepts both string paths
# and numpy arrays.

ARGS = {
    "image_path": test_image,
    "left": 0,
    "right": 0,
    "top": 0,
    "bottom": 0,
}
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 int, shape (512, 512, 3) — shape (512, 512, 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
pil_to_latent Ran
ran on a synthesized input
ashutosh1919/mdp-diffusion/mdp/utils/utils.py
code served (permissive licence) · get_code("0165a514d04c54be")
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 (1, 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
import torch.nn as nn
from PIL import Image
from io import BytesIO

torch.manual_seed(0)

# Create a minimal VAE mock that has the encode method
class MockVAE(nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = nn.Linear(3 * 32 * 32, 8)
    
    def encode(self, x):
        # x shape: [batch, 3, 32, 32]
        batch_size = x.shape[0]
        # Flatten and pass through linear layer
        flattened = x.view(batch_size, -1)
        output = self.linear(flattened)
        # Return object with latent_dist attribute
        return MockLatentDist(output)

class MockLatentDist:
    def __init__(self, tensor):
        self.latent_dist = self
        self._tensor = tensor
    
    def sample(self, generator=None):
        # Return a tensor of shape [batch, 4] representing latent
        return self._tensor.view(self._tensor.shape[0], -1)[:, :4]

# Create a small PIL Image
def create_dummy_image():
    img = Image.new('RGB', (32, 32), color='red')
    return img

vae = MockVAE()
input_im = create_dummy_image()
device = torch.device('cpu')
generator = None

ARGS = {
    'vae': vae,
    'input_im': input_im,
    'device': device,
    'generator': generator,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, torch, torchvision — 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 (1, 4) — shape (1, 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
randn_tensor Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
qianwangx/mdp-diffusion/utils.py
code served (permissive licence) · get_code("58d00c5be7a6d59b")
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 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)

# Define arguments for randn_tensor function
ARGS = {
    "shape": (2, 4),  # batch_size=2, feature_dim=4
    "generator": torch.Generator(device='cpu').manual_seed(42),
    "device": torch.device('cpu'),
    "dtype": torch.float32,
    "layout": torch.strided,
}
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 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
randn_tensor Ran
ran on a synthesized input
ashutosh1919/mdp-diffusion/mdp/utils/utils.py
code served (permissive licence) · get_code("3216eff70159628a")
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, 3, 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

torch.manual_seed(0)

# The function uses:
# - shape: tuple of ints (accessed with shape[0] for batch_size)
# - generator: can be None, a single generator, or a list of generators
# - device: torch.device or None
# - dtype: torch.dtype or None
# - layout: torch.layout or None

# Create a single generator
single_generator = torch.Generator()
single_generator.manual_seed(42)

# Create a list of generators (one per batch item)
batch_size = 2
generator_list = [torch.Generator() for _ in range(batch_size)]
for i, gen in enumerate(generator_list):
    gen.manual_seed(42 + i)

ARGS = {
    "shape": (2, 4, 3, 5),  # batch_size=2, then other dims
    "generator": single_generator,
    "device": torch.device("cpu"),
    "dtype": torch.float32,
    "layout": torch.strided,
}
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, 3, 5) — shape (2, 4, 3, 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

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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.

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

Image generation using diffusion can be controlled in multiple ways. In this paper, we systematically analyze the equations of modern generative diffusion networks to propose a framework, called MDP, that explains the design space of suitable manipulations. We identify 5 different manipulations, including intermediate latent, conditional embedding, cross attention maps, guidance, and predicted noise. We analyze the corresponding parameters of these manipulations and the manipulation schedule. We show that some previous editing methods fit nicely into our framework. Particularly, we identified one specific configuration as a new type of control by manipulating the predicted noise, which can perform higher-quality edits than previous work for a variety of local and global edits.

For agents

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

get_harvested_code_for_paper("2303.16765")
get_code_for_paper("2303.16765")
have("2303.16765")

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

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

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

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

Connect an agent — have() is free.