SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.13685 · 2025

MoM: Linear Sequence Modeling with Mixture-of-Memories

arXiv · PDF · Open in the Atlas

Code that ran

1 of 4 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; 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/2502.13685.json · badge: /api/ran/2502.13685.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
opensparsellms/mom canonical (classifier label)
classifier basis: classifier_2025
1 ran · 1 no recorded run
opensparsellms/linear-moe canonical (classifier label)
classifier basis: classifier_2025
0 ran · 2 no recorded run
FunctionStatusWhere it lives
reconstruct Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
opensparsellms/mom/mom/layers/mom.py
code served (permissive licence) · get_code("82b0548f337befe9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned Tensor, ndim 3, dtype family float, shape (2, 3, 6) 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)

batch_size = 2
seq_len = 3
topk = 2
num_memories = 4
capacity_len = 5
hidden_size = 6

# transformed_x: (num_memories, batch_size, capacity_len, hidden_size)
transformed_x = torch.randn(num_memories, batch_size, capacity_len, hidden_size)

# indices: (batch*num_memories, max_len)
# These are used for scattering back to positions in (batch_size * seq_len * topk)
# max_len should be <= capacity_len based on typical usage
max_len = capacity_len
# indices should be in range [0, batch_size * seq_len * topk)
indices = torch.randint(0, batch_size * seq_len * topk, (batch_size * num_memories, max_len))

# sorted_indices: (batch_size*seq_len*topk)
# These are indices that were used to sort the original selection
sorted_indices = torch.randperm(batch_size * seq_len * topk)

# routing_weights: (batch_size, seq_len, topk)
routing_weights = torch.rand(batch_size, seq_len, topk)
# Normalize routing weights to sum to 1 along topk dimension (typical for routing)
routing_weights = routing_weights / routing_weights.sum(dim=-1, keepdim=True)

# mask: (batch*num_memories, max_len)
# Boolean mask indicating valid positions
mask = torch.randint(0, 2, (batch_size * num_memories, max_len)).bool()

ARGS = {
    'transformed_x': transformed_x,
    'indices': indices,
    'sorted_indices': sorted_indices,
    'batch_size': batch_size,
    'seq_len': seq_len,
    'topk': topk,
    'routing_weights': routing_weights,
    'mask': mask
}
Setup block drafted by
a language model, Claude Sonnet 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, 6) — shape (2, 3, 6) 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
reconstruct Not yet run
unverified (harvested, no recorded run)
opensparsellms/linear-moe/linear_moe/sequence_modeling/mom_linear_attention.py
code served (permissive licence) · get_code("841c385fbbc37664")
How it ran

no invocation recorded.

transform Not yet run
unverified (harvested, no recorded run)
opensparsellms/linear-moe/linear_moe/sequence_modeling/mom_linear_attention.py
code served (permissive licence) · get_code("dd1050bf4bed6021")
How it ran

no invocation recorded.

transform Not yet run
unverified (harvested, no recorded run)
opensparsellms/mom/mom/layers/mom.py
code served (permissive licence) · get_code("c418611433fa4b9d")
How it ran

no invocation recorded.

Also present in other papers' code

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

Linear sequence modeling methods, such as linear attention, state space modeling, and linear RNNs, offer significant efficiency improvements by reducing the complexity of training and inference. However, these methods typically compress the entire input sequence into a single fixed-size memory state, which leads to suboptimal performance on recall-intensive tasks. To address this limitation, we introduce a novel architecture called Mixture-of-Memories (MoM). MoM utilizes multiple independent memory states, with a router network directing input tokens to specific memory states. This approach greatly enhances the overall memory capacity while minimizing memory interference. MoM serves as a general framework that can be seamlessly combined with diverse memory update mechanisms across linear models. As a result, MoM performs exceptionally well on recall-intensive tasks, surpassing existing linear sequence modeling techniques. Despite incorporating multiple memory states, the computation of each memory state remains linear in complexity, allowing MoM to retain the linear-complexity advantage during training, while constant-complexity during inference. Our experimental results show that MoM outperforms current linear sequence models on downstream language tasks, particularly recall-intensive tasks, and even achieves performance comparable to Transformer models. The code is released at https://github.com/OpenSparseLLMs/MoM and is also released as a part of https://github.com/OpenSparseLLMs/Linear-MoE.

For agents

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

get_harvested_code_for_paper("2502.13685")
get_code_for_paper("2502.13685")
have("2502.13685")

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

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

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

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

Connect an agent — have() is free.