SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.03234 · ICML · 2024

Caduceus: Bi-Directional Equivariant Long-Range DNA Sequence Modeling

Yair Schiff, Albert Gu, Tri Dao, Chia-Hsiang Kao, Aaron Gokaslan, Volodymyr Kuleshov

arXiv · PDF · Open in the Atlas

Code that ran

9 of 16 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 1 violated it and 2 have no contract verdict; 6 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/2403.03234.json · badge: /api/ran/2403.03234.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
kuleshov-group/caduceus canonical (classifier label)
classifier basis: census
6 ran · 1 no recorded run
jimmylihui/genbench community (classifier label)
classifier basis not recorded on the link
2 ran · 4 no recorded run
frederikkemarin/bend community
Papers with Code archive
1 ran · 1 no recorded run
jimmylihui/OpenGenome community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
CaduceusEmbedder Ran
ran on a synthesized input · constructed an object; no result was computed
frederikkemarin/bend/bend/utils/embedders.py
code served (permissive licence) · get_code("1b4e43606258990e")
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, CaduceusEmbedder: the run constructed the object and did not call it, so no result was computed. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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
from typing import List
from unittest.mock import Mock, MagicMock

torch.manual_seed(0)

# Create a mock tokenizer
class MockTokenizer:
    def batch_encode_plus(self, sequences, add_special_tokens=False, return_attention_mask=False, max_length=None, truncation=False):
        # Return mock tokenized output
        return {
            'input_ids': [[1, 2, 3] for _ in sequences],
            'attention_mask': [[1, 1, 1] for _ in sequences]
        }
    
    def decode(self, token_ids):
        return "decoded_sequence"

