Leveraging large language models for predictive chemistry

Kevin Maik Jablonka, Philippe Schwaller, Andres Ortega-Guerrero, Berend Smit

Introduction

In the fields of chemistry and materials science, data is a precious and expensive commodity. Unlike the massive datasets available in consumer technology, a chemist may only possess a few dozen experimental results for a novel class of high-entropy alloys or a specific catalytic reaction. Traditionally, applying machine learning (ML) to these "small-data" scenarios required intensive "expert-in-the-loop" engineering, involving the development of specialized mathematical descriptors (such as SMILES strings or fingerprints) and the selection of architectures capable of handling complex physical constraints.

Recent research challenges this paradigm by asking whether general-purpose Large Language Models (LLMs), trained on vast swaths of internet text, can solve niche scientific problems more effectively than specialized tools. By treating chemical data as natural language, researchers have demonstrated that models like GPT-3 can outperform state-of-the-art specialized models, particularly in data-scarce regimes.

Methodology: Language-Interfaced Fine-Tuning

The core innovation of this approach is its simplicity: language-interfaced fine-tuning. Rather than designing complex neural networks, chemical data is converted into natural language questions. For instance, to predict a molecule's solubility, the model is prompted with: "What is the solubility of [Molecule Name]?" and then fine-tuned on the ground-truth answer.

Overview of the datasets and tasks used to evaluate GPT-3 in chemical and materials science contexts.

The study primarily utilized the "ada" variant of GPT-3. Because LLMs are designed to predict text rather than continuous numerical values, the researchers employed textual regression. Continuous values, such as boiling points or transition wavelengths, were rounded to a fixed precision and treated as text strings. This allowed the model to handle regression tasks within a standard language modeling framework.

Experimental Breadth: From Molecules to Materials

The model's performance was evaluated across a remarkably diverse range of chemical and materials science domains:

  • Molecular Properties: Tasks included predicting solubility, lipophilicity, and electronic properties like HOMO-LUMO gaps using the QMugs dataset.
  • Materials Science: The model predicted phases in high-entropy alloys, thermal properties of polymers, and gas adsorption (Henry coefficients) in metal-organic frameworks (MOFs).
  • Chemical Reactions: GPT-3 was tasked with predicting yields for critical C-N and C-C cross-coupling reactions.
  • Standard Benchmarks: The approach was also tested against the Matbench suite, a rigorous standard for materials science machine learning.

Key Insights: Efficiency and Intuition

The most striking finding was the model's extreme data efficiency. In many instances, GPT-3 achieved performance levels with just 50 data points that specialized models required 1,000 points to reach. This "low-data" advantage suggests that the pre-training on diverse text allows the model to leverage a latent understanding of chemical relationships.

Another significant insight was the model's representation agnosticism. While traditional ML models are often sensitive to how a molecule is described (e.g., SMILES strings versus IUPAC names), GPT-3 maintained high performance regardless of the nomenclature used. This suggests the model has internalized the underlying logic of chemical naming conventions during its initial training.

The model also demonstrated a form of "scientific intuition" through extrapolation. In controlled tests, when trained only on molecules with small electronic gaps and then asked to identify a molecule with a large gap, GPT-3 successfully "hallucinated" valid structures that physically corresponded to the requested property, even though those structures were outside its specific fine-tuning distribution.

Results and Inverse Design

Quantitatively, traditional baselines often required between 1.5x and 24x more data to match the performance of the fine-tuned LLM in low-data regimes. For high-entropy alloy phase prediction, the model reached approximately 90% accuracy with a fraction of the data used by previous state-of-the-art methods.

Example of inverse design where GPT-3 generates a molecular structure based on target physical properties.

In inverse design tasks, the model's generative capabilities were harnessed by reversing the prompt—for example, asking for a molecule with a specific transition wavelength. The molecules generated were evaluated for "synthetic accessibility" (SA). Results indicated that GPT-3 consistently produced structures that were not only novel but also chemically plausible and synthesizable in a laboratory setting, typically maintaining SA scores below 3.

Limitations and Future Outlook

Despite its success, the "black box" nature of LLMs in this context remains a subject of investigation. Current limitations include the difficulty of high-precision regression when treating numbers as text, the potential for data contamination from pre-training, and the costs associated with proprietary APIs. However, the authors suggest that querying a pre-trained LLM may soon become a standard "bootstrap" step for chemistry projects, providing a high-quality predictive baseline before a single physical experiment is conducted.

Summary updated

BibTeX
@article{jablonka2024leveraging,
  author = {Kevin Maik Jablonka and Philippe Schwaller and Andres Ortega-Guerrero and Berend Smit},
  title = {{Leveraging large language models for predictive chemistry}},
  journal = {Nat. Mac. Intell.},
  year = {2024},
  doi = {10.1038/s42256-023-00788-1},
}
Figure