SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.04754 · ICLR · 2024

Towards Aligned Layout Generation via Diffusion Model with Aesthetic Constraints

Ruiyi Zhang, Changyou Chen, Jian Chen, Yufan Zhou, Zhiqiang Xu, Rajiv Jain, Ryan Rossi

arXiv · PDF · Open in the Atlas

Code that ran

12 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (5 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 5 have no contract verdict; 5 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/2402.04754.json · badge: /api/ran/2402.04754.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
puar-playground/lace marked official in Papers with Code
Papers with Code archive
12 ran · 2 no recorded run
FunctionStatusWhere it lives
AdaInsNorm Ran
ran on a synthesized input · constructed an object; no result was computed
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("4d2e3dfcf5e514df")
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, AdaInsNorm: 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
import math
from einops.layers.torch import Rearrange

torch.manual_seed(0)

# Define the classes from the function signature
class SinusoidalPosEmb(nn.Module):
    def __init__(self, num_steps: int, dim: int, rescale_steps: int=4000):
        super().__init__()
        self.dim = dim
        self.num_steps = float(num_steps)
        self.rescale_steps = float(rescale_steps)

    def forward(self, x):
        x = x / self.num_steps * self.rescale_steps
        device = x.device
        half_dim = self.dim // 2
        emb = math.log(10000) / (half_dim - 1)
        emb = torch.exp(torch.arange(half_dim, device=device) * -emb)
        emb = x[:, None] * emb[None, :]
        emb = torch.cat((emb.sin(), emb.cos()), dim=-1)
        return emb

class _AdaNorm(nn.Module):
    def __init__(self, n_embd: int, max_timestep: int, emb_type: str='adalayernorm_abs'):
        super().__init__()
        if 'abs' in emb_type:
            self.emb = SinusoidalPosEmb(max_timestep, n_embd)
        elif 'mlp' in emb_type:
            self.emb = nn.Sequential(Rearrange('b -> b 1'), nn.Linear(1, n_embd // 2), nn.ReLU(), nn.Linear(n_embd // 2, n_embd))
        else:
            self.emb = nn.Embedding(max_timestep, n_embd)
        self.silu = nn.SiLU()
        self.linear = nn.Linear(n_embd, n_embd * 2)

class AdaInsNorm(_AdaNorm):
    def __init__(self, n_embd: int, max_timestep: int, emb_type: str='adalayernorm_abs'):
        super().__init__(n_embd, max_timestep, emb_type)
        self.instancenorm = nn.InstanceNorm1d(n_embd)

    def forward(self, x, timestep):
        emb = self.linear(self.silu(self.emb(timestep))).unsqueeze(1)
        scale, shift = torch.chunk(emb, 2, dim=2)
        x = self.instancenorm(x.transpose(-1, -2)).transpose(-1, -2) * (1 + scale) + shift
        return x

# Setup arguments
n_embd = 4
max_timestep = 16
emb_type = 'adalayernorm_abs'

ARGS = {
    'n_embd': n_embd,
    'max_timestep': max_timestep,
    'emb_type': emb_type
}
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 AdaInsNorm — 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 AdaInsNorm 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
AdaLayerNorm Ran
ran on a synthesized input · constructed an object; no result was computed
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("d61620216d1e0e43")
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, AdaLayerNorm: 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
import math
from einops.layers.torch import Rearrange

torch.manual_seed(0)

class SinusoidalPosEmb(nn.Module):
    def __init__(self, num_steps: int, dim: int, rescale_steps: int=4000):
        super().__init__()
        self.dim = dim
        self.num_steps = float(num_steps)
        self.rescale_steps = float(rescale_steps)

    def forward(self, x):
        x = x / self.num_steps * self.rescale_steps
        device = x.device
        half_dim = self.dim // 2
        emb = math.log(10000) / (half_dim - 1)
        emb = torch.exp(torch.arange(half_dim, device=device) * -emb)
        emb = x[:, None] * emb[None, :]
        emb = torch.cat((emb.sin(), emb.cos()), dim=-1)
        return emb

class _AdaNorm(nn.Module):
    def __init__(self, n_embd: int, max_timestep: int, emb_type: str='adalayernorm_abs'):
        super().__init__()
        if 'abs' in emb_type:
            self.emb = SinusoidalPosEmb(max_timestep, n_embd)
        elif 'mlp' in emb_type:
            self.emb = nn.Sequential(Rearrange('b -> b 1'), nn.Linear(1, n_embd // 2), nn.ReLU(), nn.Linear(n_embd // 2, n_embd))
        else:
            self.emb = nn.Embedding(max_timestep, n_embd)
        self.silu = nn.SiLU()
        self.linear = nn.Linear(n_embd, n_embd * 2)

class AdaLayerNorm(_AdaNorm):
    def __init__(self, n_embd: int, max_timestep: int, emb_type: str='adalayernorm_abs'):
        super().__init__(n_embd, max_timestep, emb_type)
        self.layernorm = nn.LayerNorm(n_embd, elementwise_affine=False)

    def forward(self, x, timestep):
        emb = self.linear(self.silu(self.emb(timestep))).unsqueeze(1)
        scale, shift = torch.chunk(emb, 2, dim=2)
        x = self.layernorm(x) * (1 + scale) + shift
        return x

ARGS = {
    'n_embd': 4,
    'max_timestep': 10,
    'emb_type': 'adalayernorm_abs'
}
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 AdaLayerNorm — 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 AdaLayerNorm 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
Block Ran
ran on a synthesized input · constructed an object; no result was computed
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("33602d665cafbd1a")
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, Block: 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
import torch.nn.functional as F
from typing import Dict, List, Optional, Tuple, Union
import math
from typing import Callable, Optional, Union
from einops.layers.torch import Rearrange
from torch import Tensor

torch.manual_seed(0)

# Define the helper classes and functions needed
class SinusoidalPosEmb(nn.Module):
    def __init__(self, num_steps: int, dim: int, rescale_steps: int=4000):
        super().__init__()
        self.dim = dim
        self.num_steps = float(num_steps)
        self.rescale_steps = float(rescale_steps)

    def forward(self, x: Tensor):
        x = x / self.num_steps * self.rescale_steps
        device = x.device
        half_dim = self.dim // 2
        emb = math.log(10000) / (half_dim - 1)
        emb = torch.exp(torch.arange(half_dim, device=device) * -emb)
        emb = x[:, None] * emb[None, :]
        emb = torch.cat((emb.sin(), emb.cos()), dim=-1)
        return emb

class _AdaNorm(nn.Module):
    def __init__(self, n_embd: int, max_timestep: int, emb_type: str='adalayernorm_abs'):
        super().__init__()
        if 'abs' in emb_type:
            self.emb = SinusoidalPosEmb(max_timestep, n_embd)
        elif 'mlp' in emb_type:
            self.emb = nn.Sequential(Rearrange('b -> b 1'), nn.Linear(1, n_embd // 2), nn.ReLU(), nn.Linear(n_embd // 2, n_embd))
        else:
            self.emb = nn.Embedding(max_timestep, n_embd)
        self.silu = nn.SiLU()
        self.linear = nn.Linear(n_embd, n_embd * 2)

def _gelu2(x):
    return x * F.sigmoid(1.702 * x)

def _get_activation_fn(activation):
    if activation == 'relu':
        return F.relu
    elif activation == 'gelu':
        return F.gelu
    elif activation == 'gelu2':
        return _gelu2
    else:
        raise RuntimeError('activation should be relu/gelu/gelu2, not {}'.format(activation))

class AdaInsNorm(_AdaNorm):
    def __init__(self, n_embd: int, max_timestep: int, emb_type: str='adalayernorm_abs'):
        super().__init__(n_embd, max_timestep, emb_type)
        self.instancenorm = nn.InstanceNorm1d(n_embd)

    def forward(self, x, timestep):
        emb = self.linear(self.silu(self.emb(timestep))).unsqueeze(1)
        scale, shift = torch.chunk(emb, 2, dim=2)
        x = self.instancenorm(x.transpose(-1, -2)).transpose(-1, -2) * (1 + scale) + shift
        return x

class AdaLayerNorm(_AdaNorm):
    def __init__(self, n_embd: int, max_timestep: int, emb_type: str='adalayernorm_abs'):
        super().__init__(n_embd, max_timestep, emb_type)
        self.layernorm = nn.LayerNorm(n_embd, elementwise_affine=False)

    def forward(self, x: Tensor, timestep: int):
        emb = self.linear(self.silu(self.emb(timestep))).unsqueeze(1)
        scale, shift = torch.chunk(emb, 2, dim=2)
        x = self.layernorm(x) * (1 + scale) + shift
        return x

# Create arguments for Block initialization
ARGS = {
    'd_model': 8,
    'nhead': 2,
    'dim_feedforward': 16,
    'dropout': 0.1,
    'activation': F.relu,
    'batch_first': True,
    'norm_first': True,
    'device': None,
    'dtype': None,
    'diffusion_step': 100,
    'timestep_type': 'adalayernorm_abs'
}
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 Block — 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 Block 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
SinusoidalPosEmb Ran
ran on a synthesized input · constructed an object; no result was computed
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("1f73949b4bda3c10")
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, SinusoidalPosEmb: 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
import math
from torch import Tensor

torch.manual_seed(0)

# The function is SinusoidalPosEmb's __init__ and forward methods
# We need to construct valid arguments for the class

# Looking at __init__:
# - num_steps: int
# - dim: int  
# - rescale_steps: int (optional, default=4000)

# Looking at forward:
# - x: Tensor - should be 1D or 2D tensor of step indices
#   The code does x[:, None] so x must be at least 1D
#   It's indexed as x / self.num_steps, so it contains numeric values

# Create a small tensor for x - shape [2] for batch size 2
x = torch.tensor([0.0, 1.0])

ARGS = {
    "num_steps": 10,
    "dim": 4,
    "rescale_steps": 4000
}
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 SinusoidalPosEmb — 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 SinusoidalPosEmb 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
_AdaNorm Ran
ran on a synthesized input · constructed an object; no result was computed
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("513ddb55864178fe")
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, _AdaNorm: 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
import math
from einops.layers.torch import Rearrange

torch.manual_seed(0)

ARGS = {
    'n_embd': 8,
    'max_timestep': 16,
    'emb_type': 'adalayernorm_abs'
}
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 _AdaNorm — 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 _AdaNorm 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
_gelu2 Ran
ran; our contract draft was wrong, not the code
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("ce23ad2f08007447")
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
import torch.nn.functional as F

torch.manual_seed(0)

# Create a small tensor input
x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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
_get_activation_fn Ran
ran; our contract draft was wrong, not the code
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("1f6ff9fa607114db")
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 builtin_function_or_method. 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.functional as F

torch.manual_seed(0)

def _gelu2(x):
    return x * F.sigmoid(1.702 * x)

def _get_activation_fn(activation):
    if activation == 'relu':
        return F.relu
    elif activation == 'gelu':
        return F.gelu
    elif activation == 'gelu2':
        return _gelu2
    else:
        raise RuntimeError('activation should be relu/gelu/gelu2, not {}'.format(activation))

ARGS = {
    'activation': 'gelu'
}
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 builtin_function_or_method — a builtin_function_or_method output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a builtin_function_or_method 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
color_extend Ran
ran, honoured the contract we drafted
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("ae472f22d0f7c642")
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 tuple, ndim 2, 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 numpy as np

# The function color_extend takes a single parameter: n_color (an integer)
# It generates a palette of n_color colors by interpolating between 5 base colors

ARGS = {
    "n_color": 10
}
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 tuple, ndim 2, dtype family int — a tuple 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
convert_layout_to_image Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("9ab277ea712083c7")
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 Image. 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
from PIL import Image

torch.manual_seed(0)

# Create small test tensors
# boxes: FloatTensor of shape (num_boxes, 4) with xywh format
boxes = torch.tensor([
    [0.3, 0.4, 0.2, 0.3],  # xc, yc, w, h
    [0.7, 0.6, 0.15, 0.25]
], dtype=torch.float32)

# labels: LongTensor of shape (num_boxes,) with class indices
labels = torch.tensor([0, 1], dtype=torch.long)

# colors: List of RGB tuples, one per class
colors = [(255, 0, 0), (0, 255, 0), (0, 0, 255)]

# canvas_size: tuple of (height, width)
canvas_size = (60, 40)

# resources: optional dict with background image and cropped patches
# Create small PIL images for resources
img_bg = Image.new('RGB', (40, 60), color=(200, 200, 200))
patch1 = Image.new('RGB', (10, 15), color=(255, 100, 100))
patch2 = Image.new('RGB', (8, 12), color=(100, 255, 100))
resources = {
    'img_bg': img_bg,
    'cropped_patches': [patch1, patch2]
}

# names: optional tuple of class names
names = ('class_a', 'class_b', 'class_c')

# index: boolean flag
index = False

ARGS = {
    'boxes': boxes,
    'labels': labels,
    'colors': colors,
    'canvas_size': canvas_size,
    'resources': resources,
    'names': names,
    'index': index
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int 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
convert_xywh_to_ltrb Ran
ran, violated the contract we drafted
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("d95d45ece970cfa1")
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 list, ndim 1, dtype family float; 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 numpy as np

torch.manual_seed(0)

# The function takes a bbox parameter which should be unpacked into 4 components (xc, yc, w, h)
# It accepts either np.ndarray or FloatTensor

# Create a numpy array bbox in xywh format
bbox_np = np.array([10.0, 20.0, 4.0, 6.0])

ARGS = {
    "bbox": bbox_np
}
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 list, ndim 1, dtype family float — 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
save_image Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("c1795e572a421c31")
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 (64, 86, 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 numpy as np
from PIL import Image
import pathlib

torch.manual_seed(0)

# Create tiny tensors
batch_size = 2
max_objects = 4
num_classes = 6

# batch_boxes: (batch_size, max_objects, 4) in xywh format, normalized to [0, 1]
batch_boxes = torch.rand(batch_size, max_objects, 4) * 0.5 + 0.2
batch_boxes[:, :, 2:] = torch.rand(batch_size, max_objects, 2) * 0.3 + 0.1  # w, h smaller

# batch_labels: (batch_size, max_objects) with class indices
batch_labels = torch.randint(0, num_classes, (batch_size, max_objects))

# batch_mask: (batch_size, max_objects) boolean mask to filter valid objects
batch_mask = torch.ones(batch_size, max_objects, dtype=torch.bool)
batch_mask[0, 2:] = False  # First sample has only 2 valid objects
batch_mask[1, 3] = False   # Second sample has 3 valid objects

# out_path: None (will return image instead of saving)
out_path = None

# canvas_size: (height, width)
canvas_size = (60, 40)

# nrow: number of images per row in grid
nrow = 2

# batch_resources: None (no cropped patches)
batch_resources = None

# use_grid: return grid image
use_grid = True

# draw_label: don't draw labels
draw_label = False

# draw_index: don't draw indices
draw_index = False

# dataset: choose from ['rico13', 'rico25', 'publaynet', 'magazine', 'crello']
dataset = 'publaynet'

ARGS = {
    'batch_boxes': batch_boxes,
    'batch_labels': batch_labels,
    'batch_mask': batch_mask,
    'out_path': out_path,
    'canvas_size': canvas_size,
    'nrow': nrow,
    'batch_resources': batch_resources,
    'use_grid': use_grid,
    'draw_label': draw_label,
    'draw_index': draw_index,
    'dataset': dataset,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, einops, numpy, torch, torchvision — 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 (64, 86, 3) — shape (64, 86, 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
torch_to_numpy_image Ran
ran; our contract draft was wrong, not the code
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("a9e89a5d98bea94d")
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 (4, 5, 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 numpy as np

torch.manual_seed(0)

# Create a small image tensor: (C, H, W) with values in [0.0, 1.0]
# Using distinct sizes: 3 channels, 4 height, 5 width
input_th = torch.rand(3, 4, 5)

ARGS = {
    "input_th": input_th
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, 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 3, dtype family int, shape (4, 5, 3) — shape (4, 5, 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
Diffusion Not yet run
unverified (harvested, no recorded run)
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("efd5ffb686bfb773")
How it ran

no invocation recorded.

TransformerEncoder Not yet run
unverified (harvested, no recorded run)
puar-playground/lace/model_diffusion.py
code served (permissive licence) · get_code("6331fa2f5c6d4fbe")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 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 14 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

Controllable layout generation refers to the process of creating a plausible visual arrangement of elements within a graphic design (e.g., document and web designs) with constraints representing design intentions. Although recent diffusionbased models have achieved state-of-the-art FID scores, they tend to exhibit more pronounced misalignment compared to earlier transformer-based models. In this work, we propose the LAyout Constraint diffusion modEl (LACE) 1 , a unified model to handle a broad range of layout generation tasks, such as arranging elements with specified attributes and refining or completing a coarse layout design. The model is based on continuous diffusion models. Compared with existing methods that use discrete diffusion models, continuous state-space design can enable the incorporation of differentiable aesthetic constraint functions in training. For conditional generation, we introduce conditions via masked input. Extensive experiment results show that LACE produces high-quality layouts and outperforms existing state-of-the-art baselines.

For agents

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

get_harvested_code_for_paper("2402.04754")
get_code_for_paper("2402.04754")
have("2402.04754")

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

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

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

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

Connect an agent — have() is free.