TL;DR
Researchers at UC Berkeley have developed Discrete Guidance (DG), a principled framework for steering generative models in discrete spaces (like DNA or protein sequences) toward desired properties without retraining. By leveraging the mathematics of continuous-time Markov chains, they turn an exponentially difficult sampling problem into a tractable one, enabling precise control over the generation of small molecules, genetic sequences, and stable proteins.
The Challenge of Discrete State-Spaces
Generative models like Stable Diffusion have revolutionized image and video generation because we can "guide" them—using a classifier or prompt to steer the model toward a specific output (e.g., "make this sunset more vibrant"). In continuous spaces (like pixels), this is done using the score function (the gradient of the log-density).
However, many of the most important problems in science—designing a drug molecule, a DNA enhancer, or a functional protein—exist in discrete state-spaces. You cannot take a "gradient" of a DNA sequence, nor can you be "halfway" between an Adenine and a Cytosine. Because discrete spaces lack a score function, applying guidance has traditionally been a mathematical nightmare. Specifically, calculating the "normalizing constant" required for Bayes' theorem in a discrete space of dimension $D$ with $S$ possible states involves summing over $S^D$ terms—an astronomical number for even short sequences.
Introducing Discrete Guidance (DG)
The authors introduce Discrete Guidance (DG), which sidesteps the score function problem by using Continuous-Time Markov Chains (CTMCs).
The Key Innovation: Continuous Time
The core insight of the paper is that in continuous time, the probability of two different dimensions of a sequence changing at the exact same instant is zero. This means that at any infinitesimal time step, the model only needs to consider transitions where a single character changes. This collapses the complexity of the math from $S^D$ (exponential) to roughly $D \times S$ (linear), making guidance computationally tractable.
Flavors of Guidance
The framework supports two primary modes of guidance:
- Predictor Guidance (PG): Uses a separate "noisy predictor" model to calculate how much a potential jump (e.g., changing one amino acid in a protein) increases the likelihood of a desired property (like binding affinity).
- Predictor-Free Guidance (PFG): Blends a conditional and an unconditional generative model, similar to the "classifier-free guidance" used in popular image generators.
To make sampling even faster, the authors introduced Taylor-Approximated Guidance (TAG). Instead of running the predictor model $D \times S$ times to evaluate every possible single-character change, they use a first-order Taylor expansion to estimate the best direction to move with just one forward and backward pass.
Experimental Validation
The authors evaluated their method across three distinct scientific domains, demonstrating broad applicability:
- Small Molecules: Using a subset of the QMugs dataset (~610,000 drug-like molecules), they guided the model to control the number of rings and lipophilicity (LogP). DG significantly outperformed the previous state-of-the-art (DiGress), achieving a much lower Mean Absolute Error (MAE) and producing more chemically valid SMILES strings.
- DNA Enhancers: On a dataset of 104,000 DNA sequences associated with 81 different cell-type labels, DG matched or exceeded the performance of Dirichlet Flow Matching (DirFM), showing higher target class probabilities across various cell types.
- Proteins (Stability-Guided Inverse Folding): By guiding a flow-matching model with a stability predictor, the authors generated sequences that were both more likely to fold into the correct 3D shape and more stable than those produced by ProteinMPNN, the current industry standard for protein design. On 7 out of 8 test proteins, DG had the highest success rate.
Key Insights and Future Directions
Unlike previous methods that relied on heuristic approximations to "force" continuous guidance onto discrete data, DG provides a theoretically rigorous way to apply Bayes' theorem directly to transition rates. Furthermore, because DG doesn't require retraining the base generative model, a single high-quality unconditional "foundation model" can be repurposed for dozens of different tasks just by swapping out the predictor.
Surprisingly, even though DNA and molecules are discrete, treating the predictor as a continuous function on a simplex and using gradients (TAG) works nearly as well as the "exact" (but slower) discrete calculation.
Limitations: * Predictor Training: Guidance requires a predictor that can handle "noisy" data at various stages of the diffusion process, adding an extra step to the pipeline. * Calibration: If the predictor is overconfident or biased, exact guidance can perform worse than approximate methods, making predictor quality a critical bottleneck. * Theoretical Guarantees: While TAG is faster, it lacks the theoretical guarantees of the exact DG method in very high-dimensional spaces.
While this paper focused on the natural sciences, the framework is theoretically applicable to Natural Language Processing (NLP). Applying Discrete Guidance to large language models (LLMs) for controllable text generation remains a highly promising future direction.
Summary updated