Deciding Early from Raw Nanopore Current with a Purely Recurrent State Space Model

A nanopore sequencer pulls single molecules through a tiny pore and records the electrical current as each one passes. Because every channel reads one molecule at a time, the instrument can be told to eject a molecule partway through. In a clinical sample where almost every molecule comes from the patient, ejecting human molecules early frees channels for the rare pathogen molecules that matter, so a diagnosis arrives sooner. Today that decision normally waits on two separate steps: translating the current into letters (basecalling), then matching those letters against reference genomes. This proposal asks whether a single small sequence model can read the raw current as it streams in, update a fixed-size memory with each new sample, and decide "keep or eject" as soon as it is confident. That would remove the basecalling step from the decision loop.

The model family that makes this plausible is the linear state space model. It is a sequence model that carries a fixed-size hidden state forward through a linear recurrence. It can be trained in parallel like a convolution and then run one sample at a time at constant cost and memory. The two-sentence version of the idea is this. Train a strictly recurrent state space model, with no attention layers, to emit a calibrated host-versus-target probability after every chunk of raw current. Then measure, in a replayed sequencing run, whether its earlier and cheaper decisions bring forward the time at which enough pathogen reads accumulate, compared with basecall-then-map ejection.

Core Claim

We claim three things, and the experiments can refute each one.

First, a purely recurrent selective state space model trained with an "anytime" objective reaches a given host-versus-target accuracy using fewer signal samples per read than a basecall-then-map pipeline needs. An anytime objective is one that rewards a correct answer at every prefix length, not only at the end of the read.

Second, removing attention costs little discriminative accuracy on this task. That would contrast with the large semantic deficit linear models show on generative genomics.

Third, the earlier decisions translate into a measurable reduction in simulated time-to-diagnosis at low pathogen fractions, on hardware a point-of-care sequencer is actually attached to.

The second claim matters because it speaks to an open tension in the literature. The metagenomic scaling study Scaling Laws and Architectural Frontiers in Metagenomic Foundation Models found that linear models recover about 70% of Pfam domain architectures against 94% for a 7B Transformer. It attributed the gap to compressing context into a fixed state. That study evaluated generation, however, not triage. Our task needs no long-range retrieval, only enough evidence in the first few hundred bases' worth of current to tell host from non-host. We expect the fixed state to suffice here. If it does not, that is a useful negative result that extends EDEN's warning to discriminative clinical use.

Positioning Against Prior Work

The work that supplies the method is the state space model line. Diagonal State Spaces are as Effective as Structured State Spaces showed that a purely diagonal state matrix suffices. It also flagged sensitivity to the step-size parameter, which governs how fast the state forgets. Mamba: Linear-Time Sequence Modeling with Selective State Spaces made the recurrence input-dependent. Its authors also observed that smooth, uniformly sampled signals often favour the fixed, time-invariant variant. Raw nanopore current is exactly such a signal, so the choice between the two variants is a real design question, and we test it rather than assume it.

The closest prior work is Melchior: A Hybrid Mamba-Transformer RNA Basecaller. It interleaves Mamba blocks with self-attention to basecall direct-RNA current, and it reports the highest identity on human reads. Melchior differs from this proposal in three ways. It produces letters, not decisions. It runs post hoc on fixed 4,096-sample chunks. Its attention layers break constant-cost per-sample inference. We reuse its data and its convolutional front end, but we change the output, the training objective, and the streaming constraint.

The clinical motivation comes from A cloud-compatible bioinformatics pipeline for ultrarapid pathogen identification from next-generation sequencing of clinical samples. That pipeline (SURPI) uses fast hash-based alignment to subtract human reads and identify pathogens, reaching a diagnosis 13 minutes after analysis began. It still operates only on finished reads from completed batches.

The file also records a general field-level concern that downstream bioinformatics struggles to keep pace with sequencer output. The research file gives no specific citation for that concern, so we do not attribute it to a paper.

