SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2605.17811 · 2026

One Model, Two Roles: Emergent Specialization in a Shared Recurrent Transformer

Anastasios Kyrillidis, Jucheng Shen, Barbara Su

arXiv · PDF · Open in the Atlas

Code that ran

7 of 18 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; 1 honoured the contract we drafted, 0 violated it and 3 have no contract verdict; 3 failures of our instrument; 11 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.17811.json · badge: /api/ran/2605.17811.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
juchengshen/air community
Papers with Code archive
7 ran · 11 no recorded run
FunctionStatusWhere it lives
CastedEmbedding Ran
ran on a synthesized input
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("c21ab832360c7a4e")
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 (6, 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 math
import torch
import torch.nn.functional as F
from torch import nn

def trunc_normal_init_(tensor: torch.Tensor, std: float=1.0, lower: float=-2.0, upper: float=2.0):
    with torch.no_grad():
        if std == 0:
            tensor.zero_()
        else:
            sqrt2 = math.sqrt(2)
            a = math.erf(lower / sqrt2)
            b = math.erf(upper / sqrt2)
            z = (b - a) / 2
            c = (2 * math.pi) ** (-0.5)
            pdf_u = c * math.exp(-0.5 * lower ** 2)
            pdf_l = c * math.exp(-0.5 * upper ** 2)
            comp_std = std / math.sqrt(1 - (upper * pdf_u - lower * pdf_l) / z - ((pdf_u - pdf_l) / z) ** 2)
            tensor.uniform_(a, b)
            tensor.erfinv_()
            tensor.mul_(sqrt2 * comp_std)
            tensor.clip_(lower * comp_std, upper * comp_std)
    return tensor

class CastedEmbedding(nn.Module):

    def __init__(self, num_embeddings: int, embedding_dim: int, init_std: float, cast_to: torch.dtype):
        super().__init__()
        self.cast_to = cast_to
        self.embedding_weight = nn.Parameter(trunc_normal_init_(torch.empty((num_embeddings, embedding_dim)), std=init_std))

    def forward(self, input: torch.Tensor) -> torch.Tensor:
        return F.embedding(input, self.embedding_weight.to(self.cast_to))


INIT_ARGS = {
    'num_embeddings': 8,
    'embedding_dim': 4,
    'init_std': 0.5,
    'cast_to': torch.float32,
}

ARGS = {
    'input': torch.tensor([0, 1, 2, 3, 1, 2], dtype=torch.long),
}
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 (6, 4) — shape (6, 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)
CastedLinear Ran
ran on a synthesized input
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("5e1bae41e0f0de3b")
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, 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 torch.nn as nn
import math
import torch.nn.functional as F

def trunc_normal_init_(tensor: torch.Tensor, std: float=1.0, lower: float=-2.0, upper: float=2.0):
    with torch.no_grad():
        if std == 0:
            tensor.zero_()
        else:
            sqrt2 = math.sqrt(2)
            a = math.erf(lower / sqrt2)
            b = math.erf(upper / sqrt2)
            z = (b - a) / 2
            c = (2 * math.pi) ** (-0.5)
            pdf_u = c * math.exp(-0.5 * lower ** 2)
            pdf_l = c * math.exp(-0.5 * upper ** 2)
            comp_std = std / math.sqrt(1 - (upper * pdf_u - lower * pdf_l) / z - ((pdf_u - pdf_l) / z) ** 2)
            tensor.uniform_(a, b)
            tensor.erfinv_()
            tensor.mul_(sqrt2 * comp_std)
            tensor.clip_(lower * comp_std, upper * comp_std)
    return tensor

class CastedLinear(nn.Module):

    def __init__(self, in_features: int, out_features: int, bias: bool):
        super().__init__()
        self.weight = nn.Parameter(trunc_normal_init_(torch.empty((out_features, in_features)), std=1.0 / in_features ** 0.5))
        self.bias = None
        if bias:
            self.bias = nn.Parameter(torch.zeros((out_features,)))

    def forward(self, input: torch.Tensor) -> torch.Tensor:
        return F.linear(input, self.weight.to(input.dtype), bias=self.bias.to(input.dtype) if self.bias is not None else None)


INIT_ARGS = {
    'in_features': 4,
    'out_features': 3,
    'bias': True,
}

ARGS = {
    'input': torch.randn(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, 3) — shape (2, 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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
SwiGLU Ran
ran on a synthesized input
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("0160973ed66c95fd")
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, 3, 8) 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 math
import torch
import torch.nn.functional as F
from torch import nn

class CastedLinear(nn.Module):

    def __init__(self, in_features: int, out_features: int, bias: bool):
        super().__init__()
        self.weight = nn.Parameter(trunc_normal_init_(torch.empty((out_features, in_features)), std=1.0 / in_features ** 0.5))
        self.bias = None
        if bias:
            self.bias = nn.Parameter(torch.zeros((out_features,)))

    def forward(self, input: torch.Tensor) -> torch.Tensor:
        return F.linear(input, self.weight.to(input.dtype), bias=self.bias.to(input.dtype) if self.bias is not None else None)

def _find_multiple(a, b):
    return -(a // -b) * b

def trunc_normal_init_(tensor: torch.Tensor, std: float=1.0, lower: float=-2.0, upper: float=2.0):
    with torch.no_grad():
        if std == 0:
            tensor.zero_()
        else:
            sqrt2 = math.sqrt(2)
            a = math.erf(lower / sqrt2)
            b = math.erf(upper / sqrt2)
            z = (b - a) / 2
            c = (2 * math.pi) ** (-0.5)
            pdf_u = c * math.exp(-0.5 * lower ** 2)
            pdf_l = c * math.exp(-0.5 * upper ** 2)
            comp_std = std / math.sqrt(1 - (upper * pdf_u - lower * pdf_l) / z - ((pdf_u - pdf_l) / z) ** 2)
            tensor.uniform_(a, b)
            tensor.erfinv_()
            tensor.mul_(sqrt2 * comp_std)
            tensor.clip_(lower * comp_std, upper * comp_std)
    return tensor

class SwiGLU(nn.Module):

    def __init__(self, hidden_size: int, expansion: float):
        super().__init__()
        inter = _find_multiple(round(expansion * hidden_size * 2 / 3), 256)
        self.gate_up_proj = CastedLinear(hidden_size, inter * 2, bias=False)
        self.down_proj = CastedLinear(inter, hidden_size, bias=False)

    def forward(self, x):
        gate, up = self.gate_up_proj(x).chunk(2, dim=-1)
        return self.down_proj(F.silu(gate) * up)


INIT_ARGS = {
    "hidden_size": 8,
    "expansion": 1.5,
}

ARGS = {
    "x": torch.randn(2, 3, 8),
}
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 3, dtype family float, shape (2, 3, 8) — shape (2, 3, 8) 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)
_find_multiple Ran
ran, honoured the contract we drafted
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("ee6b213d67acc21f")
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 int, ndim 0, dtype family int, shape () 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)

# Analyze the function: _find_multiple(a, b)
# The function performs: -(a // -b) * b
# This is a mathematical operation on two numeric values
# Both a and b should be integers or tensors that support floor division

a = 17
b = 5

ARGS = {
    'a': a,
    'b': b,
}
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 int, ndim 0, dtype family int, shape () — shape () 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
rms_norm Ran
ran; our contract draft was wrong, not the code
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("277cf09c927bf2c0")
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) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 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)

