agentleFS
Kdevos12Kdevos12/ALKYL/skills/generative-design/SKILL.md

generative-design

Skill6 starsChanged 9 months agoMITView on GitHub

Use when designing or evaluating generative models for de novo drug/molecule design. Covers molecular generation theory and evaluation (MOSES/GuacaMol), SELFIES + language models, RL-based optimization with REINVENT 4, JT-VAE and graph-based generation, and structure-based 3D generation (DiffSBDD, Pocket2Mol, DiffLinker).

  • Installs packages

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Novelty ≠ synthesizability: always check SA score ≤ 4, run retrosynthesis (ASKCOS/AiZynthFinder)

    line 132
  2. Very specific:

    3D diffusion needs pocket quality: must use properly prepared protein (see homology-modeling → structure-prep)

    line 133

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Generative Molecular Design

De novo design of novel molecules with desired properties using generative models — the core ML capability for lead generation and scaffold hopping in drug discovery.

When to Use This Skill

  • Generate molecules with target properties (QED, LogP, SA, docking score)
  • Explore chemical space around a hit/lead (analogue generation, scaffold hopping)
  • Design molecules conditioned on a protein pocket (SBDD)
  • Optimize multi-property objectives (Pareto front: potency + selectivity + ADMET)
  • Benchmark or compare generative models (MOSES / GuacaMol suites)
  • Build a RL-based focused library generator (REINVENT 4)
  • Design linkers or grow fragments (fragment-based generative design)

Generation Paradigms

ParadigmMethodStrengthWeakness
Language modelSMILES/SELFIES GPT, LSTMFast, scalable, fine-tunableSMILES can be invalid; needs SELFIES
VAEJT-VAE, MolVAESmooth latent space, BO-readyMode collapse; slow tree encode
GNN flow/GANGraphAF, GCPN, JunctionGANGraph-native; no linearityTraining instability
RL optimizationREINVENT 4, REINFORCEProperty-guided; no new arch neededReward hacking; mode collapse
3D diffusionDiffSBDD, TargetDiffPocket-conditioned; 3D geometrySlow, needs structure
Fragment-basedDeLinker, DiffLinkerFragment growing, FBDDLimited to provided fragments

Evaluation Metrics (Know These)

MetricWhat it measuresTarget
Validity% chemically valid~100% (SELFIES) / 85-99% (SMILES LM)
Uniqueness% unique in generated set>99%
Novelty% not in training set>99%
FCDFréchet ChemNet Distance (distribution)Lower = closer to drug-like distribution
KL divergenceProperty distributions vs. referenceLower
Scaffold diversity# unique Murcko scaffolds / NHigher
IntDivInternal diversity (mean pairwise 1-Tc)> 0.85
SNNSimilarity to nearest neighbor in training< 0.6 (novel)

Quick Start — SELFIES + GPT sampling

import selfies as sf
from rdkit import Chem

# Encode/decode SELFIES (guaranteed valid)
smiles = "CC(=O)Oc1ccccc1C(=O)O"  # aspirin
selfies_str = sf.encoder(smiles)
decoded_smiles = sf.decoder(selfies_str)
mol = Chem.MolFromSmiles(decoded_smiles)  # always valid

# Get SELFIES alphabet for tokenization
alphabet = sf.get_semantic_robust_alphabet()

# Decode a random generated SELFIES token sequence (always valid):
generated_tokens = ["[C]", "[Branch1]", "[C]", "[=O]", "[N]", "[H]"]
generated_smiles = sf.decoder("".join(generated_tokens))

Quick Start — REINVENT 4 scoring component

# Install: pip install reinvent
# REINVENT 4 uses TOML config for staged learning

import toml

config = {
    "run_type": "reinforcement_learning",
    "device": "cuda",
    "tb_logdir": "tb_logs",
    "json_out_config": "run_config.json",
    "parameters": {
        "use_checkpoint": False,
        "prior_file": "path/to/prior.prior",
        "agent_file": "path/to/prior.prior",
        "batch_size": 128,
        "n_steps": 1000,
    },
    "scoring": {
        "type": "custom_product",
        "parallel": False,
        "components": [
            {"type": "qed", "name": "QED", "weight": 1.0},
            {"type": "sa_score", "name": "SA", "weight": 1.0,
             "transform": {"type": "reverse_sigmoid", "low": 1.0, "high": 6.0, "k": 0.5}},
        ],
        "diversity_filter": {
            "type": "IdenticalMurckoScaffold",
            "minscore": 0.4,
            "bucket_size": 25,
        }
    }
}
with open("rl_config.toml", "w") as f:
    toml.dump(config, f)
# Run: reinvent -l rl_run.log rl_config.toml

Router — What to Read

TaskReference
Theory: molecular space, SMILES/SELFIES/graphs, metrics, MOSES/GuacaMol benchmarksreferences/generation-theory.md
SELFIES grammar, SMILES LM (GPT/LSTM), HuggingFace fine-tuning, sampling strategiesreferences/selfies-lm.md
REINVENT 4: RL optimization, multi-component scoring, diversity filters, oraclesreferences/rl-reinvent.md
JT-VAE: tree decomposition, latent BO; TorchDrug graph generative models overviewreferences/vae-jtvae.md
Structure-based 3D generation: DiffSBDD, TargetDiff, Pocket2Mol, linker designreferences/sbdd-diffusion.md

Software Stack

PackageInstallRole
selfiespip install selfiesAlways-valid molecular grammar
reinventpip install reinventRL de novo design (AZ REINVENT 4)
guacamolpip install guacamolBenchmark suite (17 goal-directed + distributional)
mosespip install molsetsMOSES benchmark (6 metrics)
transformerspip install transformersGPT/LSTM LMs (HuggingFace)
torchdrugpip install torchdrugGCPN, GraphAF, JT-VAE (graph-native)
DiffSBDDGitHub: arneschneuing/DiffSBDD3D pocket-conditioned diffusion
DiffLinkerGitHub: igashov/DiffLinkerLinker design in 3D

Key Pitfalls

  • SMILES LMs can generate 10-50% invalid → use SELFIES; or add validity filter post-hoc
  • Reward hacking in RL: model learns degenerate structures that maximize score — add diversity filter + SA penalty
  • FCD is not computed from structure: requires ChemNet embeddings (guacamol includes this)
  • Novelty ≠ synthesizability: always check SA score ≤ 4, run retrosynthesis (ASKCOS/AiZynthFinder)
  • 3D diffusion needs pocket quality: must use properly prepared protein (see homology-modeling → structure-prep)
  • Mode collapse in VAE: monitor KL weight β; schedule β-VAE warmup

Related Skills

  • torchdrug — GCPN, GraphAF, GraphDF, JT-VAE implementation
  • rdkit — validity checks, property scoring oracles (QED, SA, fingerprints)
  • docking — docking oracle for RL scoring (Vina/Gnina scoring function)
  • pharmacophore — pharmacophore constraints for conditional generation
  • homology-modeling → structure-prep — pocket preparation for SBDD
  • scientific-skills:zinc-database — training/reference sets (ZINC20)
  • mmpa (upcoming) — matched molecular pair analysis on generated series

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.