One paper constrains the scope. Caduceus: Bi-Directional Equivariant Long-Range DNA Sequence Modeling gets large gains from bidirectionality and reverse-complement symmetry. Neither property transfers here. A streaming decision must be strictly causal, and the raw current of a strand is not a symmetric transform of its complement's current. We therefore deliberately do not borrow those inductive biases.

Research Program

The model has a small strided convolutional stem that turns raw current into frames. A stack of diagonal state space layers sits on top of the stem and is run strictly causally. We compare three versions of these layers: time-invariant, selective, and a mix of the two. After every frame, a linear head outputs $p_t$, the probability that the molecule is from the target set rather than host.

Training uses an anytime loss averaged over prefix positions. Let $y$ be the read's true class and $w_t$ a weight that increases mildly with $t$, so that early mistakes are tolerated but not ignored. The loss is

$$\mathcal{L} = \frac{1}{T}\sum_{t=1}^{T} w_t \, \mathrm{BCE}(p_t, y),$$

where $T$ is the number of frames in the training crop. At inference, a read is ejected at the first frame where $p_t < \tau_{\text{eject}}$ and accepted at the first frame where $p_t > \tau_{\text{keep}}$. If neither threshold is crossed within a budget of frames, the read defaults to "keep". The thresholds are set on validation data to fix the false-ejection rate of target reads, since losing pathogen reads is the clinically expensive error. Probabilities are calibrated by temperature scaling at each prefix length.

To turn per-read behaviour into clinical latency, we build a playback simulator. Held-out raw reads are drawn from a mixture with a chosen target fraction and assigned to a fixed number of channels. Each read is "sequenced" at its native sample rate. When a read is ejected, the channel pays a fixed reload penalty and then draws a new molecule. The primary outcome is the simulated wall-clock time until $k$ target reads have been fully sequenced. Ratios of this time across policies are insensitive to the absolute sample rate. We also report compute per decision on a laptop CPU and on a single consumer GPU, because a policy that cannot keep pace with all channels in real time is disqualified regardless of accuracy.

The data come from the multi-species direct-RNA benchmark collated for Melchior: 116,072 training and 100,000 test reads on R9.4/R9.4.1 flow cells. Human reads serve as host and E. coli reads as the target. Arabidopsis and C. elegans reads are held out as unseen non-host classes, which tests whether "not human" generalizes beyond the training target. This is direct RNA, not clinical metagenomic DNA, and we say so plainly. It is the only raw-signal resource in our file. A positive result here justifies, but does not substitute for, validation on clinical DNA runs.

Baselines

The naive reference point is no adaptive sampling: every molecule is read to completion. It fixes the denominator for all speed-ups and costs nothing in false ejections.

The strongest existing approach is basecall-then-map ejection. The current prefix is basecalled at increasing lengths, and the letters are matched against human and target references with a fast hash-based aligner in the spirit of SURPI's SNAP stage. That stage is reported as 23–87× faster than BWA and Bowtie2, with >99% sensitivity and specificity on full reads in A cloud-compatible bioinformatics pipeline for ultrarapid pathogen identification from next-generation sequencing of clinical samples. It is the strongest competitor because reference matching is extremely accurate whenever references exist. For basecalling we use Melchior retrained on our split, which carries the strongest reported accuracy on this benchmark: 94.40% identity on human and a mean of 99,253 of 100,000 test reads aligned, per Melchior: A Hybrid Mamba-Transformer RNA Basecaller. Because Melchior was built for 4,096-sample chunks, we also give it its best chance at shorter prefixes by fine-tuning it on truncated chunks. We found no reported result on Lacuna for prefix-based host/target classification or adaptive-sampling enrichment on this benchmark, so all comparisons are run fresh.

The comparison is made fair in four ways. All methods see identical reads and splits. Thresholds are chosen to the same false-ejection rate of target reads. Each learned model gets the same hyperparameter search budget and a parameter count within a factor of two of the others. Compute is measured on the same machines.

