Introduction
Bridging the gap between molecular structures and natural language is a cornerstone of modern computational chemistry and drug discovery. While Large Language Models (LLMs) have demonstrated remarkable capabilities in processing text, their ability to "understand" and "generate" complex molecular graphs remains a significant challenge. Most existing molecular LLMs rely on simple projection layers or adapters to translate molecular features into a format the LLM can interpret. While effective for understanding-based tasks (Molecule-to-Text), these models often struggle with generation (Text-to-Molecule), frequently relying on brittle SMILES strings that are prone to syntax errors and chemical invalidity.
UniMoT (Unified Molecule-Text) addresses these limitations by treating molecular structures and natural language as equal partners. By discretizing molecules into a sequence of tokens and expanding the LLM's vocabulary, UniMoT enables a unified framework for both chemical property prediction and de novo molecular generation.
Methodology
UniMoT introduces a novel architecture centered on a tokenizer-based approach that converts 2D molecular graphs into a causal sequence of discrete tokens. The framework consists of four primary components:
- Causal Q-Former: Unlike traditional encoders, the Causal Q-Former extracts high-level features using causal masking. This forces queries to interact in a sequence, ensuring that the resulting features possess a left-to-right dependency compatible with the autoregressive nature of LLMs.
- Vector Quantization (VQ): Continuous features from the Q-Former are mapped to the nearest neighbors in a learnable codebook containing 2,048 discrete molecule tokens. This effectively creates a "chemical alphabet" that represents structural motifs.
- Unified Vocabulary: These 2,048 tokens are integrated directly into the vocabulary of a Llama-2-7B model. This allows the model to predict the "next token" regardless of whether it represents a word or a structural component of a molecule.
- Four-Stage Training Pipeline:
- Stage 1 (Alignment): Aligning the Causal Q-Former with text via contrastive learning.
- Stage 2 (Reconstruction): Training the tokenizer to reconstruct molecules from tokens to ensure structural integrity.
- Stage 3 (Unified Pretraining): Training on both molecule-to-text and text-to-molecule tasks simultaneously.
- Stage 4 (Instruction Tuning): Fine-tuning using LoRA (Low-Rank Adaptation) for specific downstream applications.
Experimental Setup and Datasets
The researchers evaluated UniMoT across a comprehensive suite of benchmarks to test both comprehension and generation capabilities:
- MoleculeNet: Eight datasets (including BBBP and Tox21) for property classification.
- PubChem & ChEBI-20: Used for molecule captioning and cross-modal retrieval.
- Mol-Instructions: For complex tasks such as reagent prediction and caption-guided molecule design.
- USPTO: For chemical reaction and retrosynthesis prediction.
- QM9: For regression tasks involving quantum chemical properties (e.g., HOMO/LUMO energy levels).
Key Insights
Discretization as a Catalyst for Generation
By converting molecules into discrete tokens, UniMoT leverages the native autoregressive machinery of LLMs. This approach is significantly more robust than generating SMILES strings, as the model learns the underlying structural logic of the "chemical alphabet" rather than just character-level syntax.
The Importance of Causal Order
LLMs are optimized for sequential logic. By imposing a "left-to-right" structure on molecular features through the Causal Q-Former, UniMoT aligns molecular data with the LLM’s pre-existing processing strengths. This alignment is a primary driver of the model's superior performance in generative tasks.
Results and Discussion
UniMoT achieved state-of-the-art (SOTA) performance across multiple benchmarks:
- Molecule Comprehension: On MoleculeNet, UniMoT outperformed previous models like MoleculeSTM and InstructMol, notably achieving a 92.89% ROC-AUC in clinical toxicity prediction.
- Molecule Generation: In caption-guided generation, UniMoT achieved an Exact Match score of 0.237, more than doubling the performance of the previous best model, MolT5 (0.112).
- Chemical Validity: Despite the complexity of token-by-token generation, UniMoT maintained a 1.000 validity score, ensuring that every generated structure was chemically plausible.
Conclusion and Future Work
UniMoT demonstrates that treating molecules as a distinct linguistic system—rather than just images or feature vectors—allows LLMs to bridge the gap between chemistry and language. While the model shows exceptional promise, future work is required to address data scarcity in high-quality molecule-text pairs and to refine the model's ability to perform precise "molecule editing" for drug optimization. Additionally, scaling the tokenization strategy to handle larger biological entities like proteins remains an open area for research.
Summary updated