UniMoT: Unified Molecule-Text Language Model with Discrete Token Representation

Juzheng Zhang, Yatao Bian, Yongqiang Chen, Quanming Yao · Submission to ICLR 2025 · Rejected

TL;DR

UniMoT bridges the gap between molecules and language by treating molecules not as external embeddings or text strings, but as native discrete tokens in a unified vocabulary. By combining a Causal Q-Former with Vector Quantization and autoregressive pretraining, UniMoT unifies molecule-to-text comprehension and text-to-molecule generation within a single large language model (LLM).

What Problem Does This Paper Address?

Most modern molecular LLMs rely on adapter-based architectures (e.g., using a linear layer or a standard Q-Former) to map molecular graph representations into the LLM’s continuous embedding space. While effective for molecule-to-text tasks (like captioning or property prediction), they fall short in text-to-molecule generation. In generation tasks, these models typically force the LLM to output SMILES strings as plain text. This creates a fundamental asymmetry:

  1. Molecules and natural language are not treated equally.
  2. The molecular modality lacks direct supervision during generation.
  3. Directly discretizing raw molecular graphs into tokens leads to excessively long sequences (one token per atom) that lack natural left-to-right causal dependencies required by autoregressive LLMs.

Methods

UniMoT replaces external adapters with a tokenizer-based architecture, allowing the LLM to read and write molecules as discrete tokens alongside ordinary text:

  • Causal Q-Former: The authors adapt the BLIP-2 Q-Former by enforcing causal masks on learnable queries interacting with a frozen molecule encoder (MoleculeSTM). This compresses graph features into a short, fixed sequence of 16 causal query vectors compatible with standard autoregressive attention.
  • Vector Quantization (VQ) Tokenizer: The causal query vectors are mapped to nearest neighbors in a learnable codebook ($K = 2048$ codes) using a straight-through estimator. An MLP adapter projects these quantized tokens to match the latent space of a pretrained SMILES autoencoder (ChemFormer), allowing tokens to be decoded back into chemically valid molecules.
  • Unified Vocabulary & Modeling: The LLM vocabulary is expanded with 2,048 discrete molecule tokens plus boundary tags ([MOL], [/MOL]). Molecule generation and molecule understanding are unified under a standard next-token prediction language modeling objective.
  • Four-Stage Training Scheme:
  • Causal Q-Former Pretraining using Molecule-Text Contrastive (MTC), Matching (MTM), and Molecule-grounded Text Generation (MTG) objectives.
  • Tokenizer Pretraining optimizing codebook, commitment, and SMILES-reconstruction losses.
  • Unified Molecule-Text Pretraining using bidirectional autoregression (molecule-to-text and text-to-molecule) trained via LoRA.
  • Task-Specific Instruction Tuning on downstream comprehension and chemistry synthesis tasks.
Molecules ──► Molecule Encoder ──► Causal Q-Former ──► Vector Quantization (2048 Codes)
                                                                 │
                                                   ┌─────────────┴─────────────┐
                                                   ▼                           ▼
                                            Molecule Tokens             MLP Adapter
                                                   │                           │
                                         Added to LLM Vocab            ChemFormer Decoder
                                       (Read/Write via LoRA)                   │
                                                                               ▼
                                                                      Generated SMILES

Datasets

The authors evaluate UniMoT across established benchmark suites (no new datasets were introduced):

  • Comprehension & Classification: Eight MoleculeNet binary classification benchmarks (BBBP, Tox21, ToxCast, Sider, ClinTox, MUV, HIV, BACE) and QM9 for quantum-mechanical property regression.
  • Captioning & Retrieval: PubChem, ChEBI-20, PCdes, and MoMu.
  • Generation & Reaction Chemistry: Mol-Instructions and USPTO (covering caption-guided generation, reagent prediction, forward reaction prediction, and retrosynthesis).

Key Insights and Ideas

  • Causal Dependency is Essential: Standard Q-Former queries attend bidirectionally. Ablation experiments show that adding a causal attention mask significantly boosts LLM downstream comprehension (BLEU-4 increases from 21.3 to 25.2 on PubChem captioning), demonstrating that LLM decoders prefer inputs structured with directional causal dependency.
  • Discrete Tokens Trade Raw Feature Precision for Generative Utility: While continuous embeddings slightly outperform discrete tokens on comprehension alone (BLEU-4: 25.2 vs. 23.8), discretization enables native next-token generation of chemical structures without reverting to brittle, character-level SMILES generation.
  • True Multi-Modal Symmetry: Rather than having the LLM generate strings that an external chemistry parser must interpret, the LLM emits learned molecular latent tokens directly decoded by ChemFormer, ensuring 100% validity on generation benchmarks.

Key Results

  • Molecule Captioning: On PubChem, UniMoT (Llama-2-7B) achieves 23.8 BLEU-4 and 34.8 METEOR, outperforming specialized models like 3D-MoLM (22.5 BLEU-4, 33.1 METEOR) and MolCA (21.3 BLEU-4, 32.6 METEOR).
  • Molecule Generation: On Mol-Instructions caption-guided generation, UniMoT dramatically improves exact match and similarity metrics over prior molecular LLMs:
  • Exact Match: 0.237 (vs. 0.112 for MolT5 and 0.002 for Mol-Instructions).
  • BLEU: 0.698 (vs. 0.546 for MolT5).
  • Chemical Validity: 1.000 (100%).
  • Reaction Tasks (USPTO): Outperforms InstructMol across forward reaction prediction (Exact Match 0.611 vs. 0.536) and retrosynthesis (Exact Match 0.478 vs. 0.407).
  • Property Prediction: Achieves state-of-the-art ROC-AUC on MoleculeNet classification (e.g., 92.89% on ClinTox, 83.69% on BACE).

Limitations and Future Work

  • Complex Generative Tasks: The authors note that UniMoT has not yet been extended to fine-grained molecular editing (e.g., adding/modifying specific chemical motifs in an existing scaffold).
  • Data Scarcity: Molecular text-structure pairs remain scarce relative to vision-language corpora, limiting the scale of pretraining.
  • Real-World Validation: Current evaluations focus entirely on standardized in silico benchmarks; wet-lab experimental testing and broader real-world synthesis workflows remain open directions.

Summary updated

BibTeX
@misc{zhang2024unimot,
  author = {Juzheng Zhang and Yatao Bian and Yongqiang Chen and Quanming Yao},
  title = {{UniMoT: Unified Molecule-Text Language Model with Discrete Token Representation}},
  year = {2024},
  eprint = {2408.00863},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2408.00863},
}
Figure