We count the proposal as beating basecall-then-map if both of the following hold at a matched 1% false-ejection rate. First, its median decision point uses meaningfully fewer signal samples, which we set in advance at 25% fewer. Second, it reduces simulated time-to-$k$-target-reads at a 0.1% target fraction while sustaining real-time throughput on the laptop CPU. Matching accuracy at lower compute alone would be a weaker but still useful outcome.

Two learned baselines isolate the key ingredients. The first is an attention-based classifier on raw-current chunks, run at several fixed prefix lengths, which tests whether the recurrence matters at all. The second is the same state space architecture with Melchior-style attention blocks inserted, which measures what the pure-recurrence constraint costs. Two further ablations remove one ingredient each. One trains with only an end-of-read loss, which tests whether the anytime objective, rather than the architecture, produces early confidence. The other swaps selective layers for time-invariant ones, which tests Mamba's own conjecture about smooth signals.

Why not just…?

Why not just basecall the prefix and map it, as existing pipelines already do? This is the real threat. On reads from well-characterized species, mapping may be as accurate as any learned classifier. The question is therefore not accuracy on full reads but how much signal each method needs before it can commit, and whether it keeps pace with all channels. A basecaller must output enough letters for a unique alignment, so its earliest decision is bounded below by alignment length. A signal-level classifier is not bounded that way. If the playback experiment shows basecall-then-map deciding as early and as cheaply, the proposal has failed, and we will report that rather than retreat to secondary metrics.

Why not just train a small convolutional or attention classifier on a fixed-length prefix? That approach is simpler and avoids recurrent training. It does commit to one decision point for every read, though. An easy read must wait as long as a hard one, and a hard read is forced to decide too early. The recurrent model makes a decision whenever it becomes confident, at constant cost per sample. The fixed-prefix baselines at several lengths trace a latency-accuracy curve. The proposal only adds value if its anytime operating points lie strictly above that curve. If they do not, the simpler classifier should be preferred.

Why not just use a Transformer, given that EDEN found Transformers far better at biological reasoning? Scaling Laws and Architectural Frontiers in Metagenomic Foundation Models measured generative coherence over kilobases. Host-versus-target triage on short prefixes is a different and probably easier problem. A streaming Transformer's key-value cache also grows with every sample on every channel. The attention-classifier baseline and the hybrid ablation answer this directly. If attention buys a large accuracy gain on short prefixes, EDEN's caution applies here too, and the right design would be a hybrid with bounded local attention.

Why not just sequence longer or deeper and skip adaptive sampling? At high pathogen fractions this may be good enough, and the no-adaptive-sampling baseline will show where adaptive sampling stops paying off. The clinical case for ejection rests on very low target fractions, where most channel time is spent on host molecules. That is why the primary outcome is reported across a sweep of target fractions rather than at one convenient value.

Proposed Experiments and Decisive Checks

The main experiment is the playback simulation across target fractions from 10% down to 0.1%. It reports time-to-$k$ target reads, target-read loss, and per-decision compute for every policy above.

Two confounds could produce a false positive, and each has a decisive check. The first is batch leakage. Species in this benchmark were sequenced on different runs, so a classifier could learn run-specific current artifacts rather than sequence content. We test this by checking whether the classifier's errors concentrate on reads whose basecalled sequence is genuinely ambiguous, such as highly conserved RNAs. We also test it by checking whether performance survives normalizing signals per run and training on one flow-cell version while testing on the other. If accuracy collapses under these controls, the result is an artifact and we will say so.

The second confound is the 3′-first poly-A start of direct-RNA reads, which could leak species identity through tail length rather than sequence. We test this by masking the leading tail region and re-measuring decision latency.

Finally, the held-out Arabidopsis and C. elegans reads test whether the model learned "human versus not human" or merely "human versus E. coli". The answer determines whether the approach could plausibly extend to unknown pathogens, which is the case where SURPI's fast mode yields to a comprehensive mode that takes up to 16 hours.