MolReFlect: Toward In-Context Fine-Grained Alignments Between Molecules and Texts

Jiatong Li, Yunqing Liu, Wei Liu, Jingdi Lei, Di Zhang, Wenqi Fan, Dongzhan Zhou, Yuqiang Li, Qing Li

TL;DR

MolReFlect is a new teacher-student framework that bridges the gap between molecular structures and natural language by automatically extracting "fine-grained alignments"—precise mappings between chemical sub-structures and descriptive text. By training a student model to reason through these alignments using a novel Chain-of-Thought tuning paradigm, the researchers achieved state-of-the-art performance in molecule-to-text translation and improved model explainability without needing expensive expert annotations.

What Problem Does This Paper Address?

While Large Language Models (LLMs) have shown promise in chemistry, they typically treat molecules (often represented as SMILES strings) as monolithic blocks of text. This "black box" approach lacks explainability and often misses the specific relationships between a molecule's functional groups and its described properties.

For example, a caption might mention an "anhydride group," which corresponds to a specific RC(=O)OC(=O)R pattern in the molecular string. If a model doesn't explicitly understand this connection, its predictions are less reliable. The gold standard for solving this is fine-grained alignment, but manually labeling these correspondences requires domain experts and is prohibitively expensive and time-consuming.

An illustration of fine-grained alignments between sub-structures and caption phrases.

Methods

The authors propose MolReFlect, a three-stage teacher-student framework:

  1. Zero-shot Alignment Extraction: A powerful "teacher" LLM (Llama-3-70B) uses chain-of-thought prompting to extract sub-structures from SMILES strings and map them to relevant phrases in the molecule's caption.
  2. In-Context Selective Reflection: To filter out potential hallucinations from the teacher, the model performs "reflection." It retrieves similar examples to help the teacher refine its alignments. A smaller "student" model (Mistral-7B) then evaluates these alignments using perplexity—a measure of how well the sequence fits the model's internal probability distribution. The alignment with the lower perplexity (indicating higher quality and less noise) is selected.
  3. Chain-of-Thought In-Context Molecule Tuning (CoT-ICMT): This is a new fine-tuning paradigm. Instead of the standard Input -> Target mapping, the student model is trained on a reasoning chain: Input -> Fine-grained Alignment -> Target. This forces the model to learn the underlying chemical logic rather than just memorizing strings.
The overall three-stage framework of MolReFlect.

Datasets

The researchers evaluated MolReFlect on several key benchmarks:

  • ChEBI-20: The primary dataset for molecule-caption translation (Mol2Cap and Cap2Mol).
  • PubChem: Used to demonstrate the framework's ability to generalize across different data distributions.
  • MoleculeNet (BACE and BBBP): Used to test the model's performance on downstream molecular property prediction tasks.

Key Insights and Ideas

  • Alignments as Reasoning Intermediates: By treating alignments as a middle step in a Chain-of-Thought, the model becomes more explainable. We can see why the model thinks a certain SMILES string matches a description by looking at the sub-structures it identified.
  • Perplexity as an Unsupervised Filter: One of the cleverest parts of the paper is using the student model's perplexity to choose between teacher-generated alignments. This acts as an effective, unsupervised quality control mechanism to reduce noise in the training data.
  • Superiority over Rule-Based Methods: The authors compared their LLM-generated alignments to those created by the BRICS algorithm (a standard chemical rule-based decomposition). The LLM-based alignments consistently performed better, suggesting that LLMs capture chemical nuances that hard-coded rules miss.
  • Tuning Paradigm Shift: The paper demonstrates that CoT-ICMT is significantly more effective than naive fine-tuning or standard instruction tuning for complex cross-modal tasks like chemistry.
Comparison of different fine-tuning paradigms.

Key Results

MolReFlect achieved new State-of-the-Art (SOTA) results across the board:

  • Molecule Captioning (Mol2Cap): Achieved a BLEU-4 score of 0.608, a 4.6% improvement over the previous best model (ICMA).
  • Molecule Generation (Cap2Mol): Achieved a remarkable 51% Exact Match (EM) rate, significantly outperforming baselines like BioT5 (41.3%) and ICMA (46%).
  • Property Prediction: On the BACE and BBBP tasks, MolReFlect outperformed previous LLM-based methods, showing that fine-grained alignment helps the model understand molecular behavior, not just translate text.

Quantitative results for the Mol2Cap task. Quantitative results for the Cap2Mol task.

Limitations and Future Work

  • Computational Cost: The authors note that the training cost for MolReFlect is higher than naive fine-tuning because the expanded context (including the alignments) increases the number of tokens processed.
  • Teacher Model Limits: Due to budget constraints, the authors used Llama-3-70B rather than even larger models like GPT-4o or Claude 3.5. They suggest that using these "fancier" models as teachers could further improve alignment quality.
  • Future Directions: The team aims to explore even finer granularities of alignment and investigate how this framework can be applied to other scientific domains where cross-modal understanding is critical.

Summary updated

BibTeX
@article{li2026molreflect,
  author = {Jiatong Li and Yunqing Liu and Wei Liu and Jingdi Lei and Di Zhang and Wenqi Fan and Dongzhan Zhou and Yuqiang Li and Qing Li},
  title = {{MolReFlect: Toward In-Context Fine-Grained Alignments Between Molecules and Texts}},
  journal = {IEEE Trans. Knowl. Data Eng.},
  year = {2026},
  doi = {10.1109/tkde.2026.3689445},
}
Figure