Research notes · Efficient transformers

Can We Make Protein-Structure Prediction More Efficient with Linear Attention?

Attention costs grow with the square of sequence length, and proteins can be long. We built a Performer that reads evolutionary profiles and predicts distances and angles. This is what the idea offers, and what our experiment’s own figures show it did and did not learn.

TL;DR

Softmax attention builds an \(N \times N\) matrix for a sequence of \(N\) residues. The Performer replaces it with a random-feature approximation whose size grows linearly in \(N\). We combined a 6-layer Performer with PSSM evolutionary profiles to predict inter-residue distances and backbone dihedral angles on ProteinNet (CASP12).

The training loss decreased smoothly (2.87 → 2.20) without a widening validation gap. But the paper’s own distance maps show predicted distances within about ±0.1 Å of zero everywhere, set against reference maps that vary only with sequence separation. The reported 197 Å RMSE therefore measures the size of the targets, not a usable prediction.

So the honest summary: the efficiency argument for linear attention holds in theory, but this experiment does not demonstrate learned distance prediction, and nothing here amounts to 3-D structure prediction. The paper’s speed and memory figures come without a reported measurement setup, so this post presents only the theoretical argument.

About this post

This is a candid account of our own conference paper. Where the paper’s figures and its text point in different directions, I describe what the figures show. I think a negative result explained clearly is more useful to readers than a positive one that does not hold up.

Contents
  1. Why attention is expensive for proteins
  2. The Performer idea
  3. Evolutionary information: PSSMs
  4. The model and its two targets
  5. Does training converge?
  6. Does the model predict distances?
  7. What about the angles?
  8. Does linear attention remove the bottleneck?
  9. What a sound version needs
  10. What we learned
  11. Paper and credits

A protein is a chain of amino acids that folds into a three-dimensional shape, and its function depends on that shape. Predicting the shape from the sequence alone was a central problem in computational biology for decades. AlphaFold2 showed that it can be solved to near-experimental accuracy for many proteins [4], using multiple-sequence alignments, structural templates and a large attention-based network.

Those models are expensive. Part of the cost comes from attention itself: every residue attends to every other residue, so the cost grows with the square of the chain length. Long proteins and proteome-scale screening are where this hurts. Our ICTA 2025 paper [1] asked a modest version of the question: can a transformer with linear-cost attention learn useful geometric quantities from sequence and evolutionary features?

Why long sequences are expensive for attention

Standard attention [6] compares every query with every key:

$$\mathrm{Attention}(Q,K,V)=\mathrm{softmax}\!\left(\frac{QK^{\top}}{\sqrt{d_k}}\right)V,\qquad QK^{\top}\in\mathbb{R}^{N\times N}.$$

For a chain of \(N\) residues, each head in each layer materialises an \(N\times N\) score matrix. At \(N = 256\) that is about 65,000 entries. At \(N = 2{,}048\) it is over four million, per head, per layer, before backpropagation stores it again. Time grows the same way. The quadratic term, not the number of parameters, is what limits how long a sequence fits on a GPU.

Entries in one attention map (one head, one layer)

