Lecture 24 · Generative Models for Science

Deep Unsupervised Learning · Lecture 24。个人学习讲义与配套实验,按主题整理并持续修订。

课程源码 ZIP ↓

个人整理的学习笔记,非官方讲义;课程来源与整理说明见课程介绍。配套示例未逐一运行验证。

本篇目录

Maps to: UC Berkeley CS294-158 Deep Unsupervised Learning (Spring 2024), Lecture 13a · Thu 4/18/2024 · Generative Modeling for Science (guest lecture: John Ingraham; 99 slides, mostly figures). The talk frames three problems for generative modeling in three areas of science:

  • likelihood estimation (statistical genetics);
  • amortizing intractable inference (molecular physics);
  • controllable generation (molecular engineering).

It discusses sequence likelihoods as predictors, Boltzmann generators, diffusion models of 3-D structures with subquadratic architectures and polymer-shaped noise, low-temperature sampling, and “programmable” conditioning. Scope of these notes: as announced in the syllabus, only the general modeling methods are covered: likelihood ratios as zero-shot predictors, flows as amortized samplers with importance weights, symmetry and equivariance, chain-correlated noise, and conditioning as composable state and energy transformations. Everything is done on abstract toys with known ground truth: strings from a known random field, a 2-D double-well energy, 2-D chains of points. Application-specific content (biological sequences, molecular design targets, experimental results) is deliberately not reproduced. Code: code/lecture24/ (4 scripts + science_toys.py; PyTorch on CPU; reuses Lecture 4’s Transformer; the first run of script 03 trains six diffusion models) Reading time: 2.5 hours including running the code


0. How to read this lecture

0.1 Learning goals

After this lecture you should be able to:

  1. Likelihood ratios. Explain why the likelihood ratio of a generative model fitted to a family of related sequences can predict the effect of a change without labels. Explain when pairwise models, deep models and regularization matter.
  2. Amortized sampling. Explain why sampling a Boltzmann distribution is hard. Describe how a flow trained by reverse KL, maximum likelihood or both becomes an amortized sampler, and what importance weights can and cannot fix.
  3. Symmetry. Explain why generative models of structures in space must respect rotations and translations. Describe an equivariant network, and what correlated (“polymer”) noise does for a diffusion model of chains.
  4. Programmable conditioning. Describe conditioning as composable state transformations and energy adjustments, and the trade-offs of guidance strength and temperature.

0.2 Prerequisites and scope

AssumedIntroduced here
Lectures 3–4 (autoregressive models), 5–6 (flows), 11–12 (diffusion, guidance)likelihood ratios as zero-shot predictors; Potts models and pseudo-likelihood
Lecture 14–15 (self-supervision; “the distribution reflects the process that made the data”)Boltzmann generators; reverse vs forward KL; importance weights and effective sample size
E(n)-equivariant networks; chain-correlated noise; composable conditioning; low temperature

0.3 Map

§1  three problems for generative modeling in science
§2  likelihood estimation: likelihood ratios as zero-shot predictors     ← code 01
§3  amortizing intractable inference: Boltzmann generators                ← code 02
§4  structures in space: symmetry, equivariance, chain-shaped noise       ← code 03
§5  controllable generation: conditioners as state and energy transforms  ← code 04
§6 summary   §7 pitfalls   §8 exercises   §9 further reading   §10 next lecture

1. Three problems for generative modeling in science

The talk opens with a map of where generative models meet science (slides 3–7):

  • uncertainty propagation in physical systems;
  • scientific imaging and inverse problems (“NeRF for molecules”);
  • inference machinery for simulations;
  • language models for science.

It then focuses on three problems (slide 8):

problemthe generative-modeling questionwhy it is hard
Likelihood estimationhow probable is a sequence, compared with a reference?data are few and related, models must generalize from them
Amortizing intractable inferencedraw samples from a distribution known only up to a constant (an energy)dynamics mix slowly across barriers
Controllable generationsample structures that satisfy many constraints at onceconstraints are diverse; retraining per constraint is impossible

