SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2606.13288 · 2026

Cross-Modal Masked Compositional Concept Modeling for Enhancing Visio-Linguistic Compositionality

Wei Li, Xinmei Tian, Zhen Huang

arXiv · PDF · Open in the Atlas

Code that ran

6 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (6 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 6 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/2606.13288.json · badge: /api/ran/2606.13288.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
hiker-lw/MACCO community
Papers with Code archive
6 ran · 3 no recorded run
FunctionStatusWhere it lives
Image_Predictor Ran
ran on a synthesized input · constructed an object; no result was computed
hiker-lw/MACCO/src/open_clip_code/MACCO_variant/MACCO_text_image.py
code served (permissive licence) · get_code("8d56df7d1ead16e2")
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, Image_Predictor: 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 numpy as np

torch.manual_seed(0)

ARGS = {
    "width": 64,
    "self_attn_layers": 2,
    "cross_attn_layers": 2,
    "heads": 4,
    "patch_size": 32,
    "in_chans": 3,
}
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 Image_Predictor — 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 Image_Predictor 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
ResidualAttentionBlock Ran
ran on a synthesized input · constructed an object; no result was computed
hiker-lw/MACCO/src/open_clip_code/MACCO_variant/MACCO_text_image.py
code served (permissive licence) · get_code("b2bb1279ceae186b")
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, ResidualAttentionBlock: 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 collections import OrderedDict
from typing import Callable, Optional

# Define LayerNorm
class LayerNorm(nn.LayerNorm):
    """Subclass torch's LayerNorm to handle fp16."""
    def forward(self, x: torch.Tensor):
        import torch.nn.functional as F
        orig_type = x.dtype
        x = F.layer_norm(x, self.normalized_shape, self.weight, self.bias, self.eps)
        return x.to(orig_type)

# Define ResidualAttentionBlock
class ResidualAttentionBlock(nn.Module):
    def __init__(self, d_model: int, n_head: int, mlp_ratio: float=4.0, act_layer: Callable=nn.GELU):
        super().__init__()
        self.attn = nn.MultiheadAttention(d_model, n_head)
        self.ln_1 = LayerNorm(d_model)
        mlp_width = int(d_model * mlp_ratio)
        self.mlp = nn.Sequential(OrderedDict([('c_fc', nn.Linear(d_model, mlp_width)), ('gelu', act_layer()), ('c_proj', nn.Linear(mlp_width, d_model))]))
        self.ln_2 = LayerNorm(d_model)
        self.attn_weight = None

    def attention(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor]=None):
        attn_output, attn_weight = self.attn(x, x, x, need_weights=True, attn_mask=attn_mask)
        self.attn_weight = attn_weight
        return attn_output

    def forward(self, x: torch.Tensor, attn_mask: Optional[torch.Tensor]=None):
        x = x + self.attention(self.ln_1(x), attn_mask=attn_mask)
        x = x + self.mlp(self.ln_2(x))
        return x

torch.manual_seed(0)