Theoretical size of one attention map: softmax attention versus FAVOR+ Two curves over sequence length N from 128 to 2048. Softmax attention stores N squared entries per head (16,384 at N=128; 4.19 million at N=2048). FAVOR+ with m=256 random features stores N times m (32,768 at N=128; 524,288 at N=2048). Theoretical counts, not measurements. 0M 1M 2M 3M 4M 256 512 1024 1536 2048 Sequence length N (residues) N = 128: softmax 16,384 entries N = 128: FAVOR+ (m = 256) 32,768 entries N = 256: softmax 65,536 entries N = 256: FAVOR+ (m = 256) 65,536 entries N = 512: softmax 262,144 entries N = 512: FAVOR+ (m = 256) 131,072 entries N = 768: softmax 589,824 entries N = 768: FAVOR+ (m = 256) 196,608 entries N = 1024: softmax 1,048,576 entries N = 1024: FAVOR+ (m = 256) 262,144 entries N = 1536: softmax 2,359,296 entries N = 1536: FAVOR+ (m = 256) 393,216 entries N = 2048: softmax 4,194,304 entries N = 2048: FAVOR+ (m = 256) 524,288 entries Softmax: N² FAVOR+: N·m Theoretical size of one attention map: softmax attention versus FAVOR+ Two curves over sequence length N from 128 to 2048. Softmax attention stores N squared entries per head (16,384 at N=128; 4.19 million at N=2048). FAVOR+ with m=256 random features stores N times m (32,768 at N=128; 524,288 at N=2048). Theoretical counts, not measurements. 0M 1M 2M 3M 4M 512 1024 2048 Sequence length N (residues) N = 128: softmax 16,384 entries N = 128: FAVOR+ (m = 256) 32,768 entries N = 256: softmax 65,536 entries N = 256: FAVOR+ (m = 256) 65,536 entries N = 512: softmax 262,144 entries N = 512: FAVOR+ (m = 256) 131,072 entries N = 768: softmax 589,824 entries N = 768: FAVOR+ (m = 256) 196,608 entries N = 1024: softmax 1,048,576 entries N = 1024: FAVOR+ (m = 256) 262,144 entries N = 1536: softmax 2,359,296 entries N = 1536: FAVOR+ (m = 256) 393,216 entries N = 2048: softmax 4,194,304 entries N = 2048: FAVOR+ (m = 256) 524,288 entries N² N·m
Figure 1. How the attention map grows with sequence length. Softmax attention stores \(N^2\) scores; the Performer’s FAVOR+ mechanism stores two \(N\times m\) feature matrices instead. With \(m = 256\), the two cost the same at \(N = 256\) and diverge quickly after that. Theoretical counts computed from the formulas, not measurements. \(m = 256\) is an illustrative choice; the paper does not report the number of random features it used.

The Performer idea: attention without the \(N \times N\) matrix

The Performer [2] rests on one observation. The softmax kernel \(\exp(q^{\top}k)\) can be written, in expectation, as an inner product of random feature maps: \(\exp(q^{\top}k)\approx\varphi(q)^{\top}\varphi(k)\) with \(\varphi:\mathbb{R}^{d}\to\mathbb{R}^{m}\). Once the kernel factorises, matrix multiplication can be re-associated:

$$\mathrm{Attention}(Q,K,V)\;\approx\;\frac{\varphi(Q)\,\big(\varphi(K)^{\top}V\big)}{\varphi(Q)\,\big(\varphi(K)^{\top}\mathbf{1}_N\big)}.$$

Computing \(\varphi(K)^{\top}V\) first gives an \(m\times d\) matrix that summarises all keys and values, and every query then reads from it. No \(N\times N\) object is ever formed, so time and memory scale as \(O(N\,m\,d)\) instead of \(O(N^2 d)\). The FAVOR+ construction uses positive, orthogonal random features, which keep the estimate unbiased and its variance low. The price is approximation error, controlled by \(m\).

Putting evolution into the input: PSSMs

A single sequence says little about which positions matter. Evolution says more. If a position is conserved across many related proteins, it is probably structurally or functionally important. A position-specific scoring matrix (PSSM) records this: for each position in the sequence, it gives 20 scores, one per amino acid, describing how often that residue appears there across an alignment of homologous sequences. PSSMs were the input that made neural secondary-structure prediction work in the late 1990s [5], and they remain a strong, cheap source of evolutionary signal compared with full alignments.

Our model represents each residue as its one-hot amino-acid identity concatenated with a standardized 20-dimensional PSSM row, projected into a 256-dimensional embedding.

The model and its two targets

Setup
  • Data: ProteinNet, CASP12 edition [3], with training, validation and test subsets
  • Model: 6 Performer layers, 8 heads, \(d_{\text{model}} = 256\), feed-forward 1024, dropout 0.1, sequences up to 512 residues
  • Optimiser: Adam (\(\beta_1 = 0.9,\ \beta_2 = 0.999\)), learning rate \(10^{-4}\) with 1,000-step warm-up and cosine annealing, weight decay \(10^{-4}\), mixed precision
  • Batching: batch size 16 with gradient accumulation
  • Not reported: number of random features \(m\), loss weight \(\lambda\), hardware