Each section below takes one problem and reproduces its central method on a toy whose truth is known.


2. Likelihood estimation: likelihood ratios as zero-shot predictors

2.1 The idea (slides 10–22)

A family of related sequences that arose under selection carries, in its distribution, a record of which variations were tolerated (slide 11). The recipe:

  1. Collect related sequences.
  2. Learn a distribution pθp_\theta.
  3. Score a variant vv of a reference sequence ss by log⁡pθ(v)−log⁡pθ(s)\log p_\theta(v) - \log p_\theta(s).

No measurement of any variant is needed. The slides compare model classes:

  • Site-independent models: one distribution per position.
  • Pairwise Markov random fields (“Potts models”): log⁡p(x)=∑ihi(xi)+∑i<jJij(xi,xj)−log⁡Z\log p(x) = \sum_i h_i(x_i) + \sum_{i<j} J_{ij}(x_i, x_j) - \log Z.
  • VAEs, including Bayesian ones: regularization mattered because “the data can be weak”.
  • Language models trained across many families: the one-family-at-a-time models “can still be hard to beat”.

A Potts model’s partition function is intractable, but likelihood ratios do not need it. It is fitted by pseudo-likelihood, ∑n∑ilog⁡p(xi(n)∣x−i(n))\sum_n \sum_i \log p(x_i^{(n)} \mid x_{-i}^{(n)}), a product of small softmaxes, plus an L2 penalty on hh and JJ.

2.2 The toy (script 01)

elementsetting
datastrings of length 12 over 6 symbols, from a known Potts model (random fields, 18 coupled position pairs), drawn by Gibbs sampling
referencethe most probable sample
ground truththe exact log⁡p\log p ratios of all 60 single and 500 random double variants
models fittedsite-independent frequencies; Potts by pseudo-likelihood at four regularization strengths; an autoregressive Transformer (Lecture 4’s)
training setsNN sequences, from 30 to 10,000

Spearman correlation with the exact effects (singles / doubles; for N≤100N \le 100, the mean of 5 random training sets):

modelNN = 301001,00010,000
independent sites0.526 / 0.4000.551 / 0.4460.552 / 0.4770.554 / 0.486
Potts, λ=10−4\lambda = 10^{-4}0.440 / 0.3210.639 / 0.5400.951 / 0.9030.989 / 0.982
Potts, λ=10−3\lambda = 10^{-3}0.577 / 0.4390.730 / 0.6270.951 / 0.8950.982 / 0.952
Potts, λ=10−2\lambda = 10^{-2}0.664 / 0.5630.801 / 0.7030.927 / 0.8580.949 / 0.891
Potts, λ=10−1\lambda = 10^{-1}0.715 / 0.6220.795 / 0.7080.835 / 0.7670.857 / 0.772
autoregressive Transformer0.194 / 0.2010.402 / 0.3300.711 / 0.5640.945 / 0.882

The ± over 5 draws at N≤100N \le 100 is 0.05–0.12.

  • Likelihood ratios predict effects without a single label. At NN = 10,000 the fitted Potts model ranks the exact effects with Spearman 0.99 (singles) / 0.98 (doubles). Independent sites stop at 0.55 / 0.49 whatever NN: in this family the couplings carry most of the information.
  • With few sequences, regularization decides. At NN = 30 the strongest penalty is best (0.72), and the weakest is worse than independent sites (0.44 vs 0.53). With 10,000 sequences the order reverses (0.99 vs 0.86). This is the slides’ “the data can be weak, so simple and/or regularized models have been favorable”.
  • The flexible model is the most data-hungry. The Transformer has no pairwise structure built in and no regularization beyond weight decay. It is the worst at 30 sequences (0.19, below independent sites) and nearly as good as the best Potts model at 10,000 (0.95). The slides’ observation that one-family models “can still be hard to beat” is, at heart, about how much data a family offers.

