SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2605.31266 · ICML · 2026

Envisioning Beyond the Few: Disentangled Semantics and Primitives for Few-Shot Atypical Layout-to-Image Generation

Jia Li, Yifan Zhao, Nan Bao, Wenzhuang Wang

arXiv · PDF · Open in the Atlas

Code that ran

2 of 5 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 2 have no contract verdict; 0 failures of our instrument; 3 no recorded run), measured 2026-11-23; 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/2605.31266.json · badge: /api/ran/2605.31266.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
iCVTEAM/DSP community
Papers with Code archive
2 ran · 3 no recorded run
FunctionStatusWhere it lives
CrossAttention Ran
ran on a synthesized input
iCVTEAM/DSP/models/dsp/layers.py
code served (permissive licence) · get_code("a820b721e43b1ab9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 3, dtype family float, shape (2, 5, 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 inspect import isfunction
from einops import rearrange, repeat
from torch import einsum

def default(val, d):
    if exists(val):
        return val
    return d() if isfunction(d) else d

def exists(val):
    return val is not None

class CrossAttention(nn.Module):

    def __init__(self, query_dim, context_dim=None, heads=8, dim_head=64, dropout=0.0):
        super().__init__()
        inner_dim = dim_head * heads
        context_dim = default(context_dim, query_dim)
        self.scale = dim_head ** (-0.5)
        self.heads = heads
        self.to_q = nn.Linear(query_dim, inner_dim, bias=False)
        self.to_k = nn.Linear(context_dim, inner_dim, bias=False)
        self.to_v = nn.Linear(context_dim, inner_dim, bias=False)
        self.to_out = nn.Sequential(nn.Linear(inner_dim, query_dim), nn.Dropout(dropout))

    def forward(self, x, context=None, mask=None, return_attn=False, need_softmax=True):
        h = self.heads
        b = x.shape[0]
        q = self.to_q(x)
        context = default(context, x)
        k = self.to_k(context)
        v = self.to_v(context)
        q, k, v = map(lambda t: rearrange(t, 'b n (h d) -> (b h) n d', h=h), (q, k, v))
        sim = einsum('b i d, b j d -> b i j', q, k) * self.scale
        if exists(mask):
            mask = rearrange(mask, 'b ... -> b (...)')
            max_neg_value = -torch.finfo(sim.dtype).max
            mask = repeat(mask, 'b j -> (b h) () j', h=h)
            sim.masked_fill_(~mask, max_neg_value)
        if need_softmax:
            attn = sim.softmax(dim=-1)
        else:
            attn = sim
        out = einsum('b i j, b j d -> b i d', attn, v)
        out = rearrange(out, '(b h) n d -> b n (h d)', h=h)
        if return_attn:
            attn = attn.view(b, h, attn.shape[-2], attn.shape[-1])
            return (self.to_out(out), attn)
        else:
            return self.to_out(out)

INIT_ARGS = {
    'query_dim': 4,
    'context_dim': 6,
    'heads': 2,
    'dim_head': 3,
    'dropout': 0.1,
}

ARGS = {
    'x': torch.randn(2, 5, 4),
    'context': torch.randn(2, 7, 6),
    'mask': torch.ones(2, 7, dtype=torch.bool),
    'return_attn': False,
    'need_softmax': True,
}

if __name__ == '__main__':
    model = CrossAttention(**INIT_ARGS)
    output = model(**ARGS)
    print("Output shape:", output.shape)
    print("Output:", output)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 5, 4) — shape (2, 5, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
FourierEmbedder Ran
ran on a synthesized input
iCVTEAM/DSP/models/dsp/layers.py
code served (permissive licence) · get_code("81a2180c2632fe94")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 64) 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

class FourierEmbedder:

    def __init__(self, num_freqs=64, temperature=100):
        self.num_freqs = num_freqs
        self.temperature = temperature
        self.freq_bands = temperature ** (torch.arange(num_freqs) / num_freqs)

    @torch.no_grad()
    def __call__(self, x, cat_dim=-1):
        out = []
        for freq in self.freq_bands:
            out.append(torch.sin(freq * x))
            out.append(torch.cos(freq * x))
        return torch.cat(out, cat_dim)


INIT_ARGS = {
    'num_freqs': 8,
    'temperature': 100,
}

ARGS = {
    'x': torch.randn(2, 4),
    'cat_dim': -1,
}

METHOD = '__call__'

if __name__ == '__main__':
    embedder = FourierEmbedder(**INIT_ARGS)
    result = embedder(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {result.shape}")
    print(f"Expected output shape: (2, {INIT_ARGS['num_freqs'] * 2 * 4})")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
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, 64) — shape (2, 64) 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
LayoutAttention Not yet run
unverified (harvested, no recorded run)
iCVTEAM/DSP/models/dsp/layers.py
code served (permissive licence) · get_code("f3029e3126e62680")
How it ran

no invocation recorded.

MIFusion Not yet run
unverified (harvested, no recorded run)
iCVTEAM/DSP/models/dsp/layers.py
code served (permissive licence) · get_code("41d0439c27287861")
How it ran

no invocation recorded.

PositionNet Not yet run
unverified (harvested, no recorded run)
iCVTEAM/DSP/models/dsp/layers.py
code served (permissive licence) · get_code("d5b0ec5ef527c6cb")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 2 are also present in other papers whose code we hold (2 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
FourierEmbedder
brick of this paper's assembly: helper
2 other papers
2 dated earlier · 1 only as an assembly brick
2301.07093 (2023-01)
GLIGEN: Open-Set Grounded Text-to-Image Generation
2402.05408 (2024-02)
MIGC: Multi-Instance Generation Controller for Text-to-Image Synthesis
LayoutAttention
brick of this paper's assembly: helper
1 other paper
1 dated earlier
2402.05408 (2024-02)
MIGC: Multi-Instance Generation Controller for Text-to-Image Synthesis

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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The layout-to-image (L2I) task enables finegrained control over image generation via object categories and spatial layouts. However, existing L2I methods yield fragmented and distorted generations under few-shot atypical settings. We term this failure as representation fragmentation, arising from a granularity mismatch that entangles semantic identity with visual details. To address this issue, we propose a representation-driven framework that disentangles semantics from primitives for robust few-shot adaptation. Specifically, Semantic Anchoring aggregates categorical semantics into anchors for stable identity, while Primitive Imbuing models recomposable primitives for robust local detail modeling. Conceptual Steering further regulates optimization with a saliencyaware objective to preserve foreground semantic consistency. Extensive experiments demonstrate consistent improvements in the 5-shot regime over state-of-the-art L2I methods in both visual fidelity and alignment across diverse atypical domains. The source code is publicly available at https://github.com/iCVTEAM/DSP.

For agents

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

get_harvested_code_for_paper("2605.31266")
get_code_for_paper("2605.31266")
have("2605.31266")

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

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

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

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

Connect an agent — have() is free.