RESEARCH · COMPUTATIONAL PROTEOMICS

Reading amino acids out of a mass spectrum with diffusion

Every protein fragment carries its sequence in its weight, if you know how to read it. We trained a discrete diffusion model to read amino acids straight from a mass spectrum, filling them in the way you would solve a crossword, and reached 60.0% peptide accuracy on an E. coli benchmark. One idea that sounded like free accuracy cost nine points, and that is in here too.

MS/MS SPECTRUM → SEQUENCEREVERSE STEP 0 / 20
b-ion peaksy-ion peaksother peaks
Tokens start absorbed in [MASK] and are unmasked over T = 20 steps
Figure 1. Illustrative: an MS/MS spectrum conditions a discrete diffusion model that unmasks a peptide one residue at a time. The peaks and the sequence are examples, not data from the benchmark.
60.0%
peptide accuracy, E. coli EV at 5% FDR
33.1%
InstaNovo's published figure
+12.5 pp
from self-conditioning, the largest single gain
−9 pp
from post-hoc mass correction, a negative result

Reading a sentence by weighing it

In 1913, J.J. Thomson sent a beam of charged neon through electric and magnetic fields and found it split into two paths: neon came in two different masses. That experiment grew into the mass spectrometer, which today is an absurdly precise scale for molecules.

Proteins are long chains built from 20 amino acids, and a peptide is a short piece of one. Think of a peptide as a word written in a 20-letter alphabet where every letter has its own weight. A tandem mass spectrometer snaps the word into fragments and weighs each one. Fragments come in two families, b-ions growing from the front of the word and y-ions from the back. The weight difference between neighbouring fragments in a family is the weight of one letter, so in principle the spectrum spells the word out.

In practice the spectrum is noisy, peaks go missing, and some letters weigh almost the same. Reading it is the hard part.

Why not just look it up

The standard approach is a dictionary lookup: compare the spectrum against the predicted spectra of every protein in a database. That works when the protein is in the database. It fails exactly where discovery matters most: novel organisms and mixed microbial communities, like a sample of wastewater full of microbes nobody has catalogued.

De novo sequencing skips the dictionary and generates the amino-acid sequence from the spectrum alone. That was the problem we picked.

Why a crossword beats a typewriter

We started with the obvious design: read the spectrum, then write the sequence left to right, one letter at a time, with an LSTM or a GRU. They reached 2.7% and 6.7% peptide accuracy. Writing left to right is like a typewriter with no backspace: an early mistake poisons everything after it.

A crossword solver works differently. You fill in the letters you are surest of first, then use them to crack the harder ones. Diffusion models generate this way. Ours starts with every position masked and unmasks residues over 20 steps, guided by the spectrum at every step.

We chose the discrete kind of diffusion on purpose. The better-known Gaussian kind works on continuous numbers, so for amino acids it has to round its output back into letters at the end, and that rounding introduces its own errors. Absorbing diffusion treats the 20 amino acids as tokens from the start: forward diffusion absorbs tokens into a [MASK] state, and the reverse process unmasks them on a cosine schedule.

The model

A PeakEncoder maps the top 200 m/z peaks into a dense representation, with a learnable bias for pairs of b-ions and y-ions, since a matched pair brackets a residue from both ends. A Transformer denoiser then works over the amino-acid tokens.

Self-conditioning is the crossword-in-pencil trick. At each reverse step the model sees its own previous best guess as an extra input, so it can reread its draft before committing. Finally, beam search with K = 8 proposes candidates, and two spectrum-based scores, CFID and SGIR, pick the one whose predicted fragments best match the spectrum that was actually measured.

Where the accuracy came from

On the E. coli EV benchmark at 5% FDR, averaged over three seeds, the final model reached 76.00% amino-acid recall and 59.96% peptide accuracy. InstaNovo's published numbers on that benchmark are 72.90% and 33.10%.

The gains were not evenly spread, and the biggest one was a surprise in its plainness. Removing the PeakEncoder dropped amino-acid recall from 74.8% to 41.9%. Reading the evidence well mattered more than anything clever downstream. Self-conditioning was the largest single jump in peptide accuracy, at 12.5 points over the first version.

Peptide accuracy, E. coli EV benchmark at 5% FDR (%)

LSTM baseline
2.7
GRU baseline
6.7
Absorbing diffusion, no PeakEncoder
5.4
V1: PeakEncoder + B/Y + CFID
44.99
V2: CFID + SGIR
59.96
InstaNovo, published 33.1
Figure 2. Peptide accuracy across model versions. The large step comes from adding the PeakEncoder; self-conditioning and reranking carry V2 past InstaNovo's published figure.

The idea that made it worse

A peptide's total mass is known from the spectrum, so filtering candidates by mass consistency sounds like free accuracy. Think of a bouncer with a guest list accurate to a fraction of a gram. It was not free. A post-hoc 50 ppm filter cut peptide accuracy from 59.60% to 50.44%, about nine points. The model had never been trained with a mass-consistency constraint, so the bouncer turned away correct sequences along with wrong ones.

We kept that result and reported it in the repository as a negative finding. A negative result tells you where the next fix should go: the constraint belongs in training, as a mass-conditioned loss, not in a stricter filter bolted on afterwards.

V2 reranking ablation · peptide accuracy (%), 3-seed mean

CFID + SGIR
59.96
CFID
59.6
Argmax
57.84
SGIR only
57.61
Rerank-spectral
53.67
CFID + mass-correct
50.44
Figure 3. Reranking ablation for the final model, three-seed mean. Mass correction is the only option that clearly hurts. The axis starts at 40% to separate close values.

Back to the wastewater

The reason to sequence without a database was samples like wastewater, so we ran the model on one. Six peptides from a mixed-community sample survived 5% FDR filtering with no reference proteome, and protein-language-model scores suggest they look unlike the E. coli reference.

That is a hint, not a discovery. BLAST validation is still pending, so these are candidates until someone checks them.

← All writingDiscuss this →
RELATED WRITING
RESEARCHNovember 2026

When a Good Control Produces a Better Stop Condition

When a language model reads a neural network's raw weights and answers correctly, did it understand the network, or did it just do the arithmetic? I built a test to tell those apart, wrote down in advance what would make me quit, and then watched exactly that happen.

Read →
RESEARCHNovember 2026

Two qubits, one memory, and no quantum advantage

Marvel's VisionQuest got me asking whether several AI minds could share one quantum computer. You need no physics to follow this. With a spinning coin, a diary and Doctor Strange, I'll explain what I built, why the physics came out almost perfectly, and why the advantage I went looking for was never there.

Read →