Epistasis. A double variant’s effect minus the two single effects. It is identically zero for the site-independent model. At N=10,000N = 10{,}000:

modelcorrelation with the exact epistasismean |predicted|mean |exact|
independent sites0 (predicts none)0.000.81
Potts, λ=10−4\lambda = 10^{-4}0.9270.930.81
Potts, λ=10−2\lambda = 10^{-2}0.7730.480.81
Potts, λ=10−1\lambda = 10^{-1}0.6180.300.81
autoregressive Transformer0.6420.670.81

Pairwise models predict epistasis, the non-additivity of two changes, and the weakly regularized Potts model predicts it well. Regularization shrinks it: the predicted magnitude falls from 0.93 to 0.30 nats as λ\lambda grows. The Transformer captures part of it (0.64).


3. Amortizing intractable inference: Boltzmann generators

3.1 The problem (slides 24–28)

Physics gives an energy u(x)u(\mathbf{x}) (here in units of kTkT), hence a distribution p(x)=e−u(x)/Zp(\mathbf{x}) = e^{-u(\mathbf{x})}/Z. It is well defined, but sampling it is hard (“sampling is hard”, slide 25).

Molecular dynamics integrates Langevin-like equations with time steps of femtoseconds: about 400 million steps for a microsecond (slide 26). Crossing an energy barrier of height Δu\Delta u happens at a rate ∝e−Δu\propto e^{-\Delta u}.

Idea 1: Boltzmann generators (Noé et al., 2019; slides 27–28).

  1. Train a normalizing flow qθq_\theta to imitate pp. Use reverse KL, Eq[log⁡q+u]=KL(q ∥ p)−log⁡Z\mathbb{E}_{q}[\log q + u] = \mathrm{KL}(q \,\|\, p) - \log Z, which needs only the energy; in practice, combine it with maximum likelihood on samples from short simulations.
  2. Correct the remaining mismatch with importance weights w∝e−u(x)/qθ(x)w \propto e^{-u(\mathbf{x})}/q_\theta(\mathbf{x}).

The slides add that these remain tricky to train and are used mostly for fluctuations around a known structure.

Idea 2 (slides 29–30): fine-tune a point-estimate predictor into a generative model with diffusion or flow matching, adding diversity at little cost in precision. The notes do not reproduce it.

3.2 Measured (script 02)

The energy is u(x)=6(x12−1)2−x1+x22/2u(\mathbf{x}) = 6(x_1^2 - 1)^2 - x_1 + x_2^2/2: two wells at x1≈±1x_1 \approx \pm 1, a barrier of about 6 kTkT, and the right well favoured. By grid integration, P(right)=0.872P(\text{right}) = 0.872 and log⁡Z=1.053\log Z = 1.053.

Langevin dynamics (step 10−310^{-3}, 200 chains started in the left well):

steps1,0005,00010,00020,00030,00040,000
chains in the right well1.5%13.0%21.5%42.5%59.0%66.5%

After 40,000 steps the chains are still short of the exact 87%. A short simulation (the first 2,000 steps of 50 chains) is 96.8% left-well data. Every crossing must climb the barrier.

Flows (RealNVP, 2,000 steps; 20,000 samples reweighted; 3 seeds):

trainingPP(right): raw samplesreweightedESS of 20,000log⁡Z\log Z estimate
reverse KL (energy only)0.999 – 1.0000.988 – 1.0008,016 – 19,8420.915 – 0.928
maximum likelihood on short simulations (left well only)0.031 – 0.0350.852 – 0.864138 – 4070.898 – 0.988
both0.435 – 0.5120.872 – 0.8738,248 – 11,6001.047 – 1.053
exact0.8720.8721.053

