SmileyLlama: Modifying Large Language Models for Directed Chemical Space Exploration
Joseph M. Cavanagh, Kunyang Sun, Andrew Gritsevskiy, Dorian Bagni, Yingze Wang, Thomas D. Bannister, Teresa Head-Gordon
TL;DR
This work shows that an open-weight LLM foundation model can be repurposed as a chemical language model (CLM) through supervised fine-tuning with engineered prompts and, optionally, Direct Preference Optimization, enabling directed molecule generation without training a CLM from scratch. By training on ChEMBL SMILES and integrating with the iMiner reinforcement learning framework, SmileyLlama can generate valid, drug-like molecules and optimize them for 3D binding against SARS-CoV-2 MPro. The results demonstrate that SFT, together with prompt engineering and DPO, achieves competitive performance on GuacaMol benchmarks and improves task adherence while maintaining diversity; the approach also supports efficient target-specific design with reduced computational burden. The framework generalizes beyond drug discovery to other chemical domains and highlights practical implications for rapid, guided chemical space exploration using LLMs.
Abstract
Here we show that a general-purpose large language model (LLM) chatbot, Llama-3.1-8B-Instruct, can be transformed via supervised fine-tuning of engineered prompts into a chemical language model (CLM), SmileyLlama, for molecule generation. We benchmark SmileyLlama by comparing it to CLMs trained from scratch on large amounts of ChEMBL data for their ability to generate valid and novel drug-like molecules. We also use direct preference optimization to both improve SmileyLlama's adherence to a prompt and to generate molecules within the iMiner reinforcement learning framework to predict new drug molecules with optimized 3D conformations and high binding affinity to drug targets, illustrated with the SARS-Cov-2 Main Protease. This overall framework allows a LLM to speak directly as a CLM which can generate molecules with user-specified properties, rather than acting only as a chatbot with knowledge of chemistry or as a helpful virtual assistant. While our dataset and analyses are geared toward drug discovery, this general procedure can be extended to other chemical applications such as chemical synthesis.
