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]"
# latest from GitHub: 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; the Mnemos-DNA model code is bundled),
all. The core needs only torch, numpy, pyyaml.
Blackwell (sm_120, RTX 50-series) GPUs need the CUDA 12.8 torch wheels
(pip install torch --index-url https://download.pytorch.org/whl/cu128); 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.
License
MIT, see LICENSE.
Metadata
Release files for recall-bench 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| recall_bench-0.2.1.tar.gz | 720.2 kB | Without provenance | Details for recall_bench-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| recall_bench-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for recall_bench-0.2.1-py3-none-any.whl |
Total release size: 780.8 kB
Release files / recall_bench-0.2.1.tar.gz
| Download URL | recall_bench-0.2.1.tar.gz |
|---|---|
| Size | 720.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a535d7f1cd1f65920730bba12fdbe0d3ffab583abfd60cdf5147e5f62b2aa4a9
|
|
BLAKE2b-256 checksum How to use checksums |
a9c4a12e2ebd73b1580a531da411f6f563e7bf720c56b315d9999c07d502cedd
|
| 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.1-py3-none-any.whl
| Download URL | recall_bench-0.2.1-py3-none-any.whl |
|---|---|
| Size | 60.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52fc474a417f3a9e53982dcb9a6aff441329cc59d8b4798aa2fb87c4493ba79b
|
|
BLAKE2b-256 checksum How to use checksums |
d73ef7fc99d90bad660f54b829c856bede94b7ccc56852d52f9ecab82f25e4ff
|
| 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.1
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.