SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1803.03067 · 2018

Compositional Attention Networks for Machine Reasoning

arXiv · PDF · Open in the Atlas

Code that ran

4 of 7 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; 1 failure of our instrument; 3 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/1803.03067.json · badge: /api/ran/1803.03067.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
ceyzaguirre4/mac-network-pytorch community (classifier label)
classifier basis not recorded on the link
2 ran · 1 no recorded run
rosinality/mac-network-pytorch community (classifier label)
classifier basis not recorded on the link
1 ran · 1 no recorded run
ronilp/mac-network-pytorch-gqa reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
tohinz/pytorch-mac-network reimplementation (classifier label)
classifier basis: classifier_2025
0 ran · 1 no recorded run
FunctionStatusWhere it lives
collate_data Ran
ran on a synthesized input
ceyzaguirre4/mac-network-pytorch/dataset.py
code served (permissive licence) · get_code("dc99e9ba297a65ae")
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. 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

torch.manual_seed(0)

# Construct a batch of tuples: (image, question, length, answer, family, idx)
# where:
# - image: torch tensor
# - question: list/array of question token ids
# - length: int (length of question)
# - answer: int (answer label)
# - family: str (family identifier)
# - idx: int (index)

batch = []

# Sample 1
image1 = torch.randn(3, 4, 4)  # 3-channel image, 4x4
question1 = np.array([1, 2, 3], dtype=np.int64)
length1 = 3
answer1 = 0
family1 = "family_a"
idx1 = 0
batch.append((image1, question1, length1, answer1, family1, idx1))

# Sample 2
image2 = torch.randn(3, 4, 4)  # 3-channel image, 4x4
question2 = np.array([4, 5], dtype=np.int64)
length2 = 2
answer2 = 1
family2 = "family_b"
idx2 = 1
batch.append((image2, question2, length2, answer2, family2, idx2))

ARGS = {
    "batch": batch
}
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 tuple — a tuple output has no array shape of its own; none is 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
collate_data Ran
ran on a synthesized input
rosinality/mac-network-pytorch/dataset.py
code served (permissive licence) · get_code("3489d58eb80cf2c6")
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. 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

torch.manual_seed(0)

# Construct sample batch items
# Each item is: (image, question, length, answer, family)
# where:
#   - image is a torch.Tensor (will be stacked)
#   - question is a numpy array or list of ints (variable length)
#   - length is an int (but function recomputes it from question)
#   - answer is an int
#   - family is a string or identifier

batch_item_1 = (
    torch.randn(3, 4),  # image: 3x4 tensor
    np.array([1, 2, 3, 5]),  # question: length 4
    4,  # length (ignored, recomputed)
    7,  # answer
    "family_a"  # family
)

batch_item_2 = (
    torch.randn(3, 4),  # image: 3x4 tensor
    np.array([2, 3]),  # question: length 2
    2,  # length (ignored, recomputed)
    5,  # answer
    "family_b"  # family
)

batch = [batch_item_1, batch_item_2]

ARGS = {
    "batch": batch
}
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 tuple — a tuple output has no array shape of its own; none is 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
forward Ran
ran on a synthesized input
ceyzaguirre4/mac-network-pytorch/image_feature.py
code served (permissive licence) · get_code("dbde19906ac732ed")
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, 16, 1, 1) 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

torch.manual_seed(0)

# Build minimal nn.Module components that satisfy the forward pass
class ConvBlock(nn.Module):
    def __init__(self, in_channels, out_channels):
        super().__init__()
        self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1)
        self.bn = nn.BatchNorm2d(out_channels)
        self.relu = nn.ReLU(inplace=True)
    
    def forward(self, x):
        x = self.conv(x)
        x = self.bn(x)
        x = self.relu(x)
        return x

class ResidualLayer(nn.Module):
    def __init__(self, in_channels, out_channels):
        super().__init__()
        self.block = ConvBlock(in_channels, out_channels)
    
    def forward(self, x):
        return self.block(x)

class SimpleResNet(nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 4, kernel_size=7, stride=2, padding=3)
        self.bn1 = nn.BatchNorm2d(4)
        self.relu = nn.ReLU(inplace=True)
        self.maxpool = nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
        
        self.layer1 = ResidualLayer(4, 4)
        self.layer2 = ResidualLayer(4, 8)
        self.layer3 = ResidualLayer(8, 16)
    
    def forward(self, x):
        x = self.conv1(x)
        x = self.bn1(x)
        x = self.relu(x)
        x = self.maxpool(x)
        x = self.layer1(x)
        x = self.layer2(x)
        x = self.layer3(x)
        return x

# Create model instance
model = SimpleResNet()

# Create input tensor: batch_size=2, channels=3, height=4, width=4
x = torch.randn(2, 3, 4, 4)

ARGS = {
    'self': model,
    '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 4, dtype family float, shape (2, 16, 1, 1) — shape (2, 16, 1, 1) 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
linear Ran
ran; our contract draft was wrong, not the code
ronilp/mac-network-pytorch-gqa/model.py
code served (permissive licence) · get_code("1bb3fb76f5e3c485")
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 Linear. 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
from torch.nn.init import kaiming_uniform_, xavier_uniform_, normal

torch.manual_seed(0)

ARGS = {
    "in_dim": 4,
    "out_dim": 3,
    "bias": True,
}
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 Linear — a Linear output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Linear 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
load_MAC Not yet run
unverified (harvested, no recorded run)
tohinz/pytorch-mac-network/code/mac.py
code served (permissive licence) · get_code("b66152de2215de9b")
How it ran

no invocation recorded.

process_question Not yet run
unverified (harvested, no recorded run)
ceyzaguirre4/mac-network-pytorch/preprocess.py
code served (permissive licence) · get_code("928267eac64ad657")
How it ran

no invocation recorded.

process_question Not yet run
unverified (harvested, no recorded run)
rosinality/mac-network-pytorch/preprocess.py
code served (permissive licence) · get_code("6490066d39c2eafd")
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, 1 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 1 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.

FunctionAlso present inEarliest-datedOthers named
linear 1 other paper
1 later
1806.07366 (2018-06)
Neural Ordinary Differential Equations

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

We present the MAC network, a novel fully differentiable neural network architecture, designed to facilitate explicit and expressive reasoning. MAC moves away from monolithic black-box neural architectures towards a design that encourages both transparency and versatility. The model approaches problems by decomposing them into a series of attention-based reasoning steps, each performed by a novel recurrent Memory, Attention, and Composition (MAC) cell that maintains a separation between control and memory. By stringing the cells together and imposing structural constraints that regulate their interaction, MAC effectively learns to perform iterative reasoning processes that are directly inferred from the data in an end-to-end approach. We demonstrate the model's strength, robustness and interpretability on the challenging CLEVR dataset for visual reasoning, achieving a new state-of-the-art 98.9% accuracy, halving the error rate of the previous best model. More importantly, we show that the model is computationally-efficient and data-efficient, in particular requiring 5x less data than existing models to achieve strong results.

For agents

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

get_harvested_code_for_paper("1803.03067")
get_code_for_paper("1803.03067")
have("1803.03067")

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

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

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

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

Connect an agent — have() is free.