TL;DR
Generative models often produce individually realistic outputs that collectively miss the mark on population-level properties—like a protein generator that designs valid proteins, yet makes almost exclusively alpha-helices instead of a natural mix of structures. This paper introduces kCGM, a finetuning method that steers models to match a target distribution of chosen features without needing differentiable feature extractors or overfitting to tiny datasets. It lets you reshape what a model generates at the macro level while keeping its foundational knowledge intact.
What Problem Does This Paper Address?
Imagine you have a generative model pretrained on millions of generic drug-like molecules, and you want it to design novel antibiotics. You only have 174 known antibiotics as examples.
If you do standard supervised finetuning on those 174 molecules, the model memorizes them, overfits, and starts spitting out chemically invalid gibberish. Plus, standard finetuning forces the model to copy everything about the target molecules, giving you no control over which specific properties (like local substructures vs. overall molecular weight) you actually want to match.
On the other hand, Reinforcement Learning (reward finetuning) maximizes a single score—pushing every sample toward one optimal point rather than matching a diverse, multi-modal population. Prior distribution-matching work (CGM) either only matched feature averages (ignoring the shape and spread of the distribution) or relied on histogram binning, which blows up exponentially past two or three dimensions. Researchers needed a way to say: "Keep generating valid, diverse molecules, just shift their feature distribution to look like this reference set—even if my feature calculator is a non-differentiable black box."
Methods
Enter kernel Calibrating Generative Models (kCGM). Instead of training on full target objects, kCGM only looks at samples of their extracted features.
Here is how the recipe works:
- Maximum Mean Discrepancy (MMD): To measure how far the model's generated feature distribution is from the target distribution, kCGM uses MMD—a kernel-based statistical distance. It simultaneously pulls generated features toward target features and pushes generated samples away from each other to prevent mode collapse. The authors use hyperparameter-free kernels: the energy-distance kernel for continuous features and the Tanimoto kernel for binary molecular fingerprints.
- Score-Function Gradients: Because many scientific feature extractors (like chemical fingerprints or external neural predictors) are non-differentiable black boxes, you can't backpropagate through them. Instead, kCGM uses score-function gradients (akin to REINFORCE), requiring only that you can sample from the model and compute the log-probability of the sampling trajectory.
- Novel Leave-One-Out (LOO) Baseline: Score-function gradients are notoriously noisy. Standard variance-reduction baselines average the rewards of other samples in a batch, which introduces mathematical bias here because MMD couples all samples in a batch together. The authors derive a custom
MMD-LOOcontrol variate that estimates what the batch discrepancy would have been without sample $m$, keeping gradients unbiased while slashing variance. - KL Regularization: A standard Kullback-Leibler (KL) divergence penalty tethers the finetuned model to the pretrained model so it doesn't forget how to generate valid samples.
Datasets
No new datasets were introduced; the authors evaluated kCGM across three distinct biological modalities:
- Small Molecules: Pretrained on GuacaMol (1.3M drug-like molecules from ChEMBL) and calibrated toward a curated set of 174 small-molecule antibiotics.
- Protein Structures: Evaluated against diverse structural domain proportions from CATH (100-residue domains).
- Regulatory DNA: Trained and evaluated on DeepMEL2, containing 500-base-pair human melanoma enhancer sequences annotated across 47 cis-regulatory cell-state topics.
Key Insights and Ideas
- Means aren't enough: If a target distribution looks like a smiley face (see Figure 1), matching the mean just puts all your samples on the nose. Replacing kCGM's kernel with a simple dot-product kernel mathematically reduces it to prior mean-matching work (CGM)—and performance drops sharply, proving full distributional shape matters.
- Implicit validity enforcement: Direct finetuning on 174 antibiotics wrecks the model's chemical grammar because nothing explicitly penalizes invalid outputs. In kCGM, invalid molecular graphs get mapped to a default feature vector, which naturally incurs a heavy MMD penalty, actually improving validity over the pretrained baseline!
- Architecture agnosticism: Because kCGM only cares about trajectory log-probabilities and terminal outputs, the exact same algorithm seamlessly adapts an autoregressive graph model (G2PT), a continuous-space diffusion model (Genie 2), and a discrete masked diffusion model (DNA).
Key Results
Across all tasks, kCGM outperformed both mean-matching (CGM) and direct finetuning across the KL-divergence tradeoff curve:
- Antibiotics: When matching discrete Morgan fingerprints, direct finetuning caused invalid generations to spike to 35%, whereas kCGM lowered distribution error while decreasing the invalid fraction and maintaining >98% uniqueness. Matching local fingerprints even transferred positively to unseen features like molecular scaffolds.
- Proteins: Genie 2 naturally generates almost exclusively alpha-helices (symmetric KL of 2.27 to CATH). kCGM shifted it to a realistic mix of helices and beta-strands, cutting distribution error to 0.26—roughly 2x lower error than CGM's 2D binning approach.
- DNA: Using the black-box AlphaGenome predictor to measure chromatin accessibility, kCGM successfully calibrated under-active pretrained generators to match target cell-type activity profiles across most of the 47 topics, validated by an independent predictor (CATlas).
- Variance Reduction: Adding the custom
MMD-LOObaseline more than doubled the gradient signal-to-noise ratio.
Limitations and Future Work
- Curse of dimensionality: Statistically, MMD loses power polynomially as feature dimensions grow very large (though kCGM still handled 512-dimensional embeddings well in practice).
- Tractable likelihoods required: Because kCGM needs exact sampling-trajectory log-probabilities, it cannot be applied out-of-the-box to deterministic ODE samplers like standard flow matching models.
- Future horizon: So far, target features were extracted from complete reference objects. The authors envision using kCGM as an interface for partial, indirect experimental measurements—calibrating models directly against cryo-EM, chemical RNA probing, or proteomics data where full ground-truth structures don't exist.
Summary updated