SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2306.11197 · NeurIPS · 2023

Sparse Modular Activation for Efficient Sequence Modeling

Yang Liu, Chenguang Zhu, Yichong Xu, Shuohang Wang, Chengxiang Zhai, Liliang Ren

arXiv · PDF · Open in the Atlas

Code that ran

4 of 6 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 0 have no contract verdict; 4 failures of our instrument; 2 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/2306.11197.json · badge: /api/ran/2306.11197.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
renll/seqboat canonical (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
renll/SeqBoat canonical (classifier label)
classifier basis: classifier_2025
2 ran · 1 no recorded run
FunctionStatusWhere it lives
compress_seq Ran
ran; our contract draft was wrong, not the code
renll/seqboat/fairseq/modules/seqboat_utils.py
code served (permissive licence) · get_code("16d4336d8f83317d")
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, 5, 4) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Analyze the function compress_seq(q, index_q, max_sl, dim=-2)
# q: tensor that gets scattered into new_q
# index_q: indices for scatter operation along dim
# max_sl: maximum sequence length (int)
# dim: dimension to scatter along (default -2)

# Create a small tensor q with shape (batch=2, seq=5, features=4)
q = torch.randn(2, 5, 4, dtype=torch.float32)

# Create index_q for scatter operation
# scatter_ requires indices to have same shape as q or be broadcastable
# For dim=-2 (sequence dimension), we need indices of shape (2, 5, 4)
index_q = torch.randint(0, 6, (2, 5, 4), dtype=torch.long)

# max_sl: maximum sequence length (int)
max_sl = 5

# dim: dimension along which to scatter (default -2)
dim = -2

ARGS = {
    "q": q,
    "index_q": index_q,
    "max_sl": max_sl,
    "dim": dim
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 3, dtype family float, shape (2, 5, 4) — shape (2, 5, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compress_seq Ran
ran; our contract draft was wrong, not the code
renll/SeqBoat/fairseq/modules/seqboat_utils.py
code served (permissive licence) · get_code("ea162056659141fe")
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, 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)

# Create a small tensor q with shape (batch=2, seq_len=5, dim=4)
# dim=-2 means we're indexing along the sequence dimension
q = torch.randn(2, 5, 4, dtype=torch.float32)

# Create index_q tensor for scatter_ operation
# scatter_ expects indices with same number of dims as q
# For dim=-2 (which is dim=1 in this case), we need indices of shape (2, 3, 4)
# representing 3 positions to scatter into
index_q = torch.tensor([
    [[0, 1, 2, 0], [1, 2, 3, 1], [2, 3, 4, 2]],
    [[0, 1, 2, 0], [1, 2, 3, 1], [2, 3, 4, 2]]
], dtype=torch.long)

# max_sl parameter - maximum sequence length
max_sl = 4

# dim parameter - dimension along which to operate
dim = -2

ARGS = {
    'q': q,
    'index_q': index_q,
    'max_sl': max_sl,
    'dim': dim
}
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, 4, 4) — shape (2, 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
eval_index Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
renll/SeqBoat/fairseq/modules/seqboat_utils.py
code served (permissive licence) · get_code("1143997b3acc55c1")
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 4, dtype family float, shape (2, 3, 3, 5) 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)

# Analyze the function:
# - x: needs to have .shape attribute (tensor-like)
# - dim: integer parameter
# The function constructs a string that indexes into x using eval()
# It slices up to dimension `dim` with ':,' then takes [1:] on the last dimension

# Create a tensor with distinct dimensions for probing
x = torch.randn(2, 3, 4, 5)  # 4D tensor with distinct sizes

# Test with positive dim
dim = 2

ARGS = {
    'x': x,
    'dim': dim
}
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 4, dtype family float, shape (2, 3, 3, 5) — shape (2, 3, 3, 5) 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
extract Ran
ran; our contract draft was wrong, not the code
renll/seqboat/fairseq/modules/seqboat_utils.py
code served (permissive licence) · get_code("68a9bc5cdddf3d5f")
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 4, dtype family float, shape (2, 3, 2, 5) 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.functional as F

torch.manual_seed(0)

# Analyze the function:
# - h: a tensor that gets padded and gathered from
# - index_q: indices used for gathering, needs to be expandable and have shape compatible with gather

# h needs to be a 4D tensor (based on the gather operation with -2 and -1 indexing)
# After padding (0, 0, 1, 0), it adds 1 row at the beginning
# The gather uses index_q.expand(-1, -1, -1, h.shape[-1])
# So index_q should be 4D with last dim that will be expanded to h.shape[-1]

# Create h: shape (batch=2, seq=3, height=4, width=5)
h = torch.randn(2, 3, 4, 5)

# Create index_q: shape (batch=2, seq=3, num_indices=2, 1)
# This will be expanded to (2, 3, 2, 5) to match h after padding
index_q = torch.randint(0, 5, (2, 3, 2, 1))

ARGS = {
    "h": h,
    "index_q": index_q,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 4, dtype family float, shape (2, 3, 2, 5) — shape (2, 3, 2, 5) 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
eval_index Not yet run
unverified (harvested, no recorded run)
renll/seqboat/fairseq/modules/seqboat_utils.py
code served (permissive licence) · get_code("d80d8f90a3b7c6a3")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

extract Not yet run
unverified (harvested, no recorded run)
renll/SeqBoat/fairseq/modules/seqboat_utils.py
code served (permissive licence) · get_code("f7d2d85a394c8f84")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 3 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 2 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
eval_index 1 other paper
1 later
2603.28743 (2026-03)
Rethinking Language Model Scaling under Transferable Hypersphere Optimization

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

Recent hybrid models combining Linear State Space Models (SSMs) with selfattention mechanisms have demonstrated impressive results across a range of sequence modeling tasks. However, current approaches apply attention modules statically and uniformly to all elements in the input sequences, leading to suboptimal quality-efficiency trade-offs. To address this limitation, we introduce Sparse Modular Activation (SMA), a general mechanism enabling neural networks to sparsely and dynamically activate sub-modules for sequence elements in a differentiable manner. Through allowing each element to skip non-activated sub-modules, SMA reduces computation and memory consumption of neural networks at both training and inference stages. To validate the effectiveness of SMA on sequence modeling, we design a novel neural architecture, SeqBoat, which employs SMA to sparsely activate a Gated Attention Unit (GAU) based on the state representations learned from an SSM. By constraining the GAU to only conduct local attention on the activated inputs, SeqBoat can achieve linear inference complexity with theoretically infinite attention span, and provide substantially better quality-efficiency trade-off than the chunking-based models. With experiments on a wide range of tasks, including long sequence modeling, speech classification and language modeling, SeqBoat brings new state-of-the-art results among hybrid models with linear complexity, and reveals the amount of attention needed for each task through the learned sparse activation patterns. Our code is publicly available at https://github.com/renll/SeqBoat.

For agents

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

get_harvested_code_for_paper("2306.11197")
get_code_for_paper("2306.11197")
have("2306.11197")

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

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

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

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

Connect an agent — have() is free.