FoldToken: Learning Protein Language via Vector Quantization and Beyond

Zhangyang Gao, Cheng Tan, Jue Wang, Yufei Huang, Lirong Wu, Stan Z. Li

Introduction

Protein modeling faces a fundamental "modality gap." While protein sequences are discrete strings of amino acids, their 3D structures are continuous coordinates that typically require complex Graph Neural Networks (GNNs) or SE(3)-equivariant models. Previous attempts to bridge this gap by discretizing structures into "folding angles" often suffered from significant information loss. FoldToken addresses this by translating both sequence and structure into a unified, discrete "protein language" that is both easy for Transformers to learn and precise enough for high-fidelity reconstruction.

Methods

The FoldToken framework operates in two distinct stages: representation learning and generative modeling.

The FoldToken framework consists of two stages: FoldTokenizer for discrete representation learning and FoldGPT for generative modeling.

1. FoldTokenizer

This encoder-decoder architecture learns the protein "vocabulary." The encoder fuses sequence data with structural information (represented as invariant folding angles and bond lengths) into a continuous latent space.

The core innovation is Soft Conditional Vector Quantization (SoftCVQ). Unlike standard "hard" vector quantization, SoftCVQ uses soft global querying with differentiable attention across the entire codebook during training. To facilitate stable generation, it decomposes a large token space (e.g., $2^{16}$ possible tokens) into 16 binary classifications. This "binary VQ-ID" approach prevents the training instabilities often seen when models attempt to predict one out of tens of thousands of classes directly.

2. FoldGPT

Once the protein is converted into a sequence of "FoldTokens," it is treated exactly like text. FoldGPT uses a generative Transformer architecture to perform backbone inpainting. The model "fills in the blanks" for missing protein segments by predicting the FoldTokens autoregressively, simultaneously generating sequence and structure.

Experiments and Results

The FoldTokenizer was pre-trained on the cAF2DB dataset (~1.3 million proteins), while FoldGPT was trained and evaluated on the CATH4.3 dataset.

Superior Reconstruction

On the CATH4.3 test set, SoftCVQ achieved a TMScore of 0.7470 and a reconstruction success rate of 94.98%. For comparison, vanilla VQ and Lookup-Free Quantization (LFQ) methods struggled to exceed a 30% success rate on the same task.

State-of-the-Art Inpainting

In the task of sequence-structure co-generation (inpainting), FoldGPT demonstrated significant improvements over existing baselines:

  • Sequence Design: Achieved a recovery rate of 96.2%, outperforming ESM2 (95.3%) and EvoDiff (93.0%).
  • Structure Design: Achieved a TMScore of 0.80, significantly higher than other angle-based generative models like FoldingDiff (0.67) and DiffSDS (0.74).
Protein inpainting: FoldGPT fills in missing segments to generate complete, physically plausible protein structures.

Key Insights

  • Unified Paradigm: By treating a residue's type and its 3D orientation as a single "protein word," FoldToken unifies sequence and structure modeling.
  • Massive Compression: FoldTokens are highly efficient; the entire CATH4.3 dataset (2.7GB of PDB files) can be compressed into just 18MB of discrete token sequences.
  • Generative Robustness: The binary VQ-ID approach ensures that even if the model does not predict every bit perfectly, the resulting structure remains physically plausible.

Limitations and Future Work

The current model utilizes angle-based representations, which can lead to error accumulation and "drift" over very long protein chains. Future iterations of FoldToken aim to incorporate coordinate-based methods to mitigate this. Additionally, the current framework focuses on single-chain backbones, leaving multi-chain complexes and side-chain atoms for future research.

Summary updated

BibTeX
@inproceedings{gao2025foldtoken,
  author = {Zhangyang Gao and Cheng Tan and Jue Wang and Yufei Huang and Lirong Wu and Stan Z. Li},
  title = {{FoldToken: Learning Protein Language via Vector Quantization and Beyond}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i1.31998},
}
Figure