# Create arguments for ResidualAttentionBlock.__init__
ARGS = {
    'd_model': 8,
    'n_head': 2,
    'mlp_ratio': 4.0,
    'act_layer': nn.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 ResidualAttentionBlock — 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 ResidualAttentionBlock 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
ResidualCrossAttentionBlock Ran
ran on a synthesized input · constructed an object; no result was computed
hiker-lw/MACCO/src/open_clip_code/MACCO_variant/MACCO_text_image.py
code served (permissive licence) · get_code("ebc90ef3d46558ff")
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, ResidualCrossAttentionBlock: 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 collections import OrderedDict

torch.manual_seed(0)

# Define the LayerNorm and ResidualCrossAttentionBlock classes as provided
class LayerNorm(nn.LayerNorm):
    """Subclass torch's LayerNorm to handle fp16."""
    def forward(self, x: torch.Tensor):
        import torch.nn.functional as F
        orig_type = x.dtype
        x = F.layer_norm(x, self.normalized_shape, self.weight, self.bias, self.eps)
        return x.to(orig_type)

class ResidualCrossAttentionBlock(nn.Module):
    def __init__(self, d_model: int, n_head: int, mlp_ratio: float=4.0, act_layer=nn.GELU):
        super().__init__()
        self.attn = nn.MultiheadAttention(d_model, n_head)
        self.ln_x = LayerNorm(d_model)
        self.ln_y = LayerNorm(d_model)
        mlp_width = int(d_model * mlp_ratio)
        self.mlp = nn.Sequential(OrderedDict([('c_fc', nn.Linear(d_model, mlp_width)), ('gelu', act_layer()), ('c_proj', nn.Linear(mlp_width, d_model))]))
        self.ln_post = LayerNorm(d_model)
        self.attn_weight = None

    def cross_attention(self, x: torch.Tensor, y: torch.Tensor, attn_mask=None):
        CA_out = self.attn(x, y, y, need_weights=True, attn_mask=attn_mask)
        self.attn_weight = CA_out[1]
        return CA_out[0]

    def forward(self, x: torch.Tensor, y: torch.Tensor, attn_mask=None):
        x = x + self.cross_attention(self.ln_x(x), self.ln_y(y), attn_mask=attn_mask)
        x = x + self.mlp(self.ln_post(x))
        return x

# Create setup arguments for the forward method
d_model = 4
n_head = 2
batch_size = 2
seq_len_x = 3
seq_len_y = 5

# Create sample tensors
x = torch.randn(seq_len_x, batch_size, d_model)
y = torch.randn(seq_len_y, batch_size, d_model)

# Optional attention mask (not required, but can be provided)
attn_mask = None

ARGS = {
    'd_model': d_model,
    'n_head': n_head,
    'mlp_ratio': 4.0,
    'act_layer': nn.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 ResidualCrossAttentionBlock — 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 ResidualCrossAttentionBlock 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
Text_Predictor Ran
ran on a synthesized input · constructed an object; no result was computed
hiker-lw/MACCO/src/open_clip_code/MACCO_variant/MACCO_text_image.py
code served (permissive licence) · get_code("1da41a5fb6e9d92c")
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, Text_Predictor: 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

torch.manual_seed(0)

# Set up the arguments for Text_Predictor.forward()
batch_size = 2
seq_len = 77
img_tokens = 49
width = 512
self_attn_layers = 2
cross_attn_layers = 2
heads = 8

# Create the model
model = nn.Module()

# Create input tensors
# x: masked text features (all tokens) from CLIP text encoder, [b, 77, 512]
x = torch.randn(batch_size, seq_len, width)

# y: image features (all tokens) from CLIP image encoder, [b, 49, 512]
y = torch.randn(batch_size, img_tokens, width)

# y_cls: class token from image encoder, [b, 512]
y_cls = torch.randn(batch_size, width)

# texts: text tensor input to CLIP text encoder, [b, 77]
# Need to have at least one non-zero token per sample for argmax to work
texts = torch.zeros(batch_size, seq_len, dtype=torch.long)
texts[0, 5] = 1  # Set one token to non-zero in first sample
texts[1, 10] = 1  # Set one token to non-zero in second sample

# attn_mask: optional attention mask
attn_mask = None

ARGS = {
    'width': width,
    'self_attn_layers': self_attn_layers,
    'cross_attn_layers': cross_attn_layers,
    'heads': heads,
}
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 Text_Predictor — 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 Text_Predictor 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
Transformer Ran
ran on a synthesized input · constructed an object; no result was computed
hiker-lw/MACCO/src/open_clip_code/MACCO_variant/MACCO_text_image.py
code served (permissive licence) · get_code("7cfb16758d714b36")
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, Transformer: 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

torch.manual_seed(0)

ARGS = {
    "width": 4,
    "layers": 2,
    "heads": 2,
    "mlp_ratio": 4.0,
    "act_layer": nn.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 Transformer — 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 Transformer 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
VisualTransformer Ran
ran on a synthesized input · constructed an object; no result was computed
hiker-lw/MACCO/src/open_clip_code/MACCO_variant/MACCO_text_image.py
code served (permissive licence) · get_code("a210faa2dd758b01")
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, VisualTransformer: 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

torch.manual_seed(0)

ARGS = {
    "image_size": 8,
    "patch_size": 2,
    "width": 4,
    "layers": 2,
    "heads": 2,
    "mlp_ratio": 4.0,
    "output_dim": 3,
    "act_layer": nn.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 VisualTransformer — 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 VisualTransformer 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
CLIP Not yet run
unverified (harvested, no recorded run)
hiker-lw/MACCO/src/open_clip_code/MACCO_variant/MACCO_text_image.py
code served (permissive licence) · get_code("c88c1b3bdd5f5cc8")
How it ran

no invocation recorded.

MACCO_CLIP_text_image Not yet run
unverified (harvested, no recorded run)
hiker-lw/MACCO/src/open_clip_code/MACCO_variant/MACCO_text_image.py
code served (permissive licence) · get_code("1d5a413f69c86ee9")
How it ran

no invocation recorded.

TimmModel Not yet run
unverified (harvested, no recorded run)
hiker-lw/MACCO/src/open_clip_code/MACCO_variant/MACCO_text_image.py
code served (permissive licence) · get_code("345c058dcabd105b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 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 7 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
Transformer
brick of this paper's assembly: helper
2 other papers
2 dated earlier
2102.05918 (2021-02)
Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision
2308.08428 (2023-08)
ALIP: Adaptive Language-Image Pre-training with Synthetic Caption
VisualTransformer
brick of this paper's assembly: helper
2 other papers
2 dated earlier
2102.05918 (2021-02)
Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision
2308.08428 (2023-08)
ALIP: Adaptive Language-Image Pre-training with Synthetic Caption

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

Contrastively trained vision-language models like CLIP, have made remarkable progress in learning joint image-text representations, but still face challenges in compositional understanding. They often exhibit a "bag-of-words" behavior-struggling to capture the object relations, attribute-object bindings, and word order dependencies. This limitation arises not only from the reliance on global, single-vector representations for optimization, but also from the insufficient exploitation and modeling of the rich compositional information inherently present in paired image text data. In this work, we propose MACCO (MAsked Compositional Concept MOdeling), a framework that masks compositional concepts in one modality and reconstructs them conditioned on the full contextual information from the other, enabling the model to capture and align cross-modal compositional structures more effectively. To facilitate this process, we introduce two auxiliary objectives that jointly align and regularize masked features both inter-modally and intramodally. Extensive experiments on five compositional benchmarks, along with in-depth analyses, demonstrate that our approach not only significantly enhances compositionality in VLMs but also improves their ability to capture syntactic structure and linguistic information. Additionally, the improved compositionality also benefits text-to-image generation and multimodal large language model. Code is available at https://github.com/hiker-lw/MACCO.

For agents

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

get_harvested_code_for_paper("2606.13288")
get_code_for_paper("2606.13288")
have("2606.13288")

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

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

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

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

Connect an agent — have() is free.