What the table shows:

  • Reverse KL is mode-seeking. Trained from the energy alone, every seed put all its samples into one well, the deeper one. Importance weights cannot restore mass the flow never proposes. Worse, the ESS looks excellent (up to 19,842 of 20,000) because the weights are uniform within the well the flow knows. The failure is invisible to the sampler’s own diagnostics, and log⁡Z\log Z is biased low by 0.13.
  • Maximum likelihood on biased simulations learns the left well. The flow’s thin tails reach the right well, so reweighting gives roughly the right population (0.85–0.86), but from only 138–407 effective samples.
  • Both losses together cover both wells. Reweighting gives the exact population (0.872) and log⁡Z\log Z (1.047–1.053) with thousands of effective samples. This is why the slides call the method finicky and why practice combines simulation data with the energy.

4. Structures in space: symmetry, equivariance, chain-shaped noise

4.1 Why symmetry

A structure in space has no preferred frame. Rotating or translating it gives the same structure, so its distribution is invariant: p(Rx+t)=p(x)p(R\mathbf{x} + \mathbf{t}) = p(\mathbf{x}). Its score and a diffusion model’s noise prediction are then equivariant: ϵ(Rx)=R ϵ(x)\epsilon(R\mathbf{x}) = R\,\epsilon(\mathbf{x}).

A generic network can only learn this from data, approximately. An equivariant network has it by construction. An example is the E(n)-equivariant graph network (EGNN, Satorras et al., 2021):

  • messages are computed from invariant quantities (distances, node features);
  • coordinates move only along relative vectors xi−xj\mathbf{x}_i - \mathbf{x}_j, scaled by invariant weights.

The talk’s 3-D models add two architectural points (slides 51–57):

  • Subquadratic cost. Sparse long-range connections preserve global context without O(N2)O(N^2) interactions.
  • Distance-preserving diffusion. The noise is correlated along the chain, so that neighbours stay neighbours during the forward process.

4.2 Measured (script 03)

The toy is 2-D chains of 10 points with unit bonds and persistent turning angles, centered and randomly rotated.

Equivariance. Rotating a chain by 1 radian moves coordinates by up to 4.26; pairwise distances change by 10−610^{-6}. Relative equivariance error ∥f(Rx)−Rf(x)∥/∥f(x)∥\lVert f(R\mathbf{x}) - R f(\mathbf{x})\rVert / \lVert f(\mathbf{x})\rVert at noise level 0.5:

denoiser0.5 rad1 rad2 radπtranslation by (3, −2)
MLP0.0970.130.140.131.8
EGNN3.5e-73.7e-73.3e-704.5e-7

Orientations never seen in training. Denoising loss on test chains:

denoisertest chains pointing rightrandomly rotated test chains
MLP, trained on chains pointing right0.1770.277
EGNN, trained on chains pointing right0.1900.186
MLP, trained on rotated chains0.1970.193
EGNN, trained on rotated chains0.1900.186

The MLP’s loss rises 56% on orientations it never saw. The EGNN does not care: equivariance is generalization to every orientation, for free.

Samples (500 chains, 100 ancestral steps). “Valid” means every bond within 0.1 of length 1:

modelparametersvalidmean |bond − 1|turning-angle W1radius-of-gyration W1
data (fresh chains)—100%0.0000.0350.031
MLP, isotropic noise on coordinates212K46.6%0.0570.0450.042
MLP, noise on bond vectors (chain noise)211K78.8%0.0350.0210.021
EGNN, isotropic noise on coordinates121K90.2%0.0220.0260.043
same, 1,000 training chains121K88.8%0.0220.0290.041

Why chain noise helps: the forward process. Mean distance between consecutive points, and the share above 2:

ttisotropic noisechain noise
0.31.15 (7.1% > 2)1.01 (1.1%)
0.51.42 (20.6%)1.10 (6.5%)
0.91.75 (35.5%)1.24 (12.7%)

