SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2405.16727 · ICML · 2025

Disentangling and Integrating Relational and Sensory Information in Transformer Architectures

Awni Altabaa, John Lafferty

arXiv · PDF · Open in the Atlas

Code that ran

14 of 21 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (9 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 9 have no contract verdict; 4 failures of our instrument; 7 no recorded run), measured 2026-11-23; 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/2405.16727.json · badge: /api/ran/2405.16727.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
awni00/dual-attention canonical (classifier label)
classifier basis: classifier_2025
2 ran · 4 no recorded run
awni00/abstract_transformer community
Papers with Code archive
12 ran · 3 no recorded run
FunctionStatusWhere it lives
Attention Ran
ran on a synthesized input · constructed an object; no result was computed
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("437880805ab90b88")
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, Attention: 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

torch.manual_seed(0)

# Small helper functions from the function signature
def reshape_for_broadcast(freqs_cis: torch.Tensor, x: torch.Tensor):
    ndim = x.ndim
    assert 0 <= 1 < ndim
    assert freqs_cis.shape == (x.shape[1], x.shape[-1])
    shape = [d if i == 1 or i == ndim - 1 else 1 for i, d in enumerate(x.shape)]
    return freqs_cis.view(shape)

def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
    """torch.repeat_interleave(x, dim=2, repeats=n_rep)"""
    bs, slen, n_kv_heads, head_dim = x.shape
    if n_rep == 1:
        return x
    return x[:, :, :, None, :].expand(bs, slen, n_kv_heads, n_rep, head_dim).reshape(bs, slen, n_kv_heads * n_rep, head_dim)

def apply_rotary_emb(xq: torch.Tensor, xk: torch.Tensor, freqs_cos: torch.Tensor, freqs_sin: torch.Tensor):
    xq_r, xq_i = xq.float().reshape(xq.shape[:-1] + (-1, 2)).unbind(-1)
    xk_r, xk_i = xk.float().reshape(xk.shape[:-1] + (-1, 2)).unbind(-1)
    freqs_cos = reshape_for_broadcast(freqs_cos, xq_r)
    freqs_sin = reshape_for_broadcast(freqs_sin, xq_r)
    xq_out_r = xq_r * freqs_cos - xq_i * freqs_sin
    xq_out_i = xq_r * freqs_sin + xq_i * freqs_cos
    xk_out_r = xk_r * freqs_cos - xk_i * freqs_sin
    xk_out_i = xk_r * freqs_sin + xk_i * freqs_cos
    xq_out = torch.stack([xq_out_r, xq_out_i], dim=-1).flatten(3)
    xk_out = torch.stack([xk_out_r, xk_out_i], dim=-1).flatten(3)
    return (xq_out.type_as(xq), xk_out.type_as(xk))

def compute_causal_mask(size, device=None):
    """computes an attention mask with True at (i,j) if i <= j"""
    causal_mask = torch.tril(torch.ones(size, size, device=device)).bool()
    return causal_mask

# Create Attention module
d_model = 8
n_heads = 2
dropout = 0.1
n_kv_heads = 2
key_dim = 4

attention_module = nn.Linear(d_model, d_model)  # Stand-in, not used for instantiation

# Create query, key, value tensors
batch_size = 2
seq_len = 3
query = torch.randn(batch_size, seq_len, d_model)
key = torch.randn(batch_size, seq_len, d_model)
value = torch.randn(batch_size, seq_len, d_model)

# Create rotary embedding frequencies
head_dim = d_model // n_heads
freqs_cos = torch.randn(seq_len, head_dim)
freqs_sin = torch.randn(seq_len, head_dim)

# Create attention mask
attn_mask = compute_causal_mask(seq_len)