# Create a small hidden states tensor
# Shape: (batch_size=2, sequence_length=3, hidden_dim=4)
hidden_states = torch.randn(2, 3, 4, dtype=torch.float32)

# variance_epsilon is a small float to prevent division by zero
variance_epsilon = 1e-6

ARGS = {
    "hidden_states": hidden_states,
    "variance_epsilon": variance_epsilon,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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 3, dtype family float, shape (2, 3, 4) — shape (2, 3, 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
rotate_half Ran
ran; our contract draft was wrong, not the code
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("5d0ae16200be190c")
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) 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

torch.manual_seed(0)

# The function rotate_half takes a tensor and rotates half the hidden dimensions
# It accesses x[..., :x.shape[-1] // 2] and x[..., x.shape[-1] // 2:]
# Then concatenates them with torch.cat along dim=-1
# So we need a tensor with an even last dimension

x = torch.randn(2, 4)  # batch size 2, hidden dim 4 (even number)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
trunc_normal_init_ Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("e9e39505360d7d07")
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) 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 math

torch.manual_seed(0)

# Create a small tensor to initialize
tensor = torch.empty(2, 4)

# Define all parameters for trunc_normal_init_
ARGS = {
    "tensor": tensor,
    "std": 1.0,
    "lower": -2.0,
    "upper": 2.0,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
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
AIR Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("5576aa66b9ec2ea4")
How it ran

no invocation recorded.

AIRBlock Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("1df5376995a79795")
How it ran

no invocation recorded.

AIRCarry Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("6bb1e0108ac99fa1")
How it ran

no invocation recorded.

AIRConfig Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("a012233c3527ade7")
How it ran

no invocation recorded.

AIRInnerCarry Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("55ce9b34d823aa4d")
How it ran

no invocation recorded.

AIRReasoningModule Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("e2fa7ed580a7f6f9")
How it ran

no invocation recorded.

AIR_Inner Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("335ba801be5558c2")
How it ran

no invocation recorded.

Attention Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("e1fe279de6f03a37")
How it ran

no invocation recorded.

CastedSparseEmbedding Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("9d3cb2d57bdf4030")
How it ran

no invocation recorded.

RotaryEmbedding Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("ecf65cb1949cf62e")
How it ran

no invocation recorded.

apply_rotary_pos_emb Not yet run
unverified (harvested, no recorded run)
juchengshen/air/models/air/air_1net_L2x_H2x_input_token_prepend.py
code served (permissive licence) · get_code("99138bc8ae291d5f")
How it ran

no invocation recorded.

Also present in other papers' code

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

Can a shared-weight recurrent Transformer develop distinct internal roles without being partitioned into separate modules? We study this in Asymmetric Input Recurrence (AIR), a minimal two-state reasoning architecture in which the same Transformer model is reused for both updates (per literature, L and H) and the only built-in difference in the update rule is that the encoded input is injected during L-updates but not H-updates. Across Sudoku-Extreme and Maze, decoded rollouts reveal a consistent split: z H behaves like a fully committed proposal state, whereas z L retains local uncertainty and shifting intermediate structure. Freeze experiments show that this split is, in practice, related to the model's state dynamics: in Sudoku, freezing z H reduces z L 's content changes whereas freezing z L increases z H 's, while in Maze, freezing either state increases content changes in the other state. Ablations show that to induce specialization, the shared model needs to be able to tell the two update types apart, either from input injection asymmetry or from a separate level token. Mechanistically, attention analysis shows that L-updates are consistently more local than H-updates in both Sudoku and Maze. Together, these results show that, in a two-state recurrent setting, a clear state-identity signal can induce stable, related functional roles inside a shared-parameter recurrent Transformer. Code is available at https://github.com/juchengshen/air.

For agents

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

get_harvested_code_for_paper("2605.17811")
get_code_for_paper("2605.17811")
have("2605.17811")

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

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

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

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

Connect an agent — have() is free.