SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2602.00883 · 2026

DIAMOND: Directed Inference for Artifact Mitigation in Flow Matching Models

Jacek Tabor, Przemysław Spurek, Joanna Waczy Ńska, Piotr Borycki, Alicja Polowczyk, Agnieszka Polowczyk

arXiv · PDF · Open in the Atlas

Code that ran

2 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (2 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 0 failures of our instrument; 5 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/2602.00883.json · badge: /api/ran/2602.00883.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
ali-vilab/DiffDoctor community
Papers with Code archive
2 ran · 5 no recorded run
FunctionStatusWhere it lives
DoubleStreamBlock Ran
ran on a synthesized input · constructed an object; no result was computed
ali-vilab/DiffDoctor/src/flux/sampling.py
code served (permissive licence) · get_code("8f0fdf7f17b06ef8")
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
from torch import Tensor
from dataclasses import dataclass
from einops import rearrange, repeat

torch.manual_seed(0)

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

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))

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):
        pass

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)

class DoubleStreamBlock(nn.Module):
    def __init__(self, hidden_size: int, num_heads: int, mlp_ratio: float, qkv_bias: bool=False):
        super().__init__()
        mlp_hidden_dim = int(hidden_size * mlp_ratio)
        self.num_heads = num_heads
        self.hidden_size = hidden_size
        self.head_dim = hidden_size // num_heads
        self.img_mod = Modulation(hidden_size, double=True)
        self.img_norm1 = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-06)
        self.img_attn = SelfAttention(dim=hidden_size, num_heads=num_heads, qkv_bias=qkv_bias)
        self.img_norm2 = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-06)
        self.img_mlp = nn.Sequential(
            nn.Linear(hidden_size, mlp_hidden_dim, bias=True),
            nn.GELU(approximate='tanh'),
            nn.Linear(mlp_hidden_dim, hidden_size, bias=True)
        )
        self.txt_mod = Modulation(hidden_size, double=True)
        self.txt_norm1 = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-06)
        self.txt_attn = SelfAttention(dim=hidden_size, num_heads=num_heads, qkv_bias=qkv_bias)
        self.txt_norm2 = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-06)
        self.txt_mlp = nn.Sequential(
            nn.Linear(hidden_size, mlp_hidden_dim, bias=True),
            nn.GELU(approximate='tanh'),
            nn.Linear(mlp_hidden_dim, hidden_size, bias=True)
        )

ARGS = {
    "hidden_size": 4,
    "num_heads": 2,
    "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
SelfAttention Ran
ran on a synthesized input · constructed an object; no result was computed
ali-vilab/DiffDoctor/src/flux/sampling.py
code served (permissive licence) · get_code("64127abf54837b48")
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
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

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[torch.Tensor, torch.Tensor]:
        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):
        pass

ARGS = {
    "dim": 8,
    "num_heads": 2,
    "qkv_bias": 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 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
DoubleStreamBlockProcessor Not yet run
unverified (harvested, no recorded run)
ali-vilab/DiffDoctor/src/flux/sampling.py
code served (permissive licence) · get_code("42a2c08cbf0f9989")
How it ran

no invocation recorded.

Flux Not yet run
unverified (harvested, no recorded run)
ali-vilab/DiffDoctor/src/flux/sampling.py
code served (permissive licence) · get_code("c7647c8227939ed0")
How it ran

no invocation recorded.

SingleStreamBlock Not yet run
unverified (harvested, no recorded run)
ali-vilab/DiffDoctor/src/flux/sampling.py
code served (permissive licence) · get_code("e8797aae4bed55d8")
How it ran

no invocation recorded.

SingleStreamBlockProcessor Not yet run
unverified (harvested, no recorded run)
ali-vilab/DiffDoctor/src/flux/sampling.py
code served (permissive licence) · get_code("200328038ee1eb78")
How it ran

no invocation recorded.

denoise Not yet run
unverified (harvested, no recorded run)
ali-vilab/DiffDoctor/src/flux/sampling.py
code served (permissive licence) · get_code("478e782053b9c744")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 0 later) and 3 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
DoubleStreamBlock
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
DoubleStreamBlockProcessor
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
SelfAttention
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2504.02160 (2025-04)
Less-to-More Generalization: Unlocking More Controllability by In-Context Generation
SingleStreamBlock
brick of this paper's assembly: helper
1 other paper
1 dated earlier
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-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

Figure 1. We propose DIAMOND, an inference-time trajectory correction mechanism to mitigate artifacts in Rectified Flow and Diffusion Models. First, we generate an image D(x1) from the initial probability distribution sample, which then undergoes the generative process. The Base Trajectory (red) leads to an image containing artifacts, whereas our corrected DIAMOND Trajectory (green) results in the artifact-free image. At timestep t, we estimate the final image x0,t (gray dashed line) and use an Artifact Detector to apply a gradient-based trajectory correction (purple arrows), shifting it away from artifact region.

For agents

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

get_harvested_code_for_paper("2602.00883")
get_code_for_paper("2602.00883")
have("2602.00883")

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

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

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

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

Connect an agent — have() is free.