AI for Materials Science · Lecture 09 (Complete Beginner-to-Research Edition)
Generative Models for Materials Discovery:
SELFIES VAEs, Goal-Directed Inverse Design & Microscopy Diffusion
Zesheng Liu
Laboratory of Organic Electronics, Linköping University
Modules 09a–09c | Continuous Latent Spaces, Surrogate Exploitation Defense, SR-ResCNN & Conditional DDPM
Lecture 09 roadmap: from latent molecules to diffusion microscopy
Three generative paradigms spanning 1D molecular strings and 2D materials images (
09a–09c)PART 1 · MODULE 09a
SELFIES & Molecular VAE
Why SELFIES achieves 100% syntactic validity, Variational Autoencoder ELBO & reparameterization, high-D soap-bubble geometry (Lerp vs. Slerp), and Prior Holes.
PART 2 · MODULE 09b
Goal-Directed Inverse Design
Steering molecular generation toward high-PCE organic photovoltaics, diagnosing Surrogate Model Exploitation, SA Score filtering, and the 6-Step Honest Audit Checklist.
PART 3 · MODULE 09c
Microscopy SR & Diffusion
Low-dose SEM degradation physics, Residual Super-Resolution CNN (SR-ResCNN) vs. Bicubic PSNR, DDPM forward/reverse math, and conditional microstructure generation.
Generative models invert the materials workflow—designing structures for target properties—but only trustworthy filters (AD, SA, LCB) turn generated strings into real lab candidates.
SELFIES: 100% chemically valid formal molecular grammar
Random single-token edits break most SMILES strings; SELFIES finite-state rules guarantee every sequence decodes to a valid graph
SELFIES eliminates syntax crashes during latent-space decoding—but remember: '100% valid valence' does NOT mean 'synthesizable or stable'!
Molecular Variational Autoencoder (VAE) & ELBO objective
Mapping discrete molecules into a smooth Gaussian latent space via reparameterization z = μ + σ ⊙ ϵ
The reparameterization trick lets gradients flow through stochastic sampling, while β-annealing balances reconstruction accuracy against smooth KL regularization.
High-D latent geometry: Lerp norm collapse vs. Slerp
In d = 32 dimensions, 99% of Gaussian probability mass sits on a thin spherical shell of radius √d ≈ 5.66—the origin is empty!
Linear interpolation (Lerp) cuts straight through the low-density origin (Prior Hole); Spherical Linear Interpolation (Slerp) stays on the high-density shell.
Goal-directed molecular design: shifting toward high PCE
Pairing a fast Random Forest property oracle with iterative generative fine-tuning pushes candidates into the ≥8% PCE regime
Goal-directed fine-tuning concentrates sampling budget on promising chemical neighborhoods—just like Bayesian Optimization in discrete sequence space.
Trap #1 & #2: Surrogate Exploitation & Unsynthesizable Monsters
Optimizing an unconstrained ML oracle inevitably discovers out-of-domain artifacts that fool the surrogate!
Never optimize a raw surrogate mean μ(x) alone—enforce an Applicability Domain (Tanimoto), Synthetic Accessibility (SA ≤ 4.5), and pessimistic Lower Confidence Bound (μ − kσ)!
The 6-Step Honest Audit Checklist for generative candidates
Before pitching any AI-generated molecule to a synthesis chemist or DFT queue, verify all six gates
GATES 1 & 2 · HYGIENE
Validity & Novelty
- 1. Canonical RDKit validity (no broken valences/radicals).
- 2. True novelty & uniqueness (deduplicated against training set).
GATES 3 & 4 · TRUST
AD & Pessimistic Score
- 3. Applicability Domain: Max Tanimoto similarity ≥ 0.38 to training library.
- 4. Uncertainty penalty: Rank by LCB = μ(x) − kσ(x), not raw μ(x).
GATES 5 & 6 · REALITY
Synthesis & Physics
- 5. Synthetic Accessibility: SA Score ≤ 4.5 & no PAINS/unstable strained rings.
- 6. Physics re-scoring: Verify top 10–20 with DFT / TD-DFT before wet-lab!
Great generative materials science is 20% generation and 80% rigorous physical & synthetic filtering.
Microscopy Super-Resolution: low-dose SEM → SR-ResCNN
Beam-sensitive materials (polymers, perovskites, Li-ion cathodes) demand low-dose fast scans—residual CNNs recover sharp phase boundaries
Learning the high-frequency residual (SR = Bicubic + f_θ(LR)) outperforms classical interpolation by several dB in PSNR while preserving nanoscale edges.
Denoising Diffusion Probabilistic Models (DDPM): core math
Destroy structure smoothly with Gaussian noise in T steps; train a U-Net to predict the noise ϵθ(xt, t) and reverse time!
DDPM's closed-form jump x_t = √ᾱ_t x_0 + √(1−ᾱ_t) ε lets you train on random timesteps in parallel with a simple MSE noise-prediction loss!
Conditional DDPM: synthesizing microstructures on demand
Injecting a target phase volume fraction φ into the U-Net lets you generate statistically faithful 2D/3D digital twins
Conditional diffusion models generate realistic synthetic microstructures matching target descriptors—accelerating FEM mechanics & transport simulations.
Real steel fractography SR audit & the Flow Matching frontier
Crisp-looking AI edges ≠ physical truth on unseen SEM fracture surfaces—always audit pixel error maps |Pred − Truth|!
Never measure critical defect dimensions on unverified generative SR; for 3D crystals, ODE Flow Matching (MatterGen) straightens diffusion trajectories!
Summary (Take home notes)
- SELFIES ensures 100% syntactic validity: Formal grammar rules eliminate invalid-string crashes during latent-space decoding, but still require chemical realism checks.
- Respect high-dimensional latent geometry: VAEs concentrate mass on a thin spherical shell of radius √d—use Slerp instead of Lerp to avoid Prior Holes.
- Defend against Surrogate Exploitation: Never maximize raw ML predictions blindly; enforce Applicability Domain, LCB (μ − kσ), and SA Score ≤ 4.5.
- Residual CNNs restore low-dose microscopy: Predicting missing high-frequency edges outperforms bicubic upsampling on beam-sensitive SEM/TEM images.
- Diffusion models unify generative design: Learning to denoise Gaussian-corrupted data via MSE loss powers conditional microstructure and crystal generation.
Thanks for your listening
Zesheng Liu · zesheng.liu@liu.se
AI for Materials Science · Lecture 09 | Next: Hands-on Practice in
09d_exercises.ipynb