Schematic
  1. Protein sequenceN residues, up to 512
  2. Per-residue featuresone-hot amino acid ⊕ standardized 20-d PSSM
  3. Embeddingdmodel = 256
  4. 6 × Performer layer8 heads, FAVOR+ linear attention, feed-forward 1024
  5. Distance headN × N inter-residue distances · MSE loss
    Angle headbackbone dihedrals per residue · 1 − cos loss
Figure 2. The model. Per-residue features pass through six Performer layers; two heads predict an \(N\times N\) map of inter-residue distances and per-residue backbone dihedral angles. Drawn for this post from the description in Section 3 of the paper.

The two heads are trained jointly. Distances use a mean-squared error over all residue pairs, and angles use a cosine loss so that \(-179^\circ\) and \(+179^\circ\) count as close:

$$\begin{aligned}\mathcal{L}_{\text{dist}}&=\frac{1}{N^2}\sum_{i,j}\big(d^{\text{pred}}_{ij}-d^{\text{true}}_{ij}\big)^2,\\ \mathcal{L}_{\text{angle}}&=\frac{1}{N}\sum_{i}\Big(1-\cos\big(\theta^{\text{pred}}_i-\theta^{\text{true}}_i\big)\Big),\\ \mathcal{L}&=\mathcal{L}_{\text{dist}}+\lambda\,\mathcal{L}_{\text{angle}}.\end{aligned}$$

It is worth being precise about what these targets are. A matrix of predicted distances and a list of predicted angles are not a 3-D structure. Turning them into coordinates needs a separate reconstruction step, as in trRosetta [8], and the result must then be compared with the true structure using metrics such as TM-score or lDDT. Our paper does neither. At best, it can show that distances and angles were learned.

What the experiment shows

Question 1

Does training converge?

Line chart of training loss (blue) and validation loss (red) over epochs 1 to 15. Training loss falls from about 2.87 at epoch 1 to about 2.42 at epoch 2, then declines slowly to about 2.20 at epoch 15. Validation loss falls from about 2.69 to about 2.32 at epoch 2 and then fluctuates between about 2.18 and 2.32, ending near 2.27.
Figure 3. Training and validation loss. Training loss falls from 2.87 to 2.20; validation loss levels off around 2.2–2.3 after the second epoch. Figure 1 from Roufas et al. (2026), © The Author(s), under exclusive license to Springer Nature Switzerland AG; reproduced by the author with attribution.

What we observed. Both losses drop sharply in the first two epochs and then flatten. Validation loss fluctuates between about 2.18 and 2.32 without trending upward, so there is no sign of overfitting. The figure shows 15 epochs; the paper’s text describes 20.

How we read it. A smooth loss curve shows that optimisation was stable. It does not show that the model learned distances. The reported distance MSE is 38,820 Å², while the plotted total loss is around 2. So the plotted loss must have been computed on rescaled targets, or weighted in a way the paper does not describe. Either way, this curve cannot be read as distance accuracy improving.

Question 2

Does the model actually predict inter-residue distances?

This is the central question, and the most direct evidence is the distance maps. The paper shows two test proteins; here is the first.

Three heatmaps for protein_24, 64 residues. Left, True Distances: a smooth gradient that is zero on the diagonal and increases steadily away from it to about 235 angstroms in the corners, with no other structure. Centre, Predicted Distances: a faint striped pattern on a colour scale from about minus 0.06 to plus 0.07 angstroms. Right, Absolute Difference: visually identical to the left panel, rising to about 235 angstroms in the corners.
Figure 4. Reference (left), predicted (centre) and absolute-error (right) distance maps for one 64-residue test protein. Note the colour scales: the reference reaches about 235 Å, while the predictions span roughly −0.06 to +0.07 Å. Figure 2 from Roufas et al. (2026), © The Author(s), under exclusive license to Springer Nature Switzerland AG; reproduced by the author with attribution.