# Create a mock model
class MockCaduceusModel(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.linear = torch.nn.Linear(3, 4)
    
    def eval(self):
        return self
    
    def to(self, device):
        return self
    
    def forward(self, input_ids, attention_mask=None):
        # Mock output
        logits = self.linear(torch.randn(len(input_ids), 3, 3))
        return Mock(logits=logits, hidden_states=torch.randn(len(input_ids), 3, 4))

# Mock the AutoTokenizer and AutoModelForMaskedLM
import sys
from unittest.mock import patch

mock_tokenizer = MockTokenizer()
mock_model = MockCaduceusModel()

def mock_from_pretrained_tokenizer(*args, **kwargs):
    return mock_tokenizer

def mock_from_pretrained_model(*args, **kwargs):
    return mock_model

# Patch the imports
original_auto_tokenizer = None
original_auto_model = None

try:
    from transformers import AutoTokenizer, AutoModelForMaskedLM
    original_auto_tokenizer = AutoTokenizer.from_pretrained
    original_auto_model = AutoModelForMaskedLM.from_pretrained
    AutoTokenizer.from_pretrained = mock_from_pretrained_tokenizer
    AutoModelForMaskedLM.from_pretrained = mock_from_pretrained_model
except:
    pass

# Mock mamba_ssm module
mock_mamba = MagicMock()
mock_mamba.__version__ = '1.2.0.post1'
sys.modules['mamba_ssm'] = mock_mamba

ARGS = {
    'model_name': 'kuleshov-group/caduceus-ph_seqlen-131k_d_model-256_n_layer-16',
    'return_logits': False,
    'return_loss': False,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
mamba_ssm, numpy, torch, tqdm, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type CaduceusEmbedder — 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 CaduceusEmbedder 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
cross_entropy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kuleshov-group/caduceus/caduceus/modeling_caduceus.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from divelab/AIRS, is pointer only (licence: GPL-3.0) · get_code("83de732cfd3e479f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from divelab/AIRS, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

deprecated Ran
ran; our contract draft was wrong, not the code
jimmylihui/genbench/src/dataloaders/base.py
code served (permissive licence) · get_code("25edc240223b76c0")
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 function. 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 'deprecated' takes a single parameter: cls_or_func
# It returns a decorator that wraps the input and prints a deprecation message
# The input can be either a class or a function

# Create a simple function to use as the input
def sample_function(x, y):
    """A simple sample function"""
    return x + y

# Create a simple class to use as the input
class SampleClass:
    """A simple sample class"""
    def __init__(self, value):
        self.value = value
    
    def method(self):
        return self.value * 2

# We can use either the function or the class as the argument
# Let's use the function as our test case
ARGS = {
    'cls_or_func': sample_function
}
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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
fftconv_h3_ref Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kuleshov-group/caduceus/src/ops/fftconv.py
code served (permissive licence) · get_code("5d11b94982686ba5")
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 3, 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
from einops import rearrange

torch.manual_seed(0)

# Small tensor dimensions
batch = 2
head_dim = 1
num_heads = 3
d1 = head_dim
d2 = head_dim
seqlen = 4

# k: shape (batch, h*d1, seqlen)
k = torch.randn(batch, num_heads * d1, seqlen)

# ssm_kernel: shape (seqlen,) or similar for FFT
ssm_kernel = torch.randn(seqlen)

# D: shape (num_heads * d2,) for the skip connection
D = torch.randn(num_heads * d2)

# q: shape (batch, h*d1, seqlen)
q = torch.randn(batch, num_heads * d1, seqlen)

# v: shape (batch, h*d2, seqlen)
v = torch.randn(batch, num_heads * d2, seqlen)

# head_dim parameter
head_dim_param = 1

# ssm_kernel_rev: optional, can be None or a tensor
ssm_kernel_rev = None

ARGS = {
    'k': k,
    'ssm_kernel': ssm_kernel,
    'D': D,
    'q': q,
    'v': v,
    'head_dim': head_dim_param,
    'ssm_kernel_rev': ssm_kernel_rev,
}
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 Tensor, ndim 3, dtype family float — no output shape is stated: observe_signature.py could not observe it (import:OSError)
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
fftconv_ref Ran
ran; our contract draft was wrong, not the code
kuleshov-group/caduceus/src/ops/fftconv.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from divelab/AIRS, is pointer only (licence: GPL-3.0) · get_code("741eb38fcf150c88")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from divelab/AIRS, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

fsspec_exists Ran
ran, violated the contract we drafted
kuleshov-group/caduceus/vep_embeddings.py
code served (permissive licence) · get_code("31a8ada19e8c38e8")
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 bool, ndim 0, dtype family float, 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 fsspec
import tempfile
import os

# Create a temporary file to test fsspec_exists
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test_file.txt")

# Create the file so it exists
with open(temp_file, "w") as f:
    f.write("test content")

# Define arguments for fsspec_exists
ARGS = {
    "filename": temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
fsspec — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, 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
inject_substring Ran
ran on a synthesized input
jimmylihui/genbench/huggingface.py
code served (permissive licence) · get_code("16c2a70f52e70a43")
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 str. 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 re

def inject_substring(orig_str):
    """Hack to handle matching keys between models trained with and without
    gradient checkpointing."""
    pattern = '\\.mixer'
    injection = '.mixer.layer'
    modified_string = re.sub(pattern, injection, orig_str)
    pattern = '\\.mlp'
    injection = '.mlp.layer'
    modified_string = re.sub(pattern, injection, modified_string)
    return modified_string


ARGS = {
    'orig_str': 'model.layers.0.mixer.attention.weights'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str 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
recast_chromosome_tissue_dist2TSS Ran
ran; our contract draft was wrong, not the code
kuleshov-group/caduceus/vep_embeddings.py
code served (permissive licence) · get_code("c42e2917c6490693")
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 dict. 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

torch.manual_seed(0)

# The function expects a dict with keys: 'chromosome', 'tissue', 'distance_to_nearest_tss'
# It processes examples, so we need to provide a dict with these keys

examples = {
    'chromosome': 'X',
    'tissue': 'heart',
    'distance_to_nearest_tss': 1000
}

ARGS = {
    'examples': examples
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
weighted_cross_entropy Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
kuleshov-group/caduceus/caduceus/modeling_caduceus.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from divelab/AIRS, is pointer only (licence: GPL-3.0) · get_code("2ef47d00e83953ae")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from divelab/AIRS, and GPL-3.0, as GitHub detects it on that repository, is not in the permissive set Syntology serves inline. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

BaseEmbedder Not yet run
unverified (harvested, no recorded run)
frederikkemarin/bend/bend/utils/embedders.py
code served (permissive licence) · get_code("7d9802ebb95082ad")
How it ran

no invocation recorded.

HyenaOperator Not yet run
unverified (harvested, no recorded run)
jimmylihui/OpenGenome/src/models/sequence/hyena.py
code served (permissive licence) · get_code("0bd488da131151fe")
How it ran

no invocation recorded.

adaptive_coarsegrain_gpu Not yet run
unverified (harvested, no recorded run)
jimmylihui/genbench/selene_utils2.py
code served (permissive licence) · get_code("d8cff84d50ba79b0")
How it ran

no invocation recorded.

fsspec_listdir Not yet run
unverified (harvested, no recorded run)
kuleshov-group/caduceus/vep_embeddings.py
code served (permissive licence) · get_code("db0136eb80a50383")
How it ran

no invocation recorded.

load_weights Not yet run
unverified (harvested, no recorded run)
jimmylihui/genbench/huggingface.py
code served (permissive licence) · get_code("36671e7e4ba9ec81")
How it ran

no invocation recorded.

time_features Not yet run
unverified (harvested, no recorded run)
jimmylihui/genbench/src/dataloaders/et.py
code served (permissive licence) · get_code("9d0777602eda354e")
How it ran

no invocation recorded.

time_features_from_frequency_str Not yet run
unverified (harvested, no recorded run)
jimmylihui/genbench/src/dataloaders/et.py
code served (permissive licence) · get_code("f8544563682146e5")
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.

Also present in other papers' code

Of 16 samples lifted from this paper's linked repositories, 16 carry a function identity and 0 do not. Of the 16 distinct functions with an identity, 11 are also present in other papers whose code we hold (8 with at least one paper dated earlier, 1 the same month, 9 later) and 5 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
time_features_from_frequency_str 19 other papers
9 dated earlier, 1 the same month, 9 later
2203.05167 (2022-03)
TiSAT: Time Series Anomaly Transformer
2208.04933 (2022-08)
Simplified State Space Layers for Sequence Modeling
2305.10721 (2023-05)
Revisiting Long-term Time Series Forecasting: An Investigation on Linear Mapping
and 16 more not named here
fsspec_exists 7 other papers
7 later
2410.13643 (2024-10)
Fine-Tuning Discrete Diffusion Models via Reward Optimization with Applications to DNA and Protein Design
2502.01384 (2025-02)
Fine-Tuning Discrete Diffusion Models with Policy Gradient Methods
2505.18883 (2025-05)
Partition Generative Modeling: Masked Modeling Without Masks
and 4 more not named here
cross_entropy 6 other papers
1 dated earlier, 5 later
2305.04120 (2023-05)
A Latent Diffusion Model for Protein Structure Generation
2412.10193 (2024-12)
Simple Guidance Mechanisms for Discrete Diffusion Models
2505.17257 (2025-05)
JanusDNA: A Powerful Bi-directional Hybrid DNA Foundation Model
and 3 more not named here
fsspec_listdir 6 other papers
6 later
2410.13643 (2024-10)
Fine-Tuning Discrete Diffusion Models via Reward Optimization with Applications to DNA and Protein Design
2502.01384 (2025-02)
Fine-Tuning Discrete Diffusion Models with Policy Gradient Methods
2505.18883 (2025-05)
Partition Generative Modeling: Masked Modeling Without Masks
and 3 more not named here
weighted_cross_entropy 6 other papers
1 dated earlier, 5 later
2305.04120 (2023-05)
A Latent Diffusion Model for Protein Structure Generation
2412.10193 (2024-12)
Simple Guidance Mechanisms for Discrete Diffusion Models
2505.17257 (2025-05)
JanusDNA: A Powerful Bi-directional Hybrid DNA Foundation Model
and 3 more not named here
deprecated 5 other papers
2 dated earlier, 3 later
2310.02980 (2023-10)
Never Train from Scratch: Fair Comparison of Long-Sequence Models Requires Data-Driven Priors
2402.15584 (2024-02)
State Space Models for Event Cameras
2406.02923 (2024-06)
P-Spikessm: Harnessing Probabilistic Spiking State Space Models for Long-Range Dependency Tasks
and 2 more not named here
fftconv_ref 4 other papers
3 dated earlier, 1 later
2302.10866 (2023-02)
Hyena Hierarchy: Towards Larger Convolutional Language Models
2305.04120 (2023-05)
A Latent Diffusion Model for Protein Structure Generation
2307.08423 (2023-07)
Artificial Intelligence for Science in Quantum, Atomistic, and Continuum Systems
and 1 more not named here
time_features 4 other papers
3 dated earlier, 1 later
2203.05167 (2022-03)
TiSAT: Time Series Anomaly Transformer
2208.04933 (2022-08)
Simplified State Space Layers for Sequence Modeling
2310.02980 (2023-10)
Never Train from Scratch: Fair Comparison of Long-Sequence Models Requires Data-Driven Priors
and 1 more not named here
BaseEmbedder
brick of this paper's assembly: helper
1 other paper
1 dated earlier · 1 only as an assembly brick
2306.15006 (2023-06)
DNABERT-2: EFFICIENT FOUNDATION MODEL AND BENCHMARK FOR MULTI-SPECIES GENOMES
HyenaOperator
brick of this paper's assembly: entry
1 other paper
1 dated earlier
2306.15794 (2023-06)
HyenaDNA: Long-Range Genomic Sequence Modeling at Single Nucleotide Resolution
fftconv_h3_ref 1 other paper
1 later
2602.21550 (2026-02)
Extending Sequence Length is Not All You Need: Effective Integration of Multimodal Signals for Gene Expression Prediction

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

Large-scale sequence modeling has sparked rapid advances that now extend into biology and genomics. However, modeling genomic sequences introduces challenges such as the need to model long-range token interactions, the effects of upstream and downstream regions of the genome, and the reverse complementarity (RC) of DNA. Here, we propose an architecture motivated by these challenges that builds off the long-range Mamba block, and extends it to a BiMamba component that supports bi-directionality, and to a MambaDNA block that additionally supports RC equivariance. We use MambaDNA as the basis of Caduceus, the first family of RC equivariant bi-directional long-range DNA language models, and we introduce pre-training and finetuning strategies that yield Caduceus DNA foundation models. Caduceus outperforms previous long-range models on downstream benchmarks; on a challenging long-range variant effect prediction task, Caduceus exceeds the performance of 10x larger models that do not leverage bidirectionality or equivariance. Code to reproduce our experiments is available here.

For agents

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

get_harvested_code_for_paper("2403.03234")
get_code_for_paper("2403.03234")
have("2403.03234")

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

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

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

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

Connect an agent — have() is free.