Overview
ChemLactica models use a structured prompt format to condition molecule generation on desired properties and structural similarities. Prompts are constructed using special tags that the model learned during pretraining.Example from the README:
</s>[SAS]2.25[/SAS][SIMILAR]CC(=O)OC1=CC=CC=C1C(=O)O 0.62[/SIMILAR][START_SMILES] generates a molecule with SAS score ~2.25 and Tanimoto similarity ~0.62 to aspirin.Prompt Structure
A complete prompt follows this pattern:Components
- EOS Token (
</s>): Marks the start of a new prompt - Property Tags: Specify desired molecular properties
- Similarity Tags: Reference molecules with similarity scores
- Start Tag:
[START_SMILES]signals the model to begin SMILES generation
Property Tags
Available Properties
ChemLactica models understand these molecular properties from pretraining:SAS - Synthetic Accessibility Score
SAS - Synthetic Accessibility Score
Estimates how difficult a molecule is to synthesize.
- Range: 1.0 (easy) to 10.0 (very difficult)
- Typical values: 2.0-4.0 for drug-like molecules
QED - Quantitative Estimate of Drug-likeness
QED - Quantitative Estimate of Drug-likeness
Measures drug-likeness based on molecular properties.
- Range: 0.0 to 1.0
- Typical values: >0.7 for drug-like molecules
TPSA - Topological Polar Surface Area
TPSA - Topological Polar Surface Area
Surface area of polar atoms, important for membrane permeability.
- Range: 0 to ~300 Ų
- Typical values: 20-140 Ų for oral bioavailability
CLogP - Calculated LogP
CLogP - Calculated LogP
Lipophilicity measure for membrane permeability.
- Range: Typically -2 to 6
- Typical values: 0-5 for drug-like molecules
Molecular Weight
Molecular Weight
Total molecular weight in Daltons.
- Range: Variable
- Typical values: 150-500 Da for drug-like molecules
Multiple Properties
Combine multiple property tags in a single prompt:Similarity Constraints
SIMILAR Tag Format
Reference molecules to guide structural similarity:- reference_smiles: SMILES string of the reference molecule
- similarity_score: Tanimoto similarity (0.0 to 1.0) using Morgan fingerprints (ECFC4)
Example: Aspirin Analogs
Multiple Similar Molecules
Include multiple reference molecules:utils.py:175
Prompt Construction in Optimization
TheOptimEntry.to_prompt() method builds complete prompts for optimization:
utils.py:197
Custom Properties
Define custom properties for specific optimization tasks:example_run.py:98
Oracle Score Property
When using rejection sampling (rej-sample-v2 strategy), oracle scores are included:
utils.py:214
Example Prompts
Basic Property-Conditioned Generation
Similarity-Guided Generation
Combined Constraints
Optimization with Rejection Sampling
Best Practices
Property Values
Use realistic property value ranges based on your target chemical space
Similarity Scores
Balance exploration (lower similarity) and exploitation (higher similarity)
Multiple References
Include 3-5 similar molecules to guide structural features
Prompt Length
Keep total prompt + generation under 2048 tokens
Next Steps
Molecule Generation
Learn how to use prompts for generation
Sampling Strategies
Optimize generation with sampling parameters