A repository accompanying the paper "Exploration and validation of large language models as tools for molecular optimization".
This repository implements an iterative, semi-supervised molecular design pipeline driven by large language models (LLMs). Starting from a set of lead compounds with known structure–activity relationships, the pipeline uses in-context learning to propose novel drug-like molecules, scores them with oracle ML models, and feeds the best candidates back as context for subsequent rounds.
Key capabilities:
- In-context learning prediction — zero-/few-shot regression and classification of biological activity using Claude on AWS Bedrock.
- Semi-supervised iteration — closed-loop generation → oracle scoring → context expansion.
- Oracle training — motif-aware CatBoost / scikit-learn ensembles trained on three independent feature sets: circular (Morgan) fingerprints, RDKit descriptors, and Mol2Vec embeddings.
- Design reasoning analysis — extracts and inspects the LLM's stated rationale behind proposed structural modifications.
The setup script installs Miniconda (if needed), creates the conda environment, and registers the Jupyter kernel in a single step:
bash setup.sh
conda activate llm-mol-designIf you already have conda, you can skip the script and run the steps manually:
conda env create -f environment.yml
conda activate llm-mol-design
python -m ipykernel install --user --name llm-mol-design --display-name "llm-mol-design"The generation and prediction notebooks/scripts call Claude through AWS Bedrock.
The model is configured in utils/aws.py:
| Model | Bedrock model ID |
|---|---|
| Claude 3.5 Sonnet | anthropic.claude-3-5-sonnet-20240620-v1:0 |
All results in the paper use this model. To run against a different one, change
CLAUDE_SONNET and MAX_OUTPUT_TOKENS in utils/aws.py — the latter is the
per-response output ceiling and differs between models.
Depending on your region, on-demand access to this ID may require a cross-region
inference profile (us.anthropic.…) rather than the bare identifier.
You need:
- An AWS account with Bedrock enabled in your region (e.g.
us-east-1). - Model access granted for the Anthropic Claude models in the Bedrock console.
- Credentials configured locally — either via
~/.aws/credentials, environment variables (AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY), or an IAM role.
GenAI_ICL/
├── README.md
├── setup.sh # One-command install (conda + environment + kernel)
├── environment.yml # Conda environment specification
│
├── Notebooks/ # Analysis & experiment notebooks (see Notebooks/README.md)
├── scripts/ # Command-line entry points (see scripts/README.md)
├── utils/ # Shared Python library (see utils/README.md)
└── data/ # Input data & intermediate results (see data/README.md)
Each subdirectory contains its own README with detailed descriptions.
Non-commercial licence — academic research and non-profit use only. Copyright Sanofi 2026. Commercial use, including development of a commercial product or use in collaboration with a private company, requires a separate agreement; see LICENSE for the full terms and contact details.
The GSK3B and MMP8 reference sets are derived from ChEMBL (© EMBL-EBI, CC-BY-SA 3.0) and are therefore not redistributed here — only the molecule identifier lists are included. See data/README.md to rebuild them.
Add the volume, article number and DOI once the article is assigned them.
@article{grebner2026,
title={Exploration and validation of large language models as tools for molecular optimization},
author={Grebner, Christoph and Corrochano-Navarro, Alejandro and Buning, Christian and Matter, Hans and M{\'e}ndez, Maria and Ruf, Sven and Griwatz, Jan and Speckmeier, Elisabeth and Sadowski, Thorsten and Vymetal, Jiri and Moayedpour, Saeed and Kogler-Anele, Lorenzo and Bar-Joseph, Ziv and Jager, Sven and Hessler, Gerhard},
journal={Communications Chemistry},
year={2026},
}