Skip to main content

recall-bench

Zero-shot long-range recall benchmark for genomic language models: how far back can a DNA LM still use an exact earlier copy of a sequence? Spun off from the Mnemos-DNA repeat-copy probe (B4K2/Mnemos-DNA, §6.4). Paper source: paper/.

Protocol. A real 256 bp hg38 segment A is repeated after d bp of held-out genomic background. copy_advantage = CE(control) − CE(repeat) on the identical final copy of A (nats/bp), where the control window has background instead of the first copy. Causal models are scored by next-token CE, masked LMs by masking the whole final copy. Text LMs run the same protocol on wikitext-103 as a positive control. 95% bootstrap CIs over trials.

Protocol options (defaults reproduce the paper's main results bit-for-bit):

option values measures
--variant exact · mutate --mut-rate p · revcomp exact, diverged (substitutions), or inverted (reverse-complement) repeats
--control native · foreign control piece is the genome that really precedes the gap, or an unrelated segment (both windows then carry an out-of-place piece, removing the short-d context-disruption penalty)

Every option sees the same windows for a given (seed, ctx, d), so options compare paired.

Install

pip install "recall-bench[hf,data] @ git+https://github.com/B4K2/recall-bench"

Extras: hf (Hugging Face models), data (building the backgrounds), mnemos (Mnemos-DNA arms, Caduceus, GLA/DeltaNet; with pip, first pip install git+https://github.com/B4K2/Mnemos-DNA), all. The core needs only torch, numpy, pyyaml. Blackwell (sm_120) GPUs need the CUDA 12.8 torch wheels; inside this repo uv sync --all-extras pins them.

Data and weights go under $RECALL_BENCH_HOME (default ~/.cache/recall_bench):

recall-bench prepare dna          # held-out hg38 background (~1 GB download, once)

Benchmark your own model (Python)

import recall_bench as rb

model = rb.CallableModel(
    logits_fn=lambda ids: net(ids),          # LongTensor (1, T) -> logits (1, T, V)
    tokenize=lambda s: [VOCAB[c] for c in s],
    causal=True,                             # masked LMs: causal=False, mask_id=...
    max_ctx=131072,
)
rows = rb.evaluate(model, distances=[64, 1024, 16384, 65536], trials=128,
                   out="results/my-model/copy.json")          # resumable
for r in rows:
    print(r["dist"], r["copy_advantage"], (r["ci_lo"], r["ci_hi"]))

rb.evaluate(model, variant="mutate", mut_rate=0.05)   # diverged repeats
rb.evaluate(model, variant="revcomp")                 # inverted repeats
rb.evaluate(model, control="foreign")                 # stricter control

Any Hugging Face checkpoint: rb.from_hf("org/model", causal=True, max_ctx=8192, align=1) (align=6 for 6-mer tokenizers). A custom background (another genome, other held-out regions): rb.DNABackground.from_strings([...]) passed as background=.

Command line

recall-bench list                                     # registry (recall_bench/models.yaml)
recall-bench run hyenadna-small-32k --fetch           # download if missing -> sweep -> JSON
recall-bench run mnemos-dna --variant mutate --mut-rate 0.05 --distances 64,1024,16384
recall-bench run-hf InstaDeepAI/nucleotide-transformer-v2-50m-multi-species \
    --masked --max-ctx 2048 --align 6
recall-bench report results/                          # table; --variant/--control to filter

Results: results/<model>/copy.json (one row per point and protocol; finished points are reused, each trial is checkpointed). Default sweep: d ∈ {64 … 262144} bp, ctx = smallest power of two that fits, 128 trials.

Reproducing the paper (this repo)

bash scripts/setup.sh                          # uv env (cu128 torch), .env, backgrounds
CLEANUP=1 bash scripts/run_all.sh ours baseline   # main sweep, one model at a time
bash scripts/run_protocols.sh                  # foreign control, revcomp, mutation sweep
uv run python paper/make_figures.py            # figures + tables from results/
cd paper/ieee && pdflatex main && bibtex main && pdflatex main && pdflatex main   # or paper/acm
uv run pytest                                  # CPU-only checks (no data or GPU needed)

The repo scripts set RECALL_BENCH_HOME to the repo, so data/ and checkpoints/ live here. Set HUGGING_FACE_TOKEN in .env. Caduceus needs mamba-ssm + causal-conv1d built for sm_120 (see Mnemos-DNA CLAUDE.md §9); evo2 needs the evo2 package and is marked optional.

Models

group models
ours Mnemos-DNA D01, D02, D06 (mnemos-dna), D07 (mnemos-dna-c)
baseline HyenaDNA tiny-1k / small-32k / medium-450k / large-1m, Caduceus-Ph/PS 131k
other_dna Nucleotide Transformer v2 50M/500M, DNABERT-2, GENA-LM, GENERator 1.2B, Evo2-1B (optional)
text Pythia-160M, Mamba-130M, RWKV-4-169M, GLA-340M, DeltaNet-1.3B

Adding a model is one line in recall_bench/models.yaml.

Metadata

Release files for recall-bench 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for recall-bench 0.2.0
File Size Uploaded Provenance Actions
recall_bench-0.2.0.tar.gz 719.0 kB Without provenance Details for recall_bench-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for recall-bench 0.2.0
File Interpreter ABI Platform Actions
recall_bench-0.2.0-py3-none-any.whl Python 3 none any Details for recall_bench-0.2.0-py3-none-any.whl

Total release size: 778.5 kB

Release files / recall_bench-0.2.0.tar.gz

Download URL recall_bench-0.2.0.tar.gz
Size 719.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bef0446aaac0c5eba18e53b48ce79432326f8df9bdb769de6bc1e5b6a6aa3703
BLAKE2b-256 checksum
How to use checksums
7ec8fd5b433dcb92e779f338e5f19219516b9618a2e25d183e0810d84e1def94
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / recall_bench-0.2.0-py3-none-any.whl

Download URL recall_bench-0.2.0-py3-none-any.whl
Size 59.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0dd0e1a72e72379376c832b3b523192665f9a8d001266186770bb4963e9201b
BLAKE2b-256 checksum
How to use checksums
88d567f9720dd3633b0b8829d6f904ab1632804fd3a19fef276fb293df032356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for recall-bench 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page