Isotropic noise tears neighbours apart early, and the reverse process must reconnect a scattered cloud. Noise on the bond vectors, i.e. a random-walk covariance in coordinates, keeps the chain a chain at every noise level.

  • Same architecture: chain noise nearly doubles the share of valid samples, 46.6% → 78.8%.
  • The equivariant network does best with fewer parameters, and is still 88.8% valid from 1,000 training chains.

5. Controllable generation: conditioners as state and energy transformations

5.1 The idea (slides 49–74)

The talk asks for three properties of a generative model of structures:

  • programmable generation;
  • a subquadratic architecture;
  • a likelihood that is useful and controllable, via low-temperature sampling.

The central idea for programmability is to write every conditioner as a transformation of the reverse diffusion with matching inputs and outputs:

  • a state transformation, a change of variables, e.g. building a symmetric structure from one asymmetric unit;
  • and/or an energy adjustment, a guidance term as in classifier guidance (Lecture 12).

Because inputs and outputs match, conditioners compose: symmetry + shape + substructure, all on one unconditional model, with no retraining.

Low temperature sharpens the distribution toward high likelihood. The slides’ hybrid SDE adds Langevin dynamics at inverse temperature λ0\lambda_0 to the reverse SDE. We use the cruder knob of scaling the fresh noise of every reverse step.

5.2 Measured (script 04)

The model is script 03’s EGNN, unchanged. The conditioners:

conditionertypedefinitionsatisfied by unconditional samples
C2 symmetrystate transformationproject every clean estimate onto point-symmetric chains, xn−1−i=−xi\mathbf{x}_{n-1-i} = -\mathbf{x}_i—
End-to-end distance 1.5energy(∥x0−xn−1∥−1.5)2(\lVert\mathbf{x}_0 - \mathbf{x}_{n-1}\rVert - 1.5)^26%
Compactnessenergyradius of gyration at most 1.618%

Energies only use relative positions, so they agree with the model’s symmetry.

One conditioner at a time (400 chains each). “Within 0.3” is the share whose end-to-end distance is within 0.3 of 1.5; “compact” is the share with radius of gyration at most 1.6:

conditioningsymmetry errorend-to-end within 0.3compactvaliddiversity
data (reference)1.3276%19%100%1.12
unconditional samples1.4576%18%89.2%1.18
C2 symmetry (state projection)0.0034%23%88.5%1.16
end-to-end distance (energy, scale 0.3)1.852100%59%60.0%0.78
compactness (energy, scale 0.3)1.72215%98%55.5%0.92

Composed on the same model:

conditioningsymmetry errorend-to-end within 0.3compactvaliddiversity
symmetry + compact0.0038%100%54.0%0.69
distance + compact1.842100%98%56.2%0.81
symmetry + distance + compact0.003100%100%41.2%0.60

Guidance scale for the end-to-end distance:

scale00.050.10.31.03.0
within 0.3 of the target6%19%65%100%76%0%
valid89.2%17.8%22.2%60.0%48.5%0%
diversity1.180.950.860.780.792.00 (broken)

Temperature (fresh noise scaled in every reverse step):

noise ×1.00.80.60.3
valid89.2%92.0%91.8%84.0%
compact18%23%36%85%
diversity1.181.231.270.87