What we observed. Three things stand out once the colour bars are read alongside the images.

  • The predictions are essentially zero. The centre panel’s scale runs from about −0.06 to +0.07 Å; the second protein in the paper is similar (about 0 to 0.16 Å). Negative distances are physically impossible. As a result, the error map on the right is visually indistinguishable from the reference on the left.
  • The reference map varies only with sequence separation. We sampled the left panel on the residue grid. Along each diagonal (fixed \(|i-j|\)), the colour changes by less than 1/255, so the reference distance depends on \(|i-j|\) alone. It rises at about 3.7 Å per residue, close to the 3.8 Å spacing between consecutive Cα atoms. That is the profile of a fully extended, straight chain. A folded 64-residue domain spans a few tens of ångströms and shows off-diagonal contacts between residues far apart in sequence.
  • The headline error matches a zero prediction. The paper reports RMSE 197.03 Å and MAE 156.89 Å. For straight-chain targets \(d_{ij}=3.8\,|i-j|\) and a prediction of zero, a chain of 128 residues gives RMSE ≈ 199 Å and MAE ≈ 162 Å.

How we read it. In this experiment, the distance head did not learn inter-residue distances: its outputs sit near zero regardless of the target. The reference maps do not look like folded proteins either, which points to a problem in how distance targets were built from the data. We have not yet traced where in the pipeline it arises. ProteinNet stores coordinates in picometres, so units are one place to look, but a unit error alone would not remove the off-diagonal structure. The paper describes these maps as showing accurate local predictions and long-range consistency, and the maps do not support that description.

What this means for the paper’s claims

The distance results cannot be used as evidence that the Performer model predicts protein geometry. Nothing in the experiment bears on 3-D structure accuracy, and nothing supports a comparison with AlphaFold-class systems, which the paper also does not claim.

Question 3

What about the dihedral angles?

The paper reports an angle RMSE of 4.07° and an MAE of 3.28°. On their own, these numbers would be remarkable. Two things keep us from relying on them. First, given the problem with the distance targets, the angle targets also need checking before the numbers mean anything. Second, the paper does not say which dihedrals were predicted. The backbone \(\omega\) angle sits near 180° in almost every residue, so including it would make the average error look much smaller than for the informative \(\varphi\) and \(\psi\) angles. We report the numbers as published, but they should not yet be read as evidence of accurate angle prediction.

Question 4

Can linear attention reduce the computational bottleneck?

In principle, yes, and this is the part of the project I still find most promising. Figure 1 shows the size of the problem: at 2,048 residues, a softmax attention map is about eight times larger than a FAVOR+ factorisation with \(m = 256\). The gap grows linearly with length after that.

The paper also lists measured-sounding gains: 3–5× less memory for sequences above 256 residues, 2–4× faster training, and support for 1,024-residue sequences on a single GPU. It gives no baseline configuration, hardware or measurement procedure, and the model is configured for sequences up to 512 residues. We therefore treat these figures as unverified and keep to the theoretical argument. A real efficiency claim needs a softmax baseline of the same size on the same hardware, with peak memory and throughput reported as a function of sequence length.

What a sound version of the experiment would need

  • Look at the targets before training on them. Plot a few true distance maps and check that they show contacts. Convert ProteinNet coordinates from picometres to ångströms. Mask missing residues and padding.
  • Compare with trivial baselines. Predicting the average distance for each sequence separation \(|i-j|\) is a strong, cheap baseline. A model that does not beat it has not learned structure.
  • Use the standard formulation. Predict binned distance distributions (distograms) with cross-entropy, as AlphaFold 1 and trRosetta did [7][8], rather than raw distances with MSE. Evaluate long-range contact precision.
  • Specify the angles, report \(\varphi\) and \(\psi\) separately, and compare with a baseline that predicts each residue type’s most common angle.
  • Measure efficiency properly, against a matched softmax transformer, across sequence lengths.
  • Reconstruct coordinates before making any claim about structure, and score them with TM-score or lDDT.

