cadd-instruct / README.md
lukaskim's picture
Add synllama
d870f69 verified
|
Raw
History Blame Contribute Delete
5.38 kB
metadata
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):

{
  "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):

{
  "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):

{
  "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:

from datasets import load_dataset

ds = load_dataset("lukaskim/cadd-instruct")          # default "all" config
print(ds["train"][0])

Filter the combined dataset by source:

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:

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:

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:

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