What these tables show:

  • A state transformation is exact and nearly free. Projecting every clean estimate onto point-symmetric chains made every sample symmetric (error 0.003) at no cost in validity (88.5% vs 89.2%).
  • Energy conditioners turn rare samples into common ones. Only 6% of unconditional samples have the requested end-to-end distance, and 18% are compact; rejection sampling would keep that few. Guidance satisfies the distance in 100% of samples and compactness in 98%. The price is validity, 89% → 55–60%: the constraint pulls the chain toward conformations the model finds unlikely.
  • Conditioners compose. All three on one unconditional model with no retraining satisfied everything (symmetry error 0.003, distance 100%, compact 100%), with 41% valid chains. Costs add up: each extra constraint removes validity and diversity (1.18 → 0.60).
  • Guidance strength has a sweet spot, and a weak setting is the worst of both worlds.
    • At scale 0.05 only 19% of samples meet the target, yet validity falls to 18%: the nudge disturbs the chains without committing them to a conformation that satisfies it.
    • At 0.3 both the constraint (100%) and validity (60%) peak.
    • At 3.0 the sampler breaks (0% valid).
    • (The compactness energy needed a weight of 50 for the same reason; with 10, it half-acted: 22% compact, 35% valid.)
  • Lower temperature (less fresh noise) moves samples toward high-likelihood conformations, as the slides’ low-temperature sampler does. Validity rises slightly at × 0.8 (92.0%), and at × 0.3 the chains curl up (85% compact) and lose diversity. With this crude knob, very low temperature also lowers validity (84%). The slides’ hybrid sampler re-equilibrates with Langevin steps for that reason.

6. Summary

  1. Likelihood estimation. A generative model fitted to a family of related sequences predicts the effects of changes with no labels.
    • On the toy, the Potts model’s likelihood ratios ranked exact effects with Spearman 0.99, vs 0.55 for independent sites.
    • With 30 sequences, the strongest regularization was best (0.72) and the weakest worse than independent sites (0.44). The Transformer needed thousands of sequences (0.19 → 0.95).
    • Pairwise models also predicted epistasis (0.93).
  2. Amortizing intractable inference. Dynamics cross barriers slowly (66% of the way to equilibrium after 40,000 steps).
    • A flow trained by reverse KL alone collapsed onto one well, with a misleadingly high ESS and log⁡Z\log Z low by 0.13.
    • Trained on biased simulations alone it needed reweighting from ~200 effective samples.
    • Trained on both, it gave the exact population (0.872) and log⁡Z\log Z (1.05) after reweighting.
  3. Symmetry. An equivariant network respects rotations to 10−710^{-7} and generalizes to orientations it never saw; an MLP’s loss rose 56% on unseen ones. For chains, noise correlated along the chain kept neighbours together during the forward process and raised valid samples from 47% to 79% for the same MLP. The EGNN reached 90% (89% from 1,000 chains).
  4. Programmable generation. Conditioners as state transformations (a symmetry projection: exact, free) and energy adjustments (distance, compactness: rare → 98–100%) composed on one unconditional model without retraining. Each costs validity and diversity; guidance has a sweet spot, and lower temperature trades diversity for likelihood.

7. Common pitfalls

  1. Reading a likelihood ratio as a measured effect. It predicts rankings inherited from the data’s history. Our toy’s “effects” are defined as exact log-probability ratios, which real effects are not.
  2. Unregularized pairwise models on few sequences. With 30 sequences the weakest penalty ranked worse than independent sites.
  3. Trusting the ESS of a reverse-KL sampler. A flow that misses a mode has uniform weights on the mode it found: a high ESS and a wrong answer. Check against simulations, or train with data from every known state.
  4. A non-equivariant network on structures. It must learn every orientation from data and fails on unseen ones. Centering data also hides translations from it (error 1.8 for a shifted input).
  5. Frame-dependent conditioners. An energy written in absolute coordinates breaks the symmetry the model respects. Use distances, the center of mass, and similar quantities.
  6. Over-strong guidance. Constraints are met at the cost of validity, and large scales diverge. Composing many constraints compounds the cost.

8. Exercises

Exercise 1 (likelihood ratios without the partition function — derivation). For a Potts model, show that log⁡p(v)−log⁡p(s)\log p(v) - \log p(s) for a single change at position ii (from aa to bb) is hi(b)−hi(a)+∑j≠i[Jij(b,sj)−Jij(a,sj)]h_i(b) - h_i(a) + \sum_{j \ne i}[J_{ij}(b, s_j) - J_{ij}(a, s_j)], so ZZ cancels. Why does a double change at i,ji, j add the term Jij(b,b′)−Jij(a,b′)−Jij(b,a′)+Jij(a,a′)J_{ij}(b, b') - J_{ij}(a, b') - J_{ij}(b, a') + J_{ij}(a, a'), the epistasis?