What we learned

  1. The efficiency case for linear attention is sound in theory. FAVOR+ removes the \(N\times N\) matrix and makes long proteins tractable. Whether the approximation preserves enough accuracy for structural targets remains to be tested.
  2. A smooth loss curve is not evidence of learning. Inspecting predicted outputs against simple baselines is the check that matters, and in this experiment it shows that the distance head did not learn.
  3. Distances and angles are not structures. Claims about structure prediction need reconstructed coordinates and structural metrics.
  4. Negative results deserve a clear write-up. This one points directly at what to fix: the target pipeline, the baselines and the efficiency measurements.

Limitations and open questions

  • Where in the data pipeline do the straight-chain reference maps come from, and do the angle targets have the same problem?
  • With correct targets, can a Performer with PSSM inputs beat the per-separation baseline, and how does it compare with a softmax transformer of the same size?
  • How many random features does FAVOR+ need before the approximation stops limiting accuracy on structural targets?
  • Do the efficiency gains materialise in practice at the sequence lengths where they matter?

The paper

Efficient Protein Folding with Transformer Models Using the Performer Architecture

Nikolaos Roufas, Ioannis Karamitsos, Khalil Al-Hussaeni, Vassilis C. Gerogiannis, Andreas Kanavos

Advances in Information and Communication Technology (ICTA 2025), Lecture Notes in Networks and Systems, vol. 1833, pp. 191–198. Springer, Cham. Published online 1 April 2026.

Code and data

No public code repository accompanies the paper. ProteinNet is publicly available [3].

Credits

The paper is joint work with Ioannis Karamitsos (Rochester Institute of Technology, Dubai), Khalil Al-Hussaeni (Rochester Institute of Technology, Dubai), Vassilis C. Gerogiannis (University of Thessaly) and Andreas Kanavos (Ionian University, corresponding author). This post is my own account. The reading of the figures in Questions 2–4 and the efficiency discussion are mine.

Cite the paper

@inproceedings{roufas2026performer,
  title     = {Efficient Protein Folding with Transformer Models
               Using the Performer Architecture},
  author    = {Roufas, Nikolaos and Karamitsos, Ioannis and
               Al-Hussaeni, Khalil and Gerogiannis, Vassilis C. and
               Kanavos, Andreas},
  booktitle = {Advances in Information and Communication Technology
               (ICTA 2025)},
  series    = {Lecture Notes in Networks and Systems},
  volume    = {1833},
  pages     = {191--198},
  publisher = {Springer, Cham},
  year      = {2026},
  doi       = {10.1007/978-3-032-18162-6_20}
}

References

  1. N. Roufas, I. Karamitsos, K. Al-Hussaeni, V. C. Gerogiannis, A. Kanavos. Efficient Protein Folding with Transformer Models Using the Performer Architecture. ICTA 2025, LNNS 1833, Springer, 2026. doi:10.1007/978-3-032-18162-6_20
  2. K. Choromanski et al. Rethinking Attention with Performers. ICLR, 2021. arXiv
  3. M. AlQuraishi. ProteinNet: a standardized data set for machine learning of protein structure. BMC Bioinformatics 20:311, 2019. doi:10.1186/s12859-019-2932-0
  4. J. Jumper et al. Highly accurate protein structure prediction with AlphaFold. Nature 596, 2021. doi:10.1038/s41586-021-03819-2
  5. D. T. Jones. Protein secondary structure prediction based on position-specific scoring matrices. Journal of Molecular Biology 292(2), 1999. doi:10.1006/jmbi.1999.3091
  6. A. Vaswani et al. Attention Is All You Need. NeurIPS, 2017. arXiv
  7. A. W. Senior et al. Improved protein structure prediction using potentials from deep learning. Nature 577, 2020. doi:10.1038/s41586-019-1923-7
  8. J. Yang et al. Improved protein structure prediction using predicted interresidue orientations. PNAS 117(3), 2020. doi:10.1073/pnas.1914677117