- Introduced by
- Multiple contributors; notable milestones include Llinares-López et al. (DEDAL, 2023) and Jumper et al. (AlphaFold MSA module, 2021)
- Year
- 2010s–2020s (deep learning era, accelerating post-2017)
- Type
- Computational pipeline / supervised and self-supervised learning
- Family
- Bioinformatics / omics
What does it do?
Machine learning-assisted sequence alignment uses learned models, including deep neural networks and protein language models, to align nucleotide or amino acid sequences.
Rather than relying only on fixed substitution scores such as BLOSUM or PAM, these methods learn substitution and sequence-context patterns from training data. The DEDAL paper reports up to two- or threefold improvement in alignment correctness over existing methods on remote homologs, which is the main reason such tools are considered for difficult alignment cases.
The intuition behind the method
Classical tools score alignments with hand-designed substitution matrices and fixed gap penalties. An ML-assisted approach instead learns from many sequences which positions tolerate substitution and which are conserved. A protein language model, for example, assigns each residue a vector embedding that carries information about its sequence context. Alignment then searches for a good path through a matrix of embedding similarities rather than comparing single characters. This matters most when two proteins share little sequence identity (below about 30% in the twilight zone) but may still be structurally similar.
History
Sequence alignment has been a core computational biology problem since Needleman and Wunsch (1970) and Smith and Waterman (1981). Substitution matrices, PAM (Dayhoff 1978) and BLOSUM (Henikoff 1992), added statistical grounding to scoring. Protein language models trained on large sequence databases later made embedding-based alignment possible. The DEDAL model by Llinares-López et al. (published online in 2022 and in Nature Methods 20(1), 2023) applied differentiable alignment to learned protein embeddings and evaluated it on remote homologs. AlphaFold (Jumper et al. 2021) uses multi-sequence alignments as part of its structure prediction network, which makes alignment quality relevant to structural modelling.
When to use it
Choose ML-assisted alignment when sequences are distantly related, for example below about 30% pairwise identity, and classical tools such as ClustalW or MUSCLE give alignments you cannot rely on. It is also suited to structural homologs that have diverged beyond what BLOSUM-based profiles can detect, and to downstream analyses (structure prediction, variant effect prediction, phylogenetics) that depend on accurate alignments across many sequences. Do not use it for routine searches among closely related sequences, where BLAST or DIAMOND are much faster and usually sufficient. Be cautious when the target organism is poorly represented in the language model's training data, such as highly divergent non-model organisms with no close relatives in UniRef.
Limitations and considerations
- Computationally expensive relative to classical dynamic programming; large models (ESM-2 with 650M–3B parameters) require GPU memory and significant inference time.
- Performance degrades for sequences from organisms underrepresented in pre-training corpora (e.g., deep-sea archaea, novel viral families).
- Model behaviour is less interpretable than a BLOSUM matrix; diagnosing why two sequences are aligned in a specific way is non-trivial.
- Benchmark evaluations are dominated by well-characterised protein families; generalisation to RNA, non-coding DNA, or synthetic sequences is less established.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- In the DEDAL paper, alignment correctness on remote homologs improved over existing methods on the benchmarks evaluated, and remote homologs were better discriminated from unrelated sequences. Results for other ML aligners should be checked individually.
- Uses patterns learned from large sequence collections, so explicit structural annotation is not required as input at alignment time.
- The differentiable formulation allows the alignment component to be trained on examples of correct alignments, which supports task-specific fine-tuning.
- Better alignments can improve inputs to structure prediction: the cited AlphaFold paper describes leveraging multi-sequence alignments in its model, so the quality of homolog alignments matters for downstream structural models.
Applications
- Finding structural homologs among sequences that share little identity with proteins of known function, to support functional annotation.
- Building multiple sequence alignments as input to structure prediction tools such as AlphaFold2 and RoseTTAFold, particularly for proteins with few detectable homologs.
- Variant effect prediction, where residues must be matched to homologous positions in a reference sequence.
- Phylogenetic reconstruction of ancient gene families, where classical aligners may place gaps ambiguously.
- Annotation of environmental or metagenomic sequences that are highly divergent from characterised reference sequences.
How it works
How it works
Input sequences are tokenised into residue or nucleotide tokens and optionally preprocessed to remove low-complexity regions or known artefacts. Some pipelines also build a multiple sequence alignment of homologs at this stage to provide evolutionary context as additional model input.
Each token is transformed into a dense continuous vector by a pre-trained protein language model or a task-specific encoder. These embeddings capture local residue properties and sequence context learned from large collections of raw protein sequences, encoding evolutionary constraints without explicit phylogenetic annotation.
Given embeddings for two or more sequences, the alignment step is formulated as a differentiable alignment layer, which allows the model to be trained end-to-end on examples of correct alignments. DEDAL uses a differentiable alignment layer trained on examples of correct alignments; the exact dynamic-programming formulation and gap parameterisation should be checked in the original paper.
The alignment score is computed from the embedding similarities along the aligned path. It is not on the same scale as BLAST scores, and a BLAST E-value should not be assumed to be equivalent. Calibration is the user's responsibility: assemble a labelled set of known homologous and non-homologous pairs representative of your data, choose a score threshold by an explicit criterion (for example a target false-positive rate), and report false-positive and false-negative rates on that set before using the score to rank candidate homologs or filter hits.
Evaluate the resulting alignment against reference alignments derived from structure, using commonly used benchmark datasets (for example HomFam, PREFAB or SISYPHUS) and standard alignment-accuracy metrics such as sum-of-pairs and column scores; consult the original benchmark papers for exact definitions. For structural applications, aligned residue pairs can be cross-checked against known three-dimensional structures to confirm biological plausibility. Ensure the validation set shares no close homologs with the model's training data.
Common pitfalls
- Assuming the language model's training distribution covers your target organism; check whether close homologs are present in the training database before trusting embedding quality.
- Using ML alignment for routine closely related sequence tasks where speed is critical; use BLAST or DIAMOND first and reserve ML tools for difficult cases.
- Neglecting benchmark validation: do not deploy an ML aligner in a production pipeline without confirming its accuracy on a held-out set representative of your data, as performance varies across protein families.
- Validating on data that overlaps with the model's training data: check that the validation set shares no close homologs with the training data (for example by clustering at a stated identity threshold) before reporting accuracy.
- Conflating alignment score with E-value: ML alignment scores are not directly comparable to BLAST E-values; recalibrate score thresholds on a labelled reference set.
- Treating the aligned output as ground truth without structural cross-validation when the downstream application is structure-based drug design or variant interpretation.
Frequently asked questions
Is ML-assisted alignment better than BLAST for all tasks?
No. BLAST and DIAMOND remain faster and sufficient for routine homology search among closely related sequences (more than 50% identity). ML alignment is most valuable in the twilight zone (less than 30% identity) or when alignment quality for a downstream task (structure prediction, variant calling) is the primary concern. Use BLAST first; escalate to ML tools for difficult cases.
Do I need a GPU to run these tools?
For large protein language models (ESM-2 650M+) a GPU is usually needed in practice for whole-proteome analyses. Smaller models (ESM-2 8M, 35M) can run on CPU for small datasets. Cloud GPU services can be used if local hardware is unavailable.
How do I evaluate whether the ML alignment is correct?
Compare against structurally derived reference alignments using sum-of-pairs (SP) and column score (CS) on benchmarks such as HomFam or PREFAB. For your own data, if a crystal structure or AlphaFold model is available, inspect whether aligned residues are geometrically proximal in 3D space — structural proximity of aligned pairs is the most direct validation.
Can ML alignment handle RNA or DNA sequences, or is it protein-only?
The high-profile ML aligners named on this page (DEDAL and ESM-based approaches) are protein-focused. Deep learning nucleotide language models can provide embeddings for DNA or RNA, but end-to-end differentiable nucleotide alignment tools are less mature than their protein counterparts. For nucleotide sequences, classical tools such as ClustalW or MUSCLE, or profile-HMM methods, remain common, unless you are working with a non-coding RNA family that has a dedicated model.
Does AlphaFold2 do sequence alignment internally?
Yes. AlphaFold2 builds a multiple sequence alignment of the query against homologs and uses it in its structure prediction network, as described in the cited paper. The depth and quality of this alignment affect predicted structure accuracy. ML-assisted alignment tools are sometimes used to improve or supplement this step, particularly for proteins with few detectable homologs.
Related methods
Sources
Llinares-López, F., Berthet, Q., Blondel, M., Teboul, O., & Vert, J.-P. (2023). Deep embedding and alignment of protein sequences. Nature Methods, 20(1), 104–111.
Open DOI referenceJumper, J., Evans, R., Pritzel, A., et al. (2021). Highly accurate protein structure prediction with AlphaFold. Nature, 596(7873), 583–589.
Open DOI reference