Answer

Single change. log⁡p=∑khk(xk)+∑k<lJkl(xk,xl)−log⁡Z\log p = \sum_k h_k(x_k) + \sum_{k<l} J_{kl}(x_k, x_l) - \log Z. Changing xix_i alters only hih_i and the pairs that contain ii; log⁡Z\log Z is the same for every sequence.

Double change. Changing ii (a → b) and jj (a’ → b’) changes all terms with ii or jj. Subtracting the two single effects (each computed with the other position at its reference value) leaves exactly the pair term between ii and jj: Jij(b,b′)−Jij(b,a′)−Jij(a,b′)+Jij(a,a′),J_{ij}(b, b') - J_{ij}(b, a') - J_{ij}(a, b') + J_{ij}(a, a'), the non-additivity. A site-independent model has no JJ, hence no epistasis.

Exercise 2 (reverse KL is mode-seeking — derivation). Show that Eq[log⁡q+u]=KL(q ∥ p)−log⁡Z\mathbb{E}_q[\log q + u] = \mathrm{KL}(q \,\|\, p) - \log Z. Explain why placing all of qq‘s mass in the deeper of two wells costs only −log⁡P(that well)-\log P(\text{that well}) nats of KL.

Answer

The identity. log⁡p=−u−log⁡Z\log p = -u - \log Z, so KL(q ∥ p)=Eq[log⁡q+u]+log⁡Z\mathrm{KL}(q \,\|\, p) = \mathbb{E}_q[\log q + u] + \log Z.

One well. If q=p(⋅∣well A)q = p(\cdot \mid \text{well } A) exactly, then KL=Eq[log⁡p(x∣A)p(x)]=−log⁡P(A).\mathrm{KL} = \mathbb{E}_q\Big[\log \tfrac{p(\mathbf{x} \mid A)}{p(\mathbf{x})}\Big] = -\log P(A). For the right well, −log⁡0.872=0.137-\log 0.872 = 0.137 nats, a small price. The flow’s reported log⁡Z\log Z was 0.915–0.928 instead of 1.053: low by about 0.13.

KL(q ∥ p)(q \,\|\, p) punishes qq for putting mass where pp has none, not for missing mass where pp has some. Covering both wells requires transporting mass through the low-density barrier, which the optimization rarely discovers.

Exercise 3 (EGNN equivariance — derivation). Show that the update xi′=xi+∑j(xi−xj) ϕ(mij)\mathbf{x}_i' = \mathbf{x}_i + \sum_j (\mathbf{x}_i - \mathbf{x}_j)\,\phi(m_{ij}), with mijm_{ij} a function of ∥xi−xj∥2\lVert\mathbf{x}_i - \mathbf{x}_j\rVert^2 and invariant features, satisfies x′(Rx+t)=R x′(x)+t\mathbf{x}'(R\mathbf{x} + \mathbf{t}) = R\,\mathbf{x}'(\mathbf{x}) + \mathbf{t}.

Answer

Distances are unchanged by RR and t\mathbf{t}, so the messages mijm_{ij} and the weights ϕ(mij)\phi(m_{ij}) are unchanged. Relative vectors transform as (Rxi+t)−(Rxj+t)=R(xi−xj).(R\mathbf{x}_i + \mathbf{t}) - (R\mathbf{x}_j + \mathbf{t}) = R(\mathbf{x}_i - \mathbf{x}_j). Hence xi′↦Rxi+t+∑jR(xi−xj)ϕ(mij)=Rxi′+t.\mathbf{x}_i' \mapsto R\mathbf{x}_i + \mathbf{t} + \sum_j R(\mathbf{x}_i - \mathbf{x}_j)\phi(m_{ij}) = R\mathbf{x}_i' + \mathbf{t}. The predicted noise xfinal−x\mathbf{x}^{\text{final}} - \mathbf{x} is then rotated by RR and unaffected by t\mathbf{t}. Script 03 measured 10−710^{-7}.

