Most machine learning models for predicting protein fitness or genetic variation operate under a fundamental constraint: they assume sequences can be mapped to a rigid, fixed-length coordinate system (Shin et al., Dias et al.). In this paradigm, mutations are treated almost exclusively as single-site amino acid or nucleotide substitutions (Hong et al., Pugh et al.).
A fixed grid makes the mathematics straightforward. If every sequence is forced into a matrix of width $L$, standard neural network layers or masked language modeling heads can easily score the probability of a mutation at any specific position.
However, natural evolution does not respect a fixed grid. Insertions and deletions (indels) are primary drivers of genetic variation, structural topology, and evolutionary distance (Thankachan et al., Yu). When a sequence gains or loses residues, the entire alignment shifts (Sun et al.). Traditional models view these length changes as outliers that break the alignment columns, rendering them blind to a vast space of functional variation (Shin et al., Perreault et al.).
To capture the full spectrum of biology, recent architectures are shifting from fixed-length grids to variable-length sequence modeling.
Why Indels Break Standard Architectures
To understand why standard models fail, consider how a masked language model (like ESM) or an alignment-based model scores a sequence. These models rely on absolute or relative position encodings tied to a reference template.
If an amino acid is deleted, every subsequent residue shifts left by one position. To a position-encoded transformer or a fixed-grid convolutional network, the entire downstream sequence now looks completely different, even if the underlying 3D structure and local biochemical context remain virtually unchanged.
As noted by Dias et al. and Notin et al., this lack of architectural flexibility prevents standard models from exploring synthetic or natural variants that alter sequence length. Similarly, context-dependent mutation models often rely on fixed-length assumptions, which precludes handling real-world genomic alignments where gaps are prevalent (Ralph). In protein engineering, ignoring indels means pipelines cannot accurately generate soluble or functional variants that require structural loops or length variations (Mahmudi et al., Kohout et al.).
Shifting from Grids to Continuous Strings
The core insight behind overcoming this gap is to treat biological sequences not as fixed-width vectors, but as continuous strings or a natural language (Shin et al.).
By moving to an autoregressive decoding objective, models can process and score sequences of varying lengths token-by-token (Truong Jr et al.). Instead of asking "what is the probability of amino acid $X$ at index 50?", an autoregressive model asks "given the sequence generated so far, what is the probability of the next amino acid?"
$$\ P(X) = \prod_{t=1}^{T} P(x_t \mid x_{<t}) $$
This formulation naturally accommodates insertions and deletions. If a segment is deleted, the subsequent tokens simply become the next conditional steps in the generation sequence. The model evaluates the likelihood of the remaining sequence based on relative historical context rather than an arbitrary absolute coordinate system.
Preserving Context via Re-alignment and Retrieval
While autoregressive models handle variable lengths gracefully, they still need to understand the broader evolutionary context of a protein family. Researchers have developed two primary strategies to inject this context without re-introducing rigid length constraints.
1. Adaptive Re-alignment
Rather than forcing all variants into a single static grid from the start, some frameworks perform dynamic re-alignment. For example, Van Niekerk et al. demonstrate that by dynamically re-aligning mutated sequences to a family-specific Multiple Sequence Alignment (MSA), a model can maintain its autoregressive structure while accurately scoring complex structural changes that disrupt standard substitution-only models.
2. Retrieval-Augmented "Sequences-of-Sequences"
Another approach bypasses alignment entirely by using retrieval mechanisms. Models like PoET treat protein families as unaligned "sequences-of-sequences" (Truong Jr et al.). By conditioning the generative model directly on a set of unaligned homologous relatives at inference time, the attention mechanism dynamically learns the length variations and indel tolerances characteristic of that specific protein family.
Generative Contraction and Diffusion
Beyond autoregression, novel generative paradigms are emerging to explicitly model length changes. Discrete diffusion models offer a powerful alternative to standard substitution frameworks.
Instead of just predicting point mutations, models like SCISOR use discrete diffusion to learn the evolutionary logic of protein length by explicitly training to reverse random insertions (Baron et al.). This allows the model to understand how removing entire segments affects protein fitness and conservation, paving the way for advanced tasks like protein minimization ("shrinking") while maintaining structural integrity.
Key Foundational Work
A greedy alignment-free distance estimator for phylogenetic inference (2017) — contributed 1 concept elements to this direction.
Gene-pseudogene evolution: a probabilistic approach (2015) — contributed 1 concept elements to this direction.