Datasets:
File size: 5,383 Bytes
d7cd500 d870f69 d7cd500 d870f69 d7cd500 d870f69 d7cd500 d870f69 d7cd500 d870f69 d7cd500 d870f69 d7cd500 d870f69 d7cd500 c2ec2b0 d7cd500 c2ec2b0 d7cd500 c2ec2b0 d7cd500 c2ec2b0 d7cd500 c2ec2b0 d7cd500 d870f69 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | ---
license: mit
task_categories:
- text-generation
tags:
- chemistry
- drug-discovery
- smiles
- molecules
- instruction-tuning
- retrosynthesis
- synthesis-planning
size_categories:
- 1M<n<10M
configs:
- config_name: all
data_files: all/*.parquet
default: true
- config_name: smileyllama
data_files: smileyllama/*.parquet
- config_name: linkllama
data_files: linkllama/*.parquet
- config_name: synllama
data_files: synllama/*.parquet
dataset_info:
features:
- name: instruction
dtype: string
- name: input
dtype: string
- name: output
dtype: string
- name: source
dtype: string
---
# CADD-Instruct
An instruction-tuning dataset for computer-aided drug design (CADD). It combines
three complementary tasks:
- **Conditional molecule generation** (`smileyllama`, `linkllama`) — generate a
SMILES string satisfying a set of physicochemical/structural constraints.
- **Retrosynthesis / synthesis planning** (`synllama`) — given a target
molecule, produce a synthetic pathway of reaction templates and building
blocks.
## Format
Every row follows the standard instruction / input / output schema:
| field | description |
| --- | --- |
| `instruction` | The system-level role/task description. |
| `input` | The user request (target properties, or a target SMILES to synthesize). |
| `output` | The answer — a SMILES string, or a JSON synthesis pathway (`synllama`). |
| `source` | Origin of the row (`smileyllama`, `linkllama`, or `synllama`). |
### Examples
Conditional generation (`smileyllama`):
```json
{
"instruction": "You love and excel at generating SMILES strings of drug-like molecules",
"input": "Output a SMILES string for a drug-like molecule with the following properties: <= 90 TPSA, lacks bad SMARTS, has covalent warheads (acrylamides), <= 5 LogP, <= 0.4 Fraction sp3, <= 10 Rotatable bonds:",
"output": "n1cc(/C=C/C(=O)Nc2ccc(cc2)COC)c(cc1)-c1cnn(C)c1",
"source": "smileyllama"
}
```
Linker generation (`linkllama`):
```json
{
"instruction": "You are an expert medicinal chemist specializing in linker design. Your task is to design a linker to connect given fragments and deduce whether the final molecule is chemically reasonable. The output should be in JSON format.",
"input": "Fragment 1 (SMILES: c1cc2nncn2nc1[*:1]) and Fragment 2 (SMILES: c1ccc([*:2])cc1). The distance between the attachment points is 6.59 Angstroms, and the angle between them is 114.60 degrees. Given the above information about the fragments and attachment points, design a branched linker with >= 1 rotatable bonds, >= 5 heavy atoms to connect them. The final molecule should be unreasonable. And it should have the following properties: <= 5H-bond donors, <= 7 H-bond acceptors, <= 600 Molecular weight, <= 200 TPSA.",
"output": "{\"linker\": \"BrC(=C\\\\[*:2])/C=N/N[*:1]\", \"reasoning\": \"Linker bad rings: pass. Linker problematic ring: absent. Undesirable SMARTS: pass. PAINS: pass. REOS failed rule: imine.\"}",
"source": "linkllama"
}
```
Synthesis planning (`synllama`):
```json
{
"instruction": "You are an expert synthetic organic chemist. Your task is to design a synthesis pathway for a given target molecule using common and reliable reaction templates and building blocks. ...",
"input": "Provide a synthetic pathway for this SMILES string: CNC1(CC(=O)[C@]2(...))CCCCC1",
"output": "{\"reactions\": [{\"reaction_number\": 1, \"reaction_template\": \"<rxn>...</rxn>\", \"reactants\": [...]}]}",
"source": "synllama"
}
```
## Configurations
| config | rows | description |
| --- | --- | --- |
| `all` (default) | ~5.86M | Combined dataset (all sources). |
| `smileyllama` | ~2.33M | SmileyLlama SFT data (conditional generation). |
| `linkllama` | ~1.53M | LinkLlama cap50 training data (conditional generation). |
| `synllama` | 2.00M | SynLlama synthesis-pathway data (synthesis planning). |
## Usage
Load the full dataset:
```python
from datasets import load_dataset
ds = load_dataset("lukaskim/cadd-instruct") # default "all" config
print(ds["train"][0])
```
Filter the combined dataset by `source`:
```python
from datasets import load_dataset
ds = load_dataset("lukaskim/cadd-instruct", split="train")
smiley = ds.filter(lambda ex: ex["source"] == "smileyllama")
```
Or load a specific source directly:
```python
from datasets import load_dataset
smiley = load_dataset("lukaskim/cadd-instruct", "smileyllama")
link = load_dataset("lukaskim/cadd-instruct", "linkllama")
```
Stream instead of downloading everything up front:
```python
from datasets import load_dataset
ds = load_dataset("lukaskim/cadd-instruct", split="train", streaming=True)
for example in ds:
print(example["input"], "->", example["output"])
break
```
Format a row into a prompt for supervised fine-tuning:
```python
from datasets import load_dataset
ds = load_dataset("lukaskim/cadd-instruct", split="train")
def to_prompt(ex):
return {"text": f"{ex['instruction']}\n\n{ex['input']}\n{ex['output']}"}
ds = ds.map(to_prompt)
print(ds[0]["text"])
```
## Sources
- **smileyllama**: SFT data for SmileyLlama — https://figshare.com/articles/dataset/SFT_Data_for_SmileyLlama/30854573
- **linkllama**: https://huggingface.co/datasets/THGLab/LinkLlama-cap50-train
- **synllama**: https://github.com/THGLab/SynLlama/tree/main
|