Exercise 4 (chain noise — derivation). In 2-D, with a unit bond scaled by α\alpha and noise of standard deviation σ\sigma per coordinate, show that the mean squared distance between neighbours is α2+4σ2\alpha^2 + 4\sigma^2 with isotropic noise on the points and α2+2σ2\alpha^2 + 2\sigma^2 with noise on the bond vectors. Compare with script 03’s table.

Answer

Isotropic noise. The neighbour difference is αb+σ(ϵi+1−ϵi)\alpha \mathbf{b} + \sigma(\boldsymbol\epsilon_{i+1} - \boldsymbol\epsilon_i). The noise difference has variance 2σ22\sigma^2 per coordinate, so the mean squared distance is α2+4σ2\alpha^2 + 4\sigma^2 in 2-D.

Bond noise. The bond vector is αb+σϵ\alpha\mathbf{b} + \sigma\boldsymbol\epsilon, so the mean squared distance is α2+2σ2\alpha^2 + 2\sigma^2.

Comparison at t=0.5t = 0.5 (α=σ=0.71\alpha = \sigma = 0.71): the root-mean-square values are 0.5+2=1.58\sqrt{0.5 + 2} = 1.58 and 0.5+1=1.22\sqrt{0.5 + 1} = 1.22. The measured means, 1.42 and 1.10, are a little lower, because the mean of a distance is below its root mean square (and centering the isotropic noise lowers its variance slightly). Chain noise halves the extra spread.

Exercise 5 (coding). In script 04, condition on end-to-end distance 1.5 at guidance scale 0.3 with noise × 0.6. Does lower temperature recover the validity lost to guidance?

Answer

(Run it.) Part 4 showed that lower temperature raises validity slightly (89% → 92% at × 0.6–0.8) and Part 3 that this guidance costs about 30 points. Expect a partial recovery, at a further cost in diversity.


9. Further reading

From the slides

  • T. Hopf, J. Ingraham et al. Mutation Effects Predicted from Sequence Co-variation, Nature Biotechnology 2017; A. Riesselman, J. Ingraham, D. Marks. Deep generative models of genetic variation capture the effects of mutations, Nature Methods 2018.
  • F. Noé, S. Olsson, J. Köhler, H. Wu. Boltzmann generators: Sampling equilibrium states of many-body systems with deep learning, Science 2019.
  • J. Ingraham et al. Illuminating protein space with a programmable generative model (Chroma), Nature 2023 — the source of composable conditioners, polymer-structured noise and low-temperature hybrid SDEs. (These notes reproduce only the general methods.)

Added by these notes

  • M. Ekeberg et al. Improved contact prediction in proteins: using pseudolikelihoods to infer Potts models, Physical Review E 2013 (pseudo-likelihood with L2 penalties).
  • V. G. Satorras, E. Hoogeboom, M. Welling. E(n) Equivariant Graph Neural Networks, ICML 2021; E. Hoogeboom et al. Equivariant Diffusion for Molecule Generation in 3D, ICML 2022.
  • M. Bronstein, J. Bruna, T. Cohen, P. Veličković. Geometric Deep Learning, 2021 (symmetry as a design principle).
  • Y. Du et al. Reduce, Reuse, Recycle: Compositional Generation with Energy-Based Diffusion Models and MCMC, ICML 2023 (composing conditioners as energies).

10. Next lecture

Lecture 25, the second guest lecture and the last of the course, is on neural radiance fields: differentiable volume rendering, positional encoding, NeRF itself, and how 2-D generative models can make 3-D objects (score distillation).

← 返回课程目录