ARGS = {
    'd_model': d_model,
    'n_heads': n_heads,
    'dropout': dropout,
    'key_dim': key_dim,
    'n_kv_heads': n_kv_heads,
    'add_bias_kv': False,
    'add_bias_out': False,
    'total_n_heads': None,
}
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 Attention — 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 Attention 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
FeedForwardBlock Ran
ran on a synthesized input · constructed an object; no result was computed
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("a001e1fb0893402a")
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, FeedForwardBlock: 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 = {
    'embed_dim': 4,
    'dff': 8,
    'activation': 'relu',
    'use_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 FeedForwardBlock — 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 FeedForwardBlock 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
PositionRelativeSymbolRetriever Ran
ran on a synthesized input · constructed an object; no result was computed
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("27aa5362b0778651")
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, PositionRelativeSymbolRetriever: 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 = {
    "symbol_dim": 4,
    "max_rel_pos": 3,
}
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 PositionRelativeSymbolRetriever — 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 PositionRelativeSymbolRetriever 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
PositionalSymbolRetriever Ran
ran on a synthesized input · constructed an object; no result was computed
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("07d2253837bc4d3f")
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, PositionalSymbolRetriever: 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 = {
    "symbol_dim": 4,
    "max_length": 8,
    "sinusoidal": 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 PositionalSymbolRetriever — 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 PositionalSymbolRetriever 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
RMSNorm Ran
ran on a synthesized input · constructed an object; no result was computed
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("01777e072296c0bb")
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, RMSNorm: 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)

# RMSNorm takes two parameters: dim and eps
# dim: int - the dimension of the weight parameter
# eps: float - small value to avoid division by zero (has default)

# Create a small tensor to understand the expected input shape
# RMSNorm is typically applied to the last dimension, so dim should match that
dim = 4
eps = 1e-05

ARGS = {
    'dim': dim,
    'eps': eps,
}
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 RMSNorm — 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 RMSNorm 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
RelationalAttention Ran
ran on a synthesized input · constructed an object; no result was computed
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("f75b1ab91cff5f54")
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, RelationalAttention: 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 import rearrange

torch.manual_seed(0)

ARGS = {
    'd_model': 8,
    'n_heads': 2,
    'n_relations': 2,
    'dropout': 0.1,
    'key_dim': 4,
    'n_kv_heads': 2,
    'rel_activation': 'identity',
    'rel_proj_dim': 4,
    'add_bias_kv': False,
    'add_bias_out': False,
    'total_n_heads': 2,
    'symmetric_rels': False,
    'use_relative_positional_symbols': 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 RelationalAttention — 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 RelationalAttention 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
RelationalAttention Ran
ran on a synthesized input · constructed an object; no result was computed
awni00/dual-attention/dual_attention/dual_attention.py
code served (permissive licence) · get_code("e96ef6f7fa7fb78b")
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, RelationalAttention: 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 = {
    "d_model": 64,
    "n_heads": 8,
    "n_relations": 4,
    "dropout": 0.1,
    "key_dim": 8,
    "n_kv_heads": 4,
    "rel_activation": "relu",
    "rel_proj_dim": 16,
    "add_bias_kv": True,
    "add_bias_out": True,
    "total_n_heads": 8,
    "symmetric_rels": False,
    "use_relative_positional_symbols": 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 RelationalAttention — 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 RelationalAttention 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
RelativePositionalEncoding Ran
ran on a synthesized input · constructed an object; no result was computed
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("41fd4f0515e6826a")
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, RelativePositionalEncoding: 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 for RelativePositionalEncoding.__init__
ARGS = {
    'dim': 4,
    'max_rel_pos': 3,
}
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 RelativePositionalEncoding — 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 RelativePositionalEncoding 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
SymbolicAttention Ran
ran on a synthesized input · constructed an object; no result was computed
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("32699e73b61b32e9")
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, SymbolicAttention: 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 = {
    "d_model": 4,
    "n_heads": 2,
    "n_symbols": 3,
    "dropout": 0.1,
    "scale": None,
    "trainable_symbols": 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 SymbolicAttention — 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 SymbolicAttention 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
apply_rotary_emb Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("6dc1f541b73c3081")
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 5, 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

torch.manual_seed(0)

# The function apply_rotary_emb expects:
# - xq: query tensor, shape (batch, seq_len, head_dim)
# - xk: key tensor, shape (batch, seq_len, head_dim)
# - freqs_cos: cosine frequencies, shape (seq_len, head_dim//2)
# - freqs_sin: sine frequencies, shape (seq_len, head_dim//2)

batch_size = 2
seq_len = 3
head_dim = 4

# xq and xk need to have ndim >= 3 for reshape_for_broadcast to work
# reshape_for_broadcast expects ndim of x to be at least 2, and checks 0 <= 1 < ndim
# The function reshapes to (..., -1, 2), so head_dim must be even
xq = torch.randn(batch_size, seq_len, head_dim)
xk = torch.randn(batch_size, seq_len, head_dim)

# freqs_cos and freqs_sin must have shape (seq_len, head_dim)
# because reshape_for_broadcast checks: freqs_cis.shape == (x.shape[1], x.shape[-1])
# where x is xq_r after reshaping, which has shape (batch, seq_len, head_dim//2, 2)
# so x.shape[1] = seq_len and x.shape[-1] = 2... but that doesn't match
# Actually, looking more carefully: xq_r = xq.float().reshape(xq.shape[:-1] + (-1, 2)).unbind(-1)
# So xq_r has shape (batch, seq_len, head_dim//2)
# Then reshape_for_broadcast is called with xq_r, so:
# freqs_cis.shape == (xq_r.shape[1], xq_r.shape[-1]) == (seq_len, head_dim//2)

freqs_cos = torch.randn(seq_len, head_dim // 2)
freqs_sin = torch.randn(seq_len, head_dim // 2)

ARGS = {
    "xq": xq,
    "xk": xk,
    "freqs_cos": freqs_cos,
    "freqs_sin": freqs_sin,
}
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 tuple, ndim 5, dtype family float — 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
apply_rotary_emb Ran
ran; our contract draft was wrong, not the code
awni00/dual-attention/dual_attention/dual_attention.py
code served (permissive licence) · get_code("dd15a61ea3d0e604")
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 5, 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

torch.manual_seed(0)

# Analyze the function:
# - apply_rotary_emb takes xq, xk, freqs_cos, freqs_sin (all torch.Tensor)
# - xq and xk are reshaped to (..., -1, 2) so last dim must be even
# - freqs_cos and freqs_sin are passed to reshape_for_broadcast
# - reshape_for_broadcast expects:
#   - freqs_cis.shape == (x.shape[1], x.shape[-1])
#   - x has ndim >= 2
#   - reshapes to [d if i == 1 or i == ndim - 1 else 1 for i, d in enumerate(x.shape)]

# Let's construct compatible tensors:
# xq and xk need shape (batch, seq_len, head_dim) where head_dim is even
# After reshape to (..., -1, 2), they become (batch, seq_len, head_dim//2, 2)

batch_size = 2
seq_len = 3
head_dim = 4  # must be even for reshape to (-1, 2)

xq = torch.randn(batch_size, seq_len, head_dim)
xk = torch.randn(batch_size, seq_len, head_dim)

# After xq.float().reshape(xq.shape[:-1] + (-1, 2))
# xq_r shape will be (batch_size, seq_len, head_dim//2) = (2, 3, 2)
# For reshape_for_broadcast: freqs_cis.shape == (x.shape[1], x.shape[-1])
# x in reshape_for_broadcast is xq_r with shape (2, 3, 2)
# So x.shape[1] = 3, x.shape[-1] = 2
# Therefore freqs_cos and freqs_sin should have shape (3, 2)

freqs_cos = torch.randn(seq_len, head_dim // 2)
freqs_sin = torch.randn(seq_len, head_dim // 2)

ARGS = {
    "xq": xq,
    "xk": xk,
    "freqs_cos": freqs_cos,
    "freqs_sin": freqs_sin,
}
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 tuple, ndim 5, dtype family float — 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
compute_causal_mask Ran
ran, violated the contract we drafted
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("a73cb1ba115d3af9")
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 (4, 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

torch.manual_seed(0)

ARGS = {
    "size": 4,
    "device": None,
}
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 (4, 4) — shape (4, 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
create_norm Ran
ran; our contract draft was wrong, not the code
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("f108c0c79bea8101")
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 RMSNorm. 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 = {
    'd_model': 64,
    'norm_type': 'rmsnorm'
}
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 RMSNorm — a RMSNorm output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a RMSNorm 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
get_activation_function Ran
ran; our contract draft was wrong, not the code
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("074ed3e1882dc275")
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 ReLU. 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)

# The function takes a single parameter: name (string)
# It looks up the name in activation_dict and returns the corresponding activation function
# Valid names are: 'relu', 'sigmoid', 'tanh', 'gelu', 'silu', 'softmax', 'identity'

ARGS = {
    'name': 'relu'
}
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 ReLU — a ReLU output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ReLU 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
Attention Not yet run
unverified (harvested, no recorded run)
awni00/dual-attention/dual_attention/dual_attention.py
code served (permissive licence) · get_code("ed6c6aa45ef23326")
How it ran

no invocation recorded.

DisentangledRelationalCrossAttention Not yet run
unverified (harvested, no recorded run)
awni00/dual-attention/dual_attention/dual_attention.py
code served (permissive licence) · get_code("65050ac2515e807a")
How it ran

no invocation recorded.

DualAttention Not yet run
unverified (harvested, no recorded run)
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("3cabca1c79c7e81e")
How it ran

no invocation recorded.

DualAttention Not yet run
unverified (harvested, no recorded run)
awni00/dual-attention/dual_attention/dual_attention.py
code served (permissive licence) · get_code("906b56a4d10f246c")
How it ran

no invocation recorded.

DualAttnEncoderBlock Not yet run
unverified (harvested, no recorded run)
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("85bb295631648984")
How it ran

no invocation recorded.

DualAttnTransformerLM Not yet run
unverified (harvested, no recorded run)
awni00/abstract_transformer/dual_attention_transformer.py
code served (permissive licence) · get_code("81995fb31f7a5e45")
How it ran

no invocation recorded.

RelationalCrossAttention Not yet run
unverified (harvested, no recorded run)
awni00/dual-attention/dual_attention/dual_attention.py
code served (permissive licence) · get_code("8f6de9b1d93efd34")
How it ran

no invocation recorded.

Also present in other papers' code

Of 21 samples lifted from this paper's linked repositories, 21 carry a function identity and 0 do not. Of the 20 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 19 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
apply_rotary_emb
brick of this paper's assembly: helper
4 other papers
3 dated earlier, 1 later · 1 only as an assembly brick
2203.15556 (2022-03)
Training Compute-Optimal Large Language Models
2307.09288 (2023-07)
Llama 2: Open Foundation and Fine-Tuned Chat Models
2309.00638 (2023-09)
Generative AI for End-to-End Limit Order Book Modelling: A Token-Level Autoregressive Generative Model of Message Flow Using a Deep State Space Network
and 1 more not named here

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

Relational reasoning is a central component of generally intelligent systems, enabling robust and data-efficient inductive generalization. Recent empirical evidence shows that many existing neural architectures, including Transformers, struggle with tasks requiring relational reasoning. In this work, we distinguish between two types of information: sensory information about the properties of individual objects, and relational information about the relationships between objects. While neural attention provides a powerful mechanism for controlling the flow of sensory information between objects, the Transformer lacks an explicit computational mechanism for routing and processing relational information. To address this limitation, we propose an architectural extension of the Transformer framework that we call the Dual Attention Transformer (DAT), featuring two distinct attention mechanisms: sensory attention for directing the flow of sensory information, and a novel relational attention mechanism for directing the flow of relational information. We empirically evaluate DAT on a diverse set of tasks ranging from synthetic relational benchmarks to complex real-world tasks such as language modeling and visual processing. Our results demonstrate that integrating explicit relational computational mechanisms into the Transformer architecture leads to significant performance gains in terms of data efficiency and parameter efficiency.

For agents

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

get_harvested_code_for_paper("2405.16727")
get_code_for_paper("2405.16727")
have("2405.16727")

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

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

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

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

Connect an agent — have() is free.