betaFeedback

WorksComputer Science

Learning Graph Energies for Finite-Time Generation

Abstract

Energy-based models can represent distributions over discrete structures such as molecular graphs, but an energy that is accurate at equilibrium need not yield accurate samples when the sampler stops after a fixed number of steps. We introduce finite-horizon energy learning, which adapts the acceptance energy of a Metropolis–Hastings sampler to the distribution it returns after a prescribed number of steps, with initialization, proposals, and annealing schedule held fixed. For graph generation, a frozen pretrained model supplies initialization and proposals, and a learned energy governs acceptance. A training-only discriminator scores completed samples, and coupled continuations of the accepted and rejected branches of a proposal give an acceptance-gradient estimator that is unbiased for a fixed discriminator under stated conditions, without equilibrated negative samples or differentiation through discrete states. Generation uses the learned energy in the original single-trajectory sampler, without discriminator evaluations or reranking. On twelve pairwise binary targets with exactly evaluated terminal laws, learned energies have lower median terminal total variation than the equilibrium-correct energy in every tested short-horizon setting, and than its numerically tuned scalar multiple in most settings. On MOSES, a learned two-coefficient combination of pretrained Graph Energy Matching (GEM) potentials lowers FCD by 3.7–10.5% relative to scale-calibrated GEM at matched sampling steps, with validity gains at the shortest budget and a sub-point validity trade-off at higher budgets.

Introduction

For a generator stopped after KK transitions, sampling accuracy is determined by its terminal distribution, not by its equilibrium law. The terminal distribution depends on initialization, proposals, acceptance decisions, and the annealing schedule. Consequently, even an energy that represents the target exactly at equilibrium need not minimize error after a finite run. Prior work on short-run energy-based models establishes the importance of this distinction [16, 1].

We study whether terminal sample feedback can improve finite-run accuracy by changing the acceptance energy alone, while retaining the initialization, proposal kernel, and schedule. A two-state chain illustrates why this can help (Appendix B.3). Let the target be uniform on {a,b}\{a,b\}, start the chain at aa, and propose a flip with probability 3/43/4. At inverse temperature one, the correct energy accepts every flip and returns bb with probability 3/43/4 after one step. Raising the energy of bb by log⁡(3/2)\log(3/2) lowers the acceptance probability to 2/32/3, making the one-step output exactly uniform but moving the equilibrium probability of bb to 2/52/5.

We introduce finite-horizon energy learning.1 which optimizes the acceptance energy using discriminator rewards on completed KK-step samples. For pretrained graph generators such as Graph Energy Matching [5], which refines graphs with Metropolis–Hastings (MH) steps using gradient-informed proposals from a learned potential [27], this separates the frozen potential used for initialization from the energy adapted for acceptance. An acceptance decision changes the state from which subsequent proposals are drawn, so its effect must be assessed through the remaining trajectory.

Following the coupled MH derivative of Arya et al. [4, 3], we continue both the accepted and rejected branches of a selected decision to the terminal horizon using shared random numbers. Their terminal-reward difference weights the derivative of the local acceptance probability. The discriminator and additional continuations are used only during training; generation uses the learned acceptance energy in a single trajectory (Figure 1).

Finite-horizon energy learning for a pretrained GEM graph sampler

Figure 1. Finite-horizon energy learning for a pretrained GEM graph sampler. Generation (top): one KK-step MH trajectory whose initialization and proposals use GEM’s frozen potential VGV_G; only the acceptance energy EθE_\theta, with coefficients θ=(c,ω)\theta=(c,\omega) in (6), is learned. Training (dashed; absent at generation): at a selected decision tt, the accepted and rejected branches are continued to step KK with shared future random numbers, and the difference of their terminal rewards weights ∇θαθ,t\nabla_\theta\alpha_{\theta,t}. The displayed update is (5) with selection indicators IitI_{it} and inclusion probabilities pitp_{it}; NN is the number of base chains.

The finite-state study isolates acceptance-energy adaptation from density misspecification by comparing against a target energy that is already correct at equilibrium, and against a numerically tuned scalar multiple of that energy. The molecular study then applies the same terminal-reward objective to a two-coefficient combination of frozen GEM potentials on MOSES [18]. Our contributions are:

  • Finite-horizon optimization of acceptance energies. We formulate learning through the MH acceptance energy to maximize expected terminal discriminator reward, with initialization, the proposal kernel, and the annealing schedule fixed. Applying established coupled MH derivatives to subsampled accept/reject continuations gives an unbiased gradient estimator for a fixed discriminator under the conditions in § 3.3.

  • Exact finite-state evidence beyond scalar tempering. At K∈{4,8,16}K \in\{4, 8, 16\}, learned energies achieve lower mean terminal total variation (TV) than the equilibrium-correct energy in all 18 reference and all 18 new-target settings. They also outperform its numerically tuned scalar multiple in 14 and 15 settings, respectively. These comparisons identify finite-horizon improvements beyond the reported scalar-temperature control in most settings (§ 4).

  • Adaptation of frozen graph potentials. On MOSES, a two-coefficient acceptance energy combining pretrained GEM potentials reduces Fréchet ChemNet distance (FCD) by 3.7–10.5% relative to scale-calibrated GEM with exact MH acceptance at matched refinement steps, with budget-dependent validity trade-offs. Generation retains a single trajectory and requires neither discriminator evaluations nor additional continuations (§ 5).

Related Work

Training energies with finite-run samplers. Short-run EBMs treat a fixed number of MCMC steps as part of the generator [16, 1], and contrastive divergence and GEM’s contrastive refinement raise energy on generated negatives held fixed during differentiation [10, 5]. These methods learn the energy, and with it the sampler’s target, from short-run negatives. We instead fix a pretrained sampler’s initialization and proposals and learn only its acceptance energy, for an objective defined on the KK-step output.

Adapting proposals and transition dynamics. ALOE and EB-GFN learn discrete energies jointly with amortized samplers [8, 26], A-NICE-MC trains MCMC proposals adversarially [22], and reinforcement learning adapts MCMC kernels [24]. For graphs, DeFoG separates the trained denoiser from the choice of sampling dynamics [20]. These approaches change how states are proposed or how the sampler moves; we keep the proposal kernel and schedule fixed and change only the acceptance energy.

Differentiating through discrete randomness. Coupled stochastic derivatives differentiate programs with discrete random choices [2], and Arya et al. [4, 3] specialize them to MH by coupling accepted and rejected continuations. We apply this estimator to a terminal discriminator reward, subsample decisions with inverse inclusion probabilities [11], and compare it with a score-function estimator in § 4.

Graph generation and reward adaptation. Discrete diffusion and flow models generate graphs by learned denoising [23, 7, 21], whereas GEM samples from a learned potential with MH refinement. Reward fine-tuning methods such as GDPO, DRAKES, and Graph-GRPO update the denoiser or flow network [15, 25, 28], and TFG-Flow and clean-sample Markov chains apply a reward or conditioning signal during sampling [14, 17]. Here the pretrained networks stay fixed; only the acceptance energy changes, contrasting a model with a weaker version of itself as in autoguidance [13].

Finite-Horizon Energy Learning

Sampler and Terminal Law

Let pp be the data distribution on a finite discrete state space X\mathcal{X}; for graphs, a state assigns a categorical label to every node and node pair, including a no-edge category. Starting from X0∼q0X_0 \sim q_0, at steps t=0,…,K−1t = 0, \ldots, K - 1 the sampler proposes Yt∼Qt(⋅∣Xt)Y_t \sim Q_t(\cdot\mid X_t) and accepts it with the MH probability

αθ,t(x,y)=min⁡{1,e−βt[Eθ(y)−Eθ(x)]Qt(x∣y)Qt(y∣x)}.(1)\alpha_{\theta,t}(x,y)=\min\left\{1,e^{-\beta_t[E_\theta(y)-E_\theta(x)]}\frac{Q_t(x\mid y)}{Q_t(y\mid x)}\right\}. \tag*{(1)}

rejection leaves the state unchanged. Writing Pθ,tP_{\theta,t} for the resulting transition kernel, the terminal law after KK steps is

qθ,K=q0Pθ,0Pθ,1⋯Pθ,K−1.(2)q_{\theta,K}=q_0P_{\theta,0}P_{\theta,1}\cdots P_{\theta,K-1}. \tag*{(2)}

The initialization q0q_0, the proposal kernel QtQ_t, and the inverse-temperature schedule βt\beta_t do not depend on θ\theta, which enters only through the acceptance energy EθE_\theta. A fixed proposal kernel does not imply identical realized proposals: once two runs make different decisions, later proposals start from different states. The annealed kernels need not share a common invariant distribution; our objective is defined on the terminal law qθ,Kq_{\theta,K}, not on the equilibrium density ∝e−βEθ\propto e^{-\beta E_\theta} at a fixed temperature.

Fixed-Discriminator Objective

A discriminator with logit dψ(x)d_\psi(x) is trained to distinguish data from samples of qθ,Kq_{\theta,K}. With σ\sigma the logistic function and terminal reward rψ(x)=log⁡σ(dψ(x))r_\psi(x)=\log\sigma(d_\psi(x)), each energy update ascends the non-saturating generator objective [9]

J(θ;ψ)=EXK∼qθ,K[rψ(XK)](3)J(\theta;\psi)=\mathbb{E}_{X_K\sim q_{\theta,K}}[r_\psi(X_K)] \tag*{(3)}

with ψ\psi held fixed, and the discriminator is refitted between updates. If the discriminator is the optimal unrestricted classifier for the balanced, unweighted population problem, held fixed at the current generator, and p>0p>0 wherever qθ,K>0q_{\theta,K}>0, then −∇θJ-\nabla_\theta J is the gradient of a divergence between qθ,Kq_{\theta,K} and pp (Appendix B), which § 4 uses as a numerical reference. The weighted, finitely trained molecular discriminator need not satisfy these conditions; the estimator below holds for any fixed discriminator.

Exact likelihood training of an energy takes its negative-phase expectation under the equilibrium model distribution. GEM’s contrastive term instead raises energy on generated negatives held fixed during differentiation [5 Section 3.4 and Appendix I]; with short-chain negatives, such a detached update need not equal the exact likelihood gradient [10] (Argoritsas et al. 2023). Even exact likelihood training targets the equilibrium law: with population data and an energy family that contains the target, its optimum is the equilibrium-correct energy, which need not be the best acceptance energy for a KK-step run. (3) instead scores the returned samples.

Gradient Estimation with Paired Continuations

Continuation values. Let Vt+1(s)=E[rψ(XK)∣Xt+1=s]V_{t+1}(s)=\mathbb{E}[r_\psi(X_K)\mid X_{t+1}=s] be the expected terminal reward of a chain that is in state ss after step tt and continues under the current energy and the remaining schedule. Because q0q_0 and QtQ_t do not depend on θ\theta, the product rule applied to (2) gives [4, 3]

∇θJ=∑t=0K−1E[ΔVt+1∇θαθ,t(Xt,Yt)].(4)\nabla_\theta J=\sum_{t=0}^{K-1}\mathbb{E}\left[\Delta V_{t+1}\nabla_\theta\alpha_{\theta,t}(X_t,Y_t)\right]. \tag*{(4)}

where ΔVt+1=Vt+1(Yt)−Vt+1(Xt)\Delta V_{t+1}=V_{t+1}(Y_t)-V_{t+1}(X_t) and (Xt,Yt)(X_t,Y_t) are the state and proposal of a chain run with the current energy (Appendix A.1). Each term differentiates only the local acceptance probability; the effect of the decision on later steps enters through ΔVt+1\Delta V_{t+1}, whose sign indicates whether accepting or rejecting yields the higher expected terminal reward.

Paired continuations. The two possible next states are Xt+1+=YtX^+_{t+1}=Y_t and Xt+1−=XtX^-_{t+1}=X_t. Continuing each to step KK gives rewards R±=rψ(XK±)R^\pm=r_\psi(X^\pm_K), and E[R+−R−∣Xt,Yt]=ΔVt+1\mathbb{E}[R^+-R^- \mid X_t,Y_t]=\Delta V_{t+1} whenever each branch follows the correct transition law. Both continuations use the same future random numbers, mapped through their own proposal distributions; this coupling changes only the joint law of the branches and can reduce the variance of R+−R−R^+-R^-. One branch coincides with the base trajectory, so only the other is simulated. Branches that reach the same state with the same carried sampler quantities agree from then on and can be merged.

Subsampled decisions. To limit simulation, we select a subset SS of decisions from NN base chains, including step tt of chain ii with probability pitp_{it}, and use

g^=1N∑(i,t)∈SRit+−Rit−pit∇θαθ,t(Xit,Yit).(5)\widehat{g}=\frac{1}{N}\sum_{(i,t)\in S}\frac{R^+_{it}-R^-_{it}}{p_{it}}\nabla_\theta\alpha_{\theta,t}(X_{it},Y_{it}). \tag*{(5)}

For a fixed discriminator, g^\widehat{g} is unbiased for (4) if (i) the acceptance probabilities are differentiable at the sampled decisions, (ii) both continuations follow the correct law, (iii) pit>0p_{it}>0 wherever ∇θαθ,t≠0\nabla_\theta\alpha_{\theta,t}\ne0, and (iv) selection depends only on the chain prefix, the proposal, and quantities fixed before the update, not on continuation randomness. The sum is normalized by NN, not by ∣S∣|S|, and states, rewards, and selection probabilities are held fixed during differentiation. At unsaturated proposals, ∇θαθ,t=−βtαθ,t∇θ[Eθ(Yt)−Eθ(Xt)]\nabla_\theta\alpha_{\theta,t}=-\beta_t\alpha_{\theta,t}\nabla_\theta[E_\theta(Y_t)-E_\theta(X_t)], and strictly saturated proposals have zero derivative. At an MH tie, where the acceptance ratio equals one while its derivative is nonzero, αθ,t\alpha_{\theta,t} is not differentiable; the implementation uses zero there, and the unbiasedness statement excludes such points. The statement also does not extend to clipping, coordinate constraints, adaptive optimization, discriminator refitting, or convergence of the alternating procedure (Appendix A.1).

Training and Generation

Algorithm 1 starts from an initial energy and a discriminator fitted to data and initial generated samples, and alternates one ascent step Update⁡(θ,g^)\operatorname{Update}(\theta,\widehat{g}) with discriminator refitting. The exact-state experiments select one uniformly random decision per chain; molecular training selects about four per chain, with inclusion probabilities increasing with the acceptance-gradient magnitude, scaled using the preceding update (Appendix A). Both studies report the final iterate, without test-based checkpoint selection; Appendix A.4 bounds the transitions simulated per update. At generation time, the learned energy replaces the original acceptance energy in the same KK-step sampler, without the discriminator or continuations; the per-step cost can still depend on the energy (Section 5).

Exact Finite-State Study

We first ask whether an energy that is exact at equilibrium can be improved for a short run, and whether a scalar temperature change explains the improvement. Small state spaces allow exact terminal laws, while learning uses sampled trajectories.

Targets, Sampler, and Comparisons

Targets are synthetic pairwise binary models p∝e−Hp\propto e^{-H} on L=6L=6 or L=8L=8 spins (64 or 256 configurations) with random fields and couplings (Appendix B). For each L∈{6,8}L\in\{6,8\}, the reference set contains three independently drawn target distributions, and the new-target set contains three further draws. Each target is specified by a fixed set of unary fields and pairwise couplings, held constant across horizons and training seeds. We use identifiers such as Ref-6-1 and New-8-3 to specify the target set, the spin count, and instance index. The index identifies a distribution, not a training seed. Training is repeated from scratch on each new target; no fitted energy is transferred between targets. The sampler starts from the product of the target’s one-variable marginals, proposes a flip of one uniformly chosen spin, and raises the inverse temperature from 0.2 to 1 over the first half of the run before holding it fixed. Every compared energy uses this sampler at a given horizon; unlike GEM’s fixed-length ramp, the schedule scales with KK. We compare:

  • Restricted energy: unary and ring interactions, fitted by population maximum likelihood, scalar-calibrated for TV; learning starts from it.

  • Correct HH: the target energy, recovered by population pseudo-likelihood ([6]), exact at equilibrium.

  • Scalar-tuned βH\beta H: the multiple of HH that minimizes exact terminal TV, an oracle control.

  • Learned, fitted discriminator (ours): all unary and pairwise coefficients (21 for L=6L = 6, 36 for L=8L = 8), a family that contains HH, trained by Algorithm 1 with a discriminator linear in the same features.

  • Learned, oracle discriminator: the same sampled training, with rewards from the exact density ratio between the target and the current generator.

  • Numerical reference: exact-gradient minimization over the learned family of the divergence D(q∥p)=2KL⁡(12(p+q)∥p)D(q\mathbin{\|}p) = 2 \operatorname{KL}\left(\frac{1}{2}(p+q)\mathbin{\|}p\right) of § 3.2; it is not optimized for TV and not certified optimal.

Learned energies use 2,000 updates, N=512N = 512 trajectories per update unless stated otherwise, three training seeds, and the final iterate. The fitted discriminator starts from the exact population logistic fit and is then refitted on target and generated samples; exact marginals and population fits are idealizations of this study. We report total variation, TV⁡(q,p)=12∑x∣q(x)−p(x)∣\operatorname{TV}(q,p) = \frac{1}{2}\sum_x \lvert q(x) - p(x)\rvert, computed exactly, so reported variation comes only from targets and training seeds.

Comparison with the Equilibrium-Correct Energy

At K=4,8,16K = 4, 8, 16, the learned energy has lower median TV than HH in all 18 target–horizon settings of the reference set (Figure 2a, Table 1). A fresh-seed replication on the same targets again improves all 18 settings, with 53 of 54 individual fits better than HH. On the new targets, learning improves all 18 settings and all 54 fits; median TV falls from 0.553 to 0.518, from 0.413 to 0.307, and from 0.240 to 0.069 at K=4,8,16K = 4, 8, 16. Because HH is exact at equilibrium, these gains correct the finite-run law rather than the density. Horizons within a target are dependent, so the counts describe the experiment rather than constitute independent tests.

Comparison with Scalar Tempering

Scalar tempering tests whether rescaling HH explains these gains. Learned energies have lower TV than scalar-tuned βH\beta H in 14 of 18 reference settings, in both the original runs and the replication, and in 15 of 18 new-target settings. The three new-target exceptions all occur on New-8-2, where the scalar-tuned control has lower TV at each tested horizon (Table 4). The control is an oracle, since it uses the target and exact terminal probabilities. Its optimal multiplier is far from one at short horizons: the median over reference targets falls from 9.04 at K=4K = 4 to 2.00 at K=8K = 8 and 1.22 at K=16K = 16 (Figure 2c). This is a target-specific calibration under the horizon-scaled schedule, not a general law relating temperature to budget.

Figure 2. Finite-time sampling on the reference targets (original runs). (a) Exact terminal total variation (TV) against the number of steps KK; each learned point is an energy trained separately for that horizon with N=512N = 512 trajectories per update. Curves are medians over six targets after aggregating training seeds. (b) Recovery (%) of the numerical reference’s improvement over the restricted energy, for learning with a fitted or an oracle discriminator, against trajectories per update NN; 100% is not an upper bound. (c) TV-minimizing multiplier β∗\beta^* of E=βHE = \beta H under the shared annealing schedule, for individual targets (thin) and their median (thick); the dashed line marks β=1\beta= 1. Shading shows interquartile ranges, not confidence intervals. Horizontal axes are logarithmic, as is the vertical axis in (c).

Target IDKKCorrect HHTuned βH\beta HLearned medianSeed SD
Reference targets: fresh-seed replication
Ref-6-140.12660.06130.05290.005
Ref-6-180.08450.02840.02750.004
Ref-6-1160.05930.02790.02080.004
Ref-6-240.34350.23190.22840.001
Ref-6-280.23890.12470.08050.009
Ref-6-2160.12340.05240.03590.005
Ref-6-340.39990.31260.3045<0.001< 0.001
Ref-6-380.23260.10410.08100.024
Ref-6-3160.08380.02420.07590.007
Ref-8-140.26720.18030.15340.002
Ref-8-180.15490.09170.04350.003
Ref-8-1160.09350.06330.02470.004
Ref-8-240.31420.22350.2095<0.001< 0.001
Ref-8-280.16860.09140.04960.003
Ref-8-2160.06120.03690.03180.011
Ref-8-340.37010.18070.1844<0.001< 0.001
Ref-8-380.30120.09390.1174<0.001< 0.001
Ref-8-3160.21980.06360.09230.007
New targets: separately trained
New-6-140.68150.61490.6106<0.001< 0.001
New-6-180.49600.36930.34590.002
New-6-1160.25720.11320.07460.008
New-6-240.16570.07620.04340.002
New-6-280.09770.04690.03380.002
New-6-2160.06580.04480.01600.005
New-6-340.43130.31930.29960.002
New-6-380.28940.16120.12410.005
New-6-3160.14160.04320.03190.002
New-8-140.51730.47150.4711<0.001< 0.001
New-8-180.36510.31720.2677<0.001< 0.001
New-8-1160.22240.18980.06430.002
New-8-240.58860.51160.56550.002
New-8-280.46010.33070.40970.002
New-8-2160.28560.11800.25530.002
New-8-340.61750.58300.5716<0.001< 0.001
New-8-380.48780.41230.36640.003
New-8-3160.30190.18520.09680.002

Table 4. Exact terminal total variation by target distribution and sampling horizon; lower is better. Each target is a synthetic pairwise binary model with random fields and couplings (Appendix § 10.§ 1); no external dataset is used. Target IDs specify the set (Ref or New), number of spins (6 or 8), and instance index (1–3). Each instance has fixed fields and couplings; its three rows evaluate the same target at horizons K=4,8,16K = 4, 8, 16, the number of MH transitions. The controls are the equilibrium-correct energy HH and its numerically tuned scalar multiple βH\beta H; because HH is exact at equilibrium, lower TV than HH reflects a finite-horizon improvement. Learned columns report the median and sample standard deviation of terminal TV across three training seeds; TV itself is evaluated exactly, so the SD reflects only variation across training seeds. The reference block repeats training with fresh seeds on the original targets, whereas the new-target block trains from scratch on independently drawn target distributions to test whether the gains recur; no trained energy is transferred. Table 1 and Figure 2 use the original reference-target runs. All learned runs use N=512N = 512 and 2,000 updates. Bold identifies the lowest of the three TV values using unrounded results.

Training Budget, Estimators, and Long Horizons

Figure 2b varies the number of training trajectories per update, NN. For each target and horizon, with TV errors ebasee_{\mathrm{base}}, elearnede_{\mathrm{learned}}, and erefe_{\mathrm{ref}} of the restricted, learned, and reference energies, the recovery is 100(ebase−elearned)/(ebase−eref)100(e_{\mathrm{base}} - e_{\mathrm{learned}})/(e_{\mathrm{base}} - e_{\mathrm{ref}}), computed in each of the 42 settings (six targets, seven horizons) before taking medians. Zero means no gain over the restricted energy and 100 means matching the reference; because the restricted family is misspecified, the gain combines density and finite-time corrections. With the fitted discriminator, median recovery rises from 52.4% at N=32N = 32 to 79.4% at 128 and 90.4% at 512, where the median TV gap to the reference is 0.024. With the oracle discriminator, it reaches 96.8% at N=512N = 512. At matched numbers of simulated transitions, a leave-one-out score-function estimator also improves on HH in all 18 short-horizon reference settings; coupling has lower median TV in 12 of them (median difference −0.0015-0.0015) but took 4.66 times the CPU time (Appendix § 9.§ 3). Terminal feedback is thus effective with either estimator, without an efficiency advantage for coupling.

Learning is least effective at long horizons. Each point in Figure 2a is a separately trained energy; beyond K=64K = 64, the learned energies are less accurate than HH, while the numerical reference stays near zero TV. Because the learned family contains both HH and the reference solution, the shortfall arises in sampled training, not in the energy family. Discriminator accuracy, gradient variance over long continuations, and the fixed optimization budget are candidate causes that this study does not separate.

Adapting Pretrained GEM Potentials on MOSES

We next adapt a pretrained graph sampler, changing only the acceptance energy and comparing at matched numbers of refinement steps.

Two-Coefficient Energy and Controlled Comparison

We use the pretrained GEM model [5] on MOSES [18]. Each chain fixes a node count drawn from the training distribution. GEM initializes a random graph with at most 225 greedy edits under its released potential VGV_G; KK refinement steps then use gradient-informed categorical proposals and the released inverse-temperature schedule, which rises from about 0.78 to 17.62 over 500 steps and then stays constant. We retain this initialization, proposal mechanism, and schedule. KK counts refinement steps after initialization, not all edits, network evaluations, or elapsed computation, and runs with K<500K < 500 stop during the ramp. The learned acceptance energy is

Eθ(x)=c[VG(x)+ω{VG(x)−Vpre(x)}],(6)E_{\theta}(x) = c\left[V_G(x) + \omega\{V_G(x) - V_{\mathrm{pre}}(x)\}\right], \tag*{(6)}

where VpreV_{\mathrm{pre}} is GEM’s frozen transport-only predecessor checkpoint, cc sets the energy scale, and ω\omega weights the difference between checkpoints, as in auto guidance [13]. Equation (6) is the learned energy EθE_{\theta} of Figure 1, with θ=(c,ω)\theta= (c,\omega); both potentials stay frozen, and the combination remains invariant to node relabeling. Rewards come from a training-only discriminator, a LoRA-adapted copy of VGV_G with about 9.7 million trainable parameters (Hu et al., 2022).

The baseline at each budget is GEM with exact MH acceptance and an acceptance scale calibrated on development FCD: 0.70 at K=125K = 125, 250 and 0.865 at K=1000K = 1000, with ω=0\omega= 0. Learning starts from this calibrated energy. Exact MH differs from GEM’s released acceptance rule in how proposal retry stages enter the acceptance ratio (Appendix § 11); the released rule is used only to reuse the trained energies without retraining (Table 5). Training uses 80 energy updates with 256 base chains and about four selected decisions per chain. The discriminator is fitted to generated graphs and node-count-matched training molecules, with invalid generated graphs up-weighted, and is refitted after each update (Appendix A). The energy-update objective uses discriminator rewards rather than FCD; development FCD informs baseline calibration and discriminator screening, and it selects the static-coefficient controls in § 5.4.

Table 5: Deployment with GEM’s released acceptance rule. “GEM + learned energy (Ours)” reuses the energies from Table 2 without retraining, with released-rule acceptance replacing exact MH. Metrics and denominators match Table 2: FCD, validity (%), and VUN (%), with 25,000 requested graphs per seed. Entries are means ± sample SD over two prespecified seeds at K=125K = 125 and three elsewhere. Baselines are uncalibrated released GEM at K=125,1000K = 125, 1000 and calibrated GEM at K=250K = 250. Bold marks the better mean within each pair, not statistical significance.

KKMethodFCD ↓\downarrowValidity ↑\uparrowVUN ↑\uparrow
125GEM (released)2.406 ± 0.000393.25 ± 0.0590.99 ± 0.06
GEM + learned energy (Ours)2.295 ± 0.01192.45 ± 0.4490.43 ± 0.44
250GEM (calibrated)1.920 ± 0.01293.48 ± 0.0991.20 ± 0.10
GEM + learned energy (Ours)1.784 ± 0.03395.02 ± 0.4292.97 ± 0.41
1000GEM (released)1.529 ± 0.01398.02 ± 0.0394.02 ± 0.22
GEM + learned energy (Ours)1.487 ± 0.02297.95 ± 0.0894.21 ± 0.11

Table 5.

Metrics and Decision Rule

We report Fréchet ChemNet distance (FCD) [19], validity, and VUN. FCD compares the means and covariances of ChemNet features of generated molecules with those of the MOSES scaffold-test reference of 176,225 molecules, using the canonical largest fragment of each valid output and retaining duplicates. Validity is the percentage of requested graphs that decode and sanitize; following GEM’s convention, a disconnected but sanitizable molecule counts as valid. VUN is the percentage of requested graphs that are valid, unique, and absent from the training set. Failed outputs are retained, so both rates use all requested graphs as denominators. Development FCD instead uses a fixed reference of 16,010 molecules selected deterministically from the MOSES training data, with 2,048 generated graphs per candidate from a generation stream separate from the final evaluation; this split does not imply that these molecules were excluded from the pretraining data of the released GEM checkpoints. Because encoding and processing choices affect the scores, they are compared within this implementation, not with published leaderboard values.

Each comparison uses three seeds with 25,000 requested graphs each; both methods share the generation seed paired with each training seed, as well as the initialization, proposals, schedule, decoder, and evaluator, and seed-level differences are the units of replication. An internally prespecified joint rule requires lower FCD in a one-sided paired tt test at level 0.05 and one-sided 95% lower confidence bounds above −1-1 percentage point for the validity and VUN differences. The exact-MH comparison at K=250K=250 was the original primary comparison; the other budgets and the released-rule analysis followed it, and no multiplicity adjustment is applied (Appendix C). Matched steps are not matched compute: at K=250K=250, generation took 0.932 H100 GPU-seconds per requested graph with the learned energy versus 0.859 for calibrated GEM.

Results

The learned energy lowers FCD in every paired seed at all three budgets (Table 2, Figure 3); relative changes use unrounded seed means. At K=125K=125, all three metrics improve: FCD decreases by 5.7% (2.508 to 2.366), validity rises by 5.42 points, and VUN by 5.29 points; these yield gains are relative to a baseline scale selected for FCD and partly reflect that choice. At K=250K=250, FCD decreases by 10.5% (2.044 to 1.829), while mean validity and VUN decrease by 0.78 and 0.32 points. The mean validity decrease was below one percentage point, but its one-sided lower confidence bound (−1.25-1.25 points) crossed the prespecified margin; non-inferiority was therefore not established, and this original primary comparison does not meet the joint criterion. At K=1000K=1000, FCD decreases by 3.7% (1.561 to 1.504), validity and VUN change by −0.02-0.02 and +0.15+0.15 points. The joint criterion is met at K=125K=125 and 1000.

KKMethodFCD ↓\downarrowValidity ↑\uparrowVUN ↑\uparrow
125GEM (calibrated)2.508 ±\pm 0.02687.13 ±\pm 0.1485.15 ±\pm 0.09
GEM + learned energy (Ours)2.366 ±\pm 0.06392.55 ±\pm 0.2490.44 ±\pm 0.25
250GEM (calibrated)2.044 ±\pm 0.03095.43 ±\pm 0.1092.76 ±\pm 0.05
GEM + learned energy (Ours)1.829 ±\pm 0.02194.65 ±\pm 0.3392.45 ±\pm 0.29
1000GEM (calibrated)1.561 ±\pm 0.01897.84 ±\pm 0.1493.77 ±\pm 0.12
GEM + learned energy (Ours)1.504 ±\pm 0.01897.82 ±\pm 0.0393.92 ±\pm 0.09

Table 2. GEM with and without finite-horizon energy learning at matched refinement steps KK, with exact MH acceptance. Mean ±\pm sample SD over three paired seeds, each with 25,000 requested graphs; validity and VUN are % of requested graphs. Bold marks the better mean in each pair, not significance.

Figure 3. FCD–validity changes at matched budgets. Circles: calibrated GEM; squares: GEM with the learned energy (both exact MH); arrows join matched-budget pairs. FCD decreases at every budget, whereas validity rises at K=125K = 125, falls at K=250K = 250, and is nearly unchanged at K=1000K = 1000. Bars show one sample SD over three seeds; each budget has its own calibrated baseline and trained coefficients.

The K=125K=125 yield gains persist under strict scoring that requires connected molecules and passes stricter representation checks (validity +4.77, VUN +4.65 points), and equalizing the number of valid molecules entering FCD changes the paired difference only from −0.142-0.142 to −0.138-0.138. These checks reuse the generated samples and address evaluation sensitivity, not the effect of encoding mismatches in the discriminator’s training pool. Reusing the learned energies without retraining under GEM’s released acceptance rule again lowers FCD at all budgets. The joint criterion holds at K=250K = 250 and 10001000 but not at K=125K = 125, which used two prespecified seeds and an uncalibrated released-GEM baseline (Table 5); these reuse analyses are not independent replications.

Same-Family Controls and Protocol Conditions

The baseline calibrates one coefficient while learning adjusts two, so Table 2 does not separate the effect of gradient-based learning from that of a second coefficient. Static two-coefficient settings selected on development FCD reach FCD 2.280 at K=125K = 125 (learned: 2.366), with lower validity (91.10% versus 92.55%); this FCD difference is unresolved with three seeds. At K=250K = 250, the static setting reaches 1.811 (learned: 1.829) but fails its development validity threshold. Finite-difference training under a different optimization schedule reaches exact-rule FCD 1.821. These controls use different selection and optimization budgets and compute costs, and there is no corresponding three-seed static evaluation at K=1000K = 1000 (Appendix § 11.§ 4). The reported comparisons do not establish an FCD advantage over coefficient selection or finite-difference training within the same energy family. Lower FCD also does not imply that every molecular property improves: molecular-weight distance worsens at K=1000K = 1000.

Three protocol conditions affect interpretation (Appendix § 11.§ 3). At K=125K = 125, the allowed rate of re-encoding mismatches in the discriminator’s training pool was raised from 1% to 2% before the pool was generated; the pool had 1.65% mismatches, so the original threshold would have stopped the experiment. At K=1000K = 1000, the discriminator passed its development screen only with a revised negative pool. At K=500K = 500, the screen failed and no energy was trained, so that budget is missing, not an evaluated failure.

Discussion and Conclusion

We formulated finite-horizon energy learning to optimize the distribution returned by an MH sampler while retaining its initialization, proposal kernel, and annealing schedule. The finite-state experiments isolate a benefit of this objective: learned energies improve median terminal TV over an equilibrium-correct energy in every tested short-horizon target–horizon setting, and over its numerically tuned scalar multiple in most settings. These gains concern the finite-run distribution rather than correction of an inaccurate equilibrium density.

On MOSES, adapting two coefficients of frozen GEM potentials reduces FCD by 3.7–10.5% relative to scale-calibrated GEM with exact MH acceptance at matched refinement steps. The adapted generator uses a single trajectory without discriminator evaluations or additional continuations. The molecular results do not establish superiority over same-family coefficient selection, and the original K=250K = 250 comparison does not establish validity non-inferiority. Thus, the observed FCD gains should not be interpreted as uniformly improved sample quality or reduced computational cost.

The present procedure trains a separate energy for each horizon, and sampled training falls behind the correct energy at long horizons in the finite-state study. Training across budgets and understanding this long-horizon shortfall remain directions for further work. The results support acceptance-energy learning as a means of adapting finite-run generation while retaining the proposal mechanism.

AI use statement

Generative AI tools were used to assist with drafting portions of the manuscript and revising the text for clarity, organization, consistency checks and readability. The authors take full responsibility for the final manuscript, including its originality, technical claims, reported results, and references.

Learning Graph Energies for Finite-Time Generation: Supplementary Material

Amartya Banerjee; Xingyu Xu; Caroline Moosmüller; Harlin Lee

Appendix A derives the gradient estimator and describes the implementation, Appendix B describes the finite-state experiments, and Appendix C describes the molecular evaluation.

Gradient Derivation and Implementation

Gradient Identity and Estimator

We specialize the coupled MH derivative of Arya et al. [4, 3] to the finite-horizon objective. Fix the discriminator, write r=rψr = r_{\psi} as a column vector over X\mathcal{X}, and abbreviate Pt=Pθ,tP_t = P_{\theta,t} and αt=αθ,t\alpha_t = \alpha_{\theta,t}, so that J=q0P0⋯PK−1rJ = q_0P_0 \cdots P_{K-1}r. Because q0q_0 does not depend on θ\theta, the product rule gives

∇θJ=∑t=0K−1qt(∇θPt)Vt+1,qt=q0P0⋯Pt−1,Vt+1=Pt+1⋯PK−1r,\nabla_{\theta}J = \sum_{t=0}^{K-1} q_t \left(\nabla_{\theta}P_t\right)V_{t+1}, \qquad q_t = q_0P_0 \cdots P_{t-1}, \qquad V_{t+1} = P_{t+1} \cdots P_{K-1}r,

with VK=rV_K = r; qtq_t is the law of XtX_t, and Vt+1(s)=E[r(XK)∣Xt+1=s]V_{t+1}(s) = \mathbb{E}[r(X_K) \mid X_{t+1} = s]. The MH kernel is Pt(x,⋅)=∑yQt(y∣x){αt(x,y)δy+(1−αt(x,y))δx}P_t(x,\cdot) = \sum_y Q_t(y \mid x)\{\alpha_t(x,y)\delta_y + (1-\alpha_t(x,y))\delta_x\}, and QtQ_t does not depend on θ\theta, so

[(∇θPt)Vt+1](x)=∑yQt(y∣x)∇θαt(x,y){Vt+1(y)−Vt+1(x)}.\left[(\nabla_{\theta}P_t)V_{t+1}\right](x) = \sum_y Q_t(y \mid x)\nabla_{\theta}\alpha_t(x,y)\{V_{t+1}(y)-V_{t+1}(x)\}.

Taking the expectation over Xt∼qtX_t \sim q_t and Yt∼Qt(⋅∣Xt)Y_t \sim Q_t(\cdot\mid X_t) gives (4). Self-proposals contribute nothing, because Vt+1(y)−Vt+1(x)=0V_{t+1}(y)-V_{t+1}(x)=0 when y=xy=x. Only the local acceptance probability is differentiated in each term; the effect of a decision on later steps enters through the value difference.

Paired continuations. Given (Xt,Yt)(X_t,Y_t), let R+R^{+} and R−R^{-} be the terminal rewards of continuations from YtY_t and XtX_t, each following the chain’s transition law from step t+1t+1 onward under the current energy and schedule. Then E[R+−R−∣Xt,Yt]=Vt+1(Yt)−Vt+1(Xt)\mathbb{E}[R^{+}-R^{-}\mid X_t,Y_t]=V_{t+1}(Y_t)-V_{t+1}(X_t) for any joint coupling of the two continuations; sharing random numbers changes only their joint law. By the Markov property, the base chain’s own continuation from its realized Xt+1X_{t+1} has the correct conditional law, so it can serve as one branch, provided that whether step tt is selected does not depend on the base chain’s future randomness. Shared uniforms pass through each branch’s categorical distribution, and branches merge only when their states and all carried sampler quantities coincide, after which they agree. Continuations keep their original step indices, so they use the remaining part of the schedule.

Subsampling. Let IitI_{it} indicate that decision tt of base chain ii is selected in the current update, with Pr⁡(Iit=1∣Fit)=pit\Pr(I_{it}=1\mid\mathcal{F}_{it})=p_{it}, where Fit\mathcal{F}_{it} contains the prefix Xi,0:tX_{i,0:t}, the proposal YitY_{it}, and quantities fixed before the update, and IitI_{it} is independent of the continuation randomness given Fit\mathcal{F}_{it}. If pit>0p_{it}>0 whenever ∇θαt(Xit,Yit)≠0\nabla_{\theta}\alpha_t(X_{it},Y_{it})\ne0, then

E[Iitpit(Rit+−Rit−)∇θαt(Xit,Yit)]=E[{Vt+1(Yt)−Vt+1(Xt)}∇θαt(Xt,Yt)].\mathbb{E}\left[\frac{I_{it}}{p_{it}}(R^{+}_{it}-R^{-}_{it})\nabla_{\theta}\alpha_t(X_{it},Y_{it})\right] = \mathbb{E}\left[\{V_{t+1}(Y_t)-V_{t+1}(X_t)\}\nabla_{\theta}\alpha_t(X_t,Y_t)\right].

with unselected terms set to zero. Summing over tt and averaging over the NN independent base chains shows that (5) is unbiased for ∇θJ\nabla_{\theta}J. Dividing by the number of selected decisions instead of NN would introduce a bias. States, rewards, and inclusion probabilities are treated as constants during differentiation, so no gradient flows through sampled categorical states, inclusion weights, or the discriminator.

Regularity. Write Δt=βt[Eθ(Yt)−Eθ(Xt)]−log⁡{Qt(Xt∣Yt)/Qt(Yt∣Xt)}\Delta_t = \beta_t[\mathbb{E}_{\theta}(Y_t)-\mathbb{E}_{\theta}(X_t)]-\log\{Q_t(X_t\mid Y_t)/Q_t(Y_t\mid X_t)\}, so that αt=min⁡{1,e−Δt}\alpha_t=\min\{1,e^{-\Delta_t}\}. If Δt>0\Delta_t>0, then ∇θαt=−βtαt∇θ[Eθ(Yt)−Eθ(Xt)]\nabla_{\theta}\alpha_t=-\beta_t\alpha_t\nabla_{\theta}[\mathbb{E}_{\theta}(Y_t)-\mathbb{E}_{\theta}(X_t)], so increasing the proposed state’s energy relative to the current one lowers acceptance. If Δt<0\Delta_t < 0, the proposal is strictly saturated and ∇θαt=0\nabla_\theta\alpha_t = 0; if the reverse proposal probability is zero, αt=0\alpha_t = 0 and its derivative vanishes. At a tie, Δt=0\Delta_t = 0 with ∇θΔt≠0\nabla_\theta\Delta_t \ne0, αt\alpha_t is not differentiable; the implementation uses zero there, and no unbiasedness claim is made at ties. The statement assumes exact arithmetic and a fixed discriminator. It does not extend to floating-point effects, gradient clipping, coordinate constraints, adaptive optimization, discriminator refitting, or the alternating procedure as a whole, and it implies nothing about convergence or mixing.

Finite-state checks cover 96 configurations with asymmetric proposals, self moves, varying schedules, and the tie convention. Eleven deliberately injected implementation faults were detected where applicable. Additional inclusion-weight and coordinate checks agree with enumerated gradients to approximately 10−1310^{-13} at regular points.

Molecular Optimization

The coefficients in (6) are written in energy coordinates (u,w)(u,w) as c=a0euc = a_0 e^u and ω=we−u\omega= w e^{-u}, so that Eθ=a0euVG+a0w(VG−Vpre)E_\theta= a_0 e^u V_{\mathrm{G}} + a_0 w(V_{\mathrm{G}} - V_{\mathrm{pre}}), starting at (u,w)=(0,0)(u,w) = (0,0), which is the calibrated baseline. The initial scales are a0=0.70,0.70,0.8649a_0 = 0.70, 0.70, 0.8649 at K=125,250,1000K = 125, 250, 1000 (rounded to 0.865 in the main text). The learned energy is kept unchanged when the acceptance rule changes (Table 5); coefficients are not rescaled using another setting’s calibration.

AdamW operates on the reparameterized coordinates (u′,w)(u',w), where u′=log⁡(eu+0.57w)u' = \log(e^u + 0.57w), so that Eθ=a0[eu′VG+w(0.43VG−Vpre)]E_\theta= a_0[e^{u'}V_{\mathrm{G}} + w(0.43V_{\mathrm{G}} - V_{\mathrm{pre}})]. The feasible set is u∈[−1.5,1.5]u \in[-1.5,1.5], w∈[−1,3]w \in[-1,3], and eu+0.57w≥e−1.5e^u + 0.57w \ge e^{-1.5}, so the argument of the logarithm defining u′u' is at least e−1.5e^{-1.5}. After each update, uu and ww are clipped to their intervals, and ww is then raised where necessary to satisfy the last constraint. The discriminator logit is −βref(Vψ−VG)-\beta_{\mathrm{ref}}(V_\psi- V_{\mathrm{G}}), where VψV_\psi is the LoRA-adapted potential and βref=17.619552679597852\beta_{\mathrm{ref}} = 17.619552679597852 is fixed to the final inverse temperature of GEM’s released acceptance schedule; it is held constant across sampling budgets and discriminator updates.

ComponentSetting
Energy updates80 updates; 256 base chains per update; approximately four selected decisions per chain on average; final iterate.
Decision selectionInclusion probability min⁡(1,λjhit)\min(1,\lambda_j h_{it}), with hith_{it} an acceptance-gradient norm in rescaled coordinates and a guidance weight three. λ0=0.0501\lambda_0 = 0.0501; later scales λj\lambda_j use the preceding update’s sensitivity sum.
OptimizerAdamW, learning rate 0.02, five-update warm-up then linear decay to zero, moments (0.9, 0.999), no weight decay.
CoordinatesAdamW on (u′,w)(u',w) with u′=log⁡(eu+0.57w)u' = \log(e^u + 0.57w); gradient components divided by (0.676, 0.152) before clipping to norm one. After each update, clip u∈[−1.5,1.5]u \in[-1.5,1.5] and w∈[−1,3]w \in[-1,3], then raise ww where necessary so that eu+0.57w≥e−1.5e^u + 0.57w \ge e^{-1.5}.
DiscriminatorRank-64 LoRA adaptation of VGV_{\mathrm{G}} on all 12 layers and the scalar head (Hu et al., 2022); approximately 9.7 million trainable parameters; logit −βref(Vψ−VG)-\beta_{\mathrm{ref}}(V_\psi- V_{\mathrm{G}}) with fixed βref≈17.62\beta_{\mathrm{ref}} \approx17.62.
Initial discriminator fit25,600 generated examples; 1,000 logistic updates with 128 generated and 128 node-count-matched data graphs per update. AdamW learning rate 2×10−52 \times10^{-5}, 200-step warm-up, no weight decay, clipping to one.
RefittingOne discriminator step after each energy update, reusing the first 128 of the 256 base-chain terminal graphs generated before that update, together with 128 node-count-matched training graphs.

Table 3. Molecular training configuration. Both pretrained potentials are frozen; only the two energy coordinates parameterize the acceptance energy. The discriminator is used only during training.

At K=250K = 250, discriminator negatives are calibrated GEM samples. Invalid negatives receive weight three in the logistic loss, selected from {1,3,9,27}\{1,3,9,27\} by held-out classifier loss. At K=1000K = 1000, half the negatives are calibrated samples and half come from guidance settings (c,ω)=(0.5,1),(0.8649,1),(0.5,0.5)(c,\omega) = (0.5,1), (0.8649,1), (0.5,0.5); the invalid weight is fixed to three. The K=125K = 125 pool also mixes calibrated and guided samples. The three K=1000K = 1000 discriminator seeds share their negative pool. Gradient clipping is active in about 85% of the K=250K = 250 updates. The exact-state optimizer does not use these molecular clipping and coordinate settings.

Alternative Estimators

A matched-transition experiment uses all six original exact targets, K=4,8,16K = 4, 8, 16, three fresh seeds, and the same 2,000-update schedule. Coupled learning uses 512 base chains; leave-one-out score-function learning uses 704, 736, and 752 chains, respectively, so that both simulate the same number of transitions. Both improve on the correct energy in all 18 settings. Coupled learning has lower median TV in 12 settings, with median difference −0.0015-0.0015, but takes 4.66 times the CPU runtime. Learning rates were not separately tuned. A fixed-gradient diagnostic likewise establishes no general efficiency advantage over leave-one-out scores or paired finite differences. These findings support terminal learning, not superiority of coupling.

Computational Resources and Continuation Work

Molecular energy training uses NVIDIA H100 GPUs: energy updates take approximately 4.86 GPU-hours per seed at K=250K = 250 and 16.3 at K=1000K = 1000, excluding discriminator preparation. At K=250K = 250, generation takes 0.859 H100 GPU-seconds per requested graph for calibrated GEM and 0.932 for our two-potential energy, excluding packed batches. Main comparisons match sampling steps, not elapsed time or runtime at equal quality. For fixed graph size and bounded retries, both samplers require work proportional to KK beyond initialization.

Let S\mathcal{S} contain the selected decisions. Simulating the NN base chains and one full alternative continuation per selected decision uses at most

NK+∑(i,t)∈S(K−t−1)NK + \sum_{(i,t)\in\mathcal{S}} (K-t-1)

refinement transitions, excluding initialization, derivative evaluations, and discriminator work; earlier branch merging can lower this count. Branching at every step gives NK+NK(K−1)/2NK + NK(K-1)/2 transitions; selecting an expected FF decisions per chain gives at most NK+NF(K−1)NK + NF(K-1) in expectation. With one uniformly selected step, as in the exact study, the expected count is N(3K−1)/2N(3K-1)/2. These are counts of simulated transitions, not measured wall-clock ratios, and they do not bound mixing time. Molecular training targets about four decisions per chain. At deployment no continuations or discriminator evaluations are needed.

Finite-State Experiments

Targets and Optimization

The finite-state study uses no external dataset and is separate from the molecular experiments: each target is a synthetic pairwise binary (Ising) model p(s)∝e−H(s)p(s) \propto e^{-H(s)} over configurations s=(s1,…,sL)s = (s_1,\ldots,s_L) with L=6L = 6 or L=8L = 8 variables. Here H(s)=−∑ihisi−∑i<jJijsisjH(s) = -\sum_i h_i s_i - \sum_{i<j} J_{ij}s_i s_j, with si∈{−1,1}s_i \in\{-1,1\}, hi∼N(0,0.252)h_i \sim\mathcal{N}(0,0.25^2), and Jij∼N(0,1.252/L)J_{ij} \sim\mathcal{N}(0,1.25^2/L); the fields hih_i bias individual variables, while the couplings shape dependencies between them. The reference and new-target sets each contain three targets of each size, drawn independently from this distribution, each with its own fields and couplings. Target IDs such as Ref-6-1 identify these draws by set, number of spins, and instance index; they do not denote methods, difficulty levels, or training seeds. Enumeration gives target probabilities, initial marginals, and transition laws. The initial law is the product of target marginals; proposals flip one uniformly chosen spin, and rejection supplies self transitions. The inverse temperature rises from 0.2 to 1 over the first ⌈K/2⌉\lceil K/2\rceil steps, including both endpoints, and is then fixed.

A restricted unary-and-ring energy is fitted by population maximum likelihood. Its scalar multiplier minimizes terminal TV over 81 logarithmically spaced values from 0.05 to 20. The learned family adds all unary and pairwise features, with 21 or 36 coefficients. Population pseudo-likelihood recovers the correct energy HH up to a constant ([6]). The discriminator is linear in those features and an intercept, initialized by the exact population logistic fit and subsequently updated from generated and target samples.

The original learning grid uses K∈{4,8,16,32,64,128,256}K \in\{4,8,16,32,64,128,256\}, trajectory counts N∈{32,128,512}N \in\{32,128,512\}, oracle or fitted discriminators, coupled or independent continuations, and three seeds. All runs use 2,000 Adam updates, learning rate 0.02 decaying to zero, moments (0.9,0.999)(0.9,0.999), no clipping or weight decay, and final-iterate evaluation. Each chain selects one uniformly chosen decision. The discriminator receives at most 128 generated and 128 target samples per update.

The numerical reference minimizes D(q∥p)=2KL⁡(12(p+q)∥p)D(q\|p) = 2\operatorname{KL}\left(\frac{1}{2}(p+q)\mathrel{\|}p\right) over the learned family, with q=qθ,Kq = q_{\theta,K}. Consider the balanced, unweighted population problem of classifying samples of pp against samples of qq, and let d∗d^* be its optimal unrestricted discriminator, so that σ(d∗)=p/(p+q)\sigma(d^*) = p/(p+q). Hold d∗d^* fixed at the current generator, and assume p>0p > 0 wherever q>0q > 0, which holds here because every target p∝e−Hp \propto e^{-H} has full support. Using ∑x∇θq(x)=0\sum_x \nabla_\theta q(x) = 0,

∇θEq[log⁡σ(d∗)]=∑x∇θq(x)log⁡p(x)p(x)+q(x)=−∇θD(q∥p),\nabla_\theta\mathbb{E}_q[\log\sigma(d^*)] = \sum_x \nabla_\theta q(x) \log\frac{p(x)}{p(x)+q(x)} = -\nabla_\theta D(q\|p),

where d∗d^* is not differentiated. The reward gradient for this ideal, frozen discriminator is therefore the negative gradient of DD. The relation describes the finite-state setting; it does not imply that the weighted, finitely trained molecular discriminator optimizes the same divergence. It is also separate from the estimator of Section 3.3, which is unbiased for ∇θJ\nabla_\theta J with any fixed discriminator under the conditions stated there. The reference uses exact gradients, a coefficient box of [−20,20][-20,20], two starts, bounded L-BFGS-B, and projected-Adam refinement. It is a numerical reference rather than a certified global solution. Eight of 42 reported reference configurations fail the projected-gradient tolerance, mainly at acceptance kinks; additional minimizations and directional checks change the objective by at most about 7.3×10−117.3 \times10^{-11}. The TV recovery fraction divides the learned improvement over the calibrated restricted energy by the reference’s improvement. Because the reference minimizes DD, not TV, recovery does not measure a known maximum TV gain.

Repeated Training and Scalar Controls

Fresh-seed replication uses seeds 1001–1003 on the reference targets; new-target training uses seeds 3001–3003. Both follow the 512-chain, 2,000-update procedure fixed before these runs, without selecting final iterates by TV. Table 4 lists each target by its ID and horizon KK, and reports our method’s median and sample SD across three training seeds. Its reference block reports the fresh-seed replication, whereas Table 1 and Figure 2 report the original runs; the replication’s cross-target medians therefore differ slightly from Table 1. The medians determine win counts. Horizons within a target are dependent, so these counts are descriptive.

TargetsKKCorrect HHLearned (ours)
Reference (original runs)40.3290.197
80.2010.063
160.0890.030
New targets40.5530.518
80.4130.307
160.2400.069

Table 1. Exact terminal TV at short horizons (lower is better). Entries are medians over six targets of each target’s median over three training seeds. Reference rows summarize the original runs in Figure 2a; Table 4 reports per-target results for a fresh-seed replication on the reference targets and for the new targets. Bold marks the smaller median.

The scalar control minimizes exact terminal TV for βH\beta H over nonnegative scales, including zero and the infinitescale downhill-only limit. Logarithmic grids of 513 to 4,097 points are refined around detected minima until the best TV values change by less than 10−910^{-9}. The omitted large-β\beta tail is controlled to 10−1010^{-10} using the smallest positive single-flip energy increase. This controls the tail, not global optimality inside the search interval. All 18 reference and 18 new-target searches stabilize. Learned medians beat tuned βH\beta H in 14 of 18 reference settings in both the original runs and the fresh-seed replication, and in 15 of 18 new-target settings; the three new-target exceptions are all on New-8-2. Independent probability propagation verifies the terminal laws of these follow-up runs.

Finite-Time and Equilibrium Distributions

Let the target be uniform on {a,b}\{a,b\}, start at aa, and propose a flip with probability 3/43/4. The correct energy accepts every flip, giving probability 3/43/4 to bb after one step. At inverse temperature one, setting E(b)−E(a)=log⁡(3/2)E(b)-E(a) = \log(3/2) reduces acceptance to 2/32/3: the one-step output is uniform, although the equilibrium probability of bb is 2/52/5.

Finite-time and equilibrium distributions for a two-state example

Figure 4. Finite-time accuracy need not imply equilibrium accuracy. One-step output and equilibrium probability for the two-state example, computed exactly.

Molecular Evaluation

Sampler, Calibration, and Metrics

Each chain draws 8–27 nodes according to the MOSES training histogram and keeps this count fixed. Initialization performs at most 225 greedy edits under VGV_{\mathrm{G}}. We retain the released proposal settings, approximately βprop=2.36\beta_{\mathrm{prop}} = 2.36, λX=4.00\lambda_X = 4.00, and λE=4.83\lambda_E = 4.83. If no label changes, the sampler retries after multiplying these settings by 0.9, for at most 20 stages. Acceptance uses an inverse-temperature ramp from approximately 0.78 to 17.62 over 500 steps, then holds the final value. Continuations retain their original step index. Values here are rounded for readability; full-precision proposal and acceptance-temperature constants are provided in molecular.py in the supplementary code, and its YAML file specifies experiment settings. The molecular example in the supplement implements the training method but does not reconstruct the original development, selection, and final evaluation pipeline.

Exact MH marginalizes both forward and reverse proposal probabilities over the same 20 stages. GEM’s released rule instead uses the realized forward retry path and a reverse marginal with up to 256 stages and log-mass floor −50; it is not exact MH for the same target. Both rules have parameter-independent proposal terms. Network calls are padded to 256 graphs; sampler precision follows the release, while discriminator scoring and refitting use the highest float32 precision.

Development FCD, used for baseline calibration, discriminator screening, and static-coefficient selection, compares 2,048 generated graphs per candidate setting, from a generation stream separate from the final comparisons, with a fixed reference of 16,010 molecules: the MOSES training molecules whose SHA-256 hash of the canonical SMILES is divisible by 100 (about 1% of the training set). Final FCD uses the separate MOSES scaffold-test reference of 176,225 molecules. The development molecules were not held out from the pretraining of the released GEM checkpoints. The following calibration scales are rounded to three decimal places. Exact GEM selects 0.7 at K=250K = 250 from {0.25, 0.35, 0.5, 0.7, 0.865, 1, 1.5, 2, 3}, a grid extended after an initial boundary solution, and 0.865 at K=1000K = 1000 from {0.5, 0.865, 1}. At K=125K = 125, the selected 0.7 nearly ties 0.865 in development FCD. Released-rule GEM at K=250K = 250 selects 0.5 over 0.7 and 1; the first two differ by only 0.0013 in FCD but substantially in validity. The released baselines at K=125,1000K = 125, 1000 use scale one, not a budget-calibrated scale.

Every requested graph counts in the denominators of validity and VUN, and failed outputs are not replaced. Native validity permits disconnected sanitizable molecules; native FCD uses their canonical largest fragments, retaining duplicates. Strict validity requires connectedness and the stated canonical representation checks. Novelty uses the unfiltered training set of 1,584,663 canonical SMILES. Software is Python 3.10.21, PyTorch 2.5.1 with CUDA 12.1, RDKit 2026.03.6, fcd_torch 1.0.7, NumPy 2.2.6, and SciPy 1.15.2. Scoring runs on CPUs. The graph encoding cannot represent every aromatic-hydrogen configuration, so these scores are interpreted within the same encoding and evaluator rather than against published leaderboard values.

Released-Rule Deployment and Uncertainty

The internally prespecified decision rule combines a one-sided paired FCD test at level 0.05 with one-sided 95% lower confidence limits above −1 percentage point for the validity and VUN differences, each computed as learned minus baseline. The exact-rule comparison meets it at K=125,1000K = 125, 1000; at K=250K = 250, the validity lower limit of −1.25 points does not establish non-inferiority. Released-rule deployment meets it at K=250,1000K = 250, 1000, not at K=125K = 125, where the validity and VUN lower limits are −2.52 and −2.80 points. A later three-seed analysis also fails those conditions and does not replace the prespecified two-seed result. No multiplicity adjustment is applied across the six comparisons.

Training seed kk is paired with generation seed 1911+k1911 + k. The two or three seed-level differences, not individual graphs, are the observations for the small-sample tt tests. Energies are reused across acceptance rules, and some discriminator data are shared.

Learned rows use H100 GPUs. One released-GEM K=1000K = 1000 comparator seed mixes 63 H100 and 35 L40-class batches; the two H100-only seeds give an unresolved FCD comparison (p=0.11p = 0.11). All K=125K = 125 rows use H100s. Runtime estimates exclude packed batches.

Protocol Changes and Sensitivity

Protocols were recorded internally, not in an external registry. The original K=250K = 250 comparison followed static development results and exploratory pilots but preceded final learned outcomes. Its released-rule hypothesis followed development results, and later budgets followed earlier tests. The six comparisons are therefore not independent prospective replications. No final test score selected the deployed iterate.

At K=125K = 125, a baseline-only encoding check found 22 mismatches among 1,833 native-valid graphs (1.20%). The discriminator-pool eligibility threshold was raised from 1% to 2% before any pool output or discriminator training. The completed pool contained 368 mismatches among 22,270 valid graphs (1.65%): 322 non-isomorphic re-encodings and 46 explicit-hydrogen cases. The change affected eligibility, not evaluation or sample handling. The original rule would have stopped the experiment.

Strict scoring preserves the exact-rule K=125K = 125 improvement: validity and VUN gains are 4.77 and 4.65 points. About 0.64 points of the native validity gain arise from disconnected output. Matching the valid-input counts changes the FCD difference from −0.1419 to −0.1379; all fixed subsample comparisons remain negative. These checks reuse generated samples and do not establish that encoding mismatches in the discriminator’s training pool are harmless. The released-rule K=125K = 125 joint failure also remains under strict scoring.

At K=1000K = 1000, the initial discriminator failed a screen relating reward to development FCD. A revised negative pool containing guided samples passed at the correlation boundary of −0.50. Several screened settings also supplied negatives, and all three discriminator seeds shared the pool. At K=500K = 500, the screen failed with correlation approximately −0.071; no energy was trained and no second attempt was made. The absence of that budget is not an evaluated negative generator result.

Scope of the GEM Comparison

Coefficient-selection controls give FCD 2.280 at K=125K = 125, versus 2.366 for learning, but lower validity (91.10% versus 92.55%); the FCD difference is unresolved with three seeds. At K=250K = 250, their FCD is 1.811 versus 1.829 with exact acceptance, and 1.769 versus 1.784 with released acceptance; rate differences are small. Finite-difference training gives exact-rule FCD 1.821 under a different optimization schedule. These comparisons do not establish an FCD advantage for learning over the alternatives; we report only these summaries.

The K=125K = 125 static setting was selected among four development candidates. The K=250K = 250 setting has the lowest development FCD among tested settings but is validity-ineligible: 94.97% against a 95.44% threshold. These descriptive controls use three seeds with shared generation streams; there is no corresponding three-seed static evaluation at K=1000K = 1000.

The six-setting coefficient grid costs 3.2 H100-hours at K=250K = 250, versus 4.86 per seed for energy updates before discriminator preparation. Schedule compression is inconclusive, and cross-budget transfer is confounded by the change of scale. A larger residual energy did not improve development FCD at matched scales; its planned tests and a random-sign placebo test were not completed. Molecular-weight distance worsens at K=1000K = 1000 despite improved FCD, precluding a claim of uniformly improved molecular properties.

References

  1. [1]Agoritsas, E., Catania, G., Decelle, A., and Seoane, B. (2023). Explaining the effects of non-convergent MCMC in training of energy-based models. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research.
  2. [2]Arya, G., Schauer, M., Schäfer, F., and Rackauckas, C. (2022). Automatic differentiation of programs with discrete randomness. In Advances in Neural Information Processing Systems, volume 35.arxiv.org/abs/2210.08572
  3. [3]Arya, G., Schauer, M., and Seyer, R. (2024). Gradient estimation via differentiable Metropolis-Hastings. arXiv preprint arXiv:2406.14451.arxiv.org/abs/2406.14451
  4. [4]Arya, G., Seyer, R., Schäfer, F., Chandra, K., Lew, A. K., Huot, M., Mansinghka, V. K., Ragan-Kelley, J., Rackauckas, C., and Schauer, M. (2023). Differentiating Metropolis-Hastings to optimize intractable densities. In ICML 2023 Workshop on Differentiable Almost Everything. arXiv:2306.07961.arxiv.org/abs/2306.07961
  5. [5]Balcerak, M., Shit, S., Prabhakar, C., Kaltenbach, S., Albergo, M. S., Du, Y., and Menze, B. (2026). Graph energy matching: Transport-aligned energy-based modeling for graph generation. arXiv preprint arXiv:2603.23398.arxiv.org/abs/2603.23398
  6. [6]Besag, J. (1975). Statistical analysis of non-lattice data. Journal of the Royal Statistical Society. Series D (The Statistician), 24(3):179–195.DOI
  7. [7]Campbell, A., Benton, J., De Bortoli, V., Rainforth, T., Deli­giannidis, G., and Doucet, A. (2022). A Continuous Time Framework for Discrete Denoising Models. In Advances in Neural Information Processing Systems.
  8. [8]Dai, H., Singh, R., Dai, B., Sutton, C., and Schuurmans, D. (2020). Learning discrete energy-based models via auxiliary-variable local exploration. In Advances in Neural Information Processing Systems, volume 33.arxiv.org/abs/2011.05363
  9. [9]Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. (2014). Generative adversarial nets. In Advances in Neural Information Processing Systems, volume 27.
  10. [10]Hinton, G. E. (2002). Training products of experts by minimizing contrastive divergence. Neural Computation, 14(8):1771–1800.pubmed.ncbi.nlm.nih.gov/12180402
  11. [11]Horvitz, D. G. and Thompson, D. J. (1952). A generalization of sampling without replacement from a finite universe. Journal of the American Statistical Association, 47:663–685.DOI
  12. [13]Karras, T., Aittala, M., Kynkäänniemi, T., Lehtinen, J., Aila, T., and Laine, S. (2024). Guiding a diffusion model with a bad version of itself. In Advances in Neural Information Processing Systems, volume 37.arxiv.org/abs/2406.02507
  13. [14]Lin, H., Li, S., Ye, H., Yang, Y., Ermon, S., Liang, Y., and Ma, J. (2025). TFG-Flow: Training-free Guidance in Multimodal Generative Flow. In International Conference on Learning Representations.arxiv.org/abs/2501.14216
  14. [15]Liu, Y., Du, C., Pang, T., Li, C., Lin, M., and Chen, W. (2024). Graph Diffusion Policy Optimization. In Advances in Neural Information Processing Systems.arxiv.org/abs/2402.16302
  15. [16]Nijkamp, E., Hill, M., Zhu, S.-C., and Wu, Y. N. (2019). Learning non-convergent non-persistent short-run MCMC toward energy-based model. In Advances in Neural Information Processing Systems, volume 32.arxiv.org/abs/1904.09770
  16. [17]Phunyaphibarn, P. and Sung, M. (2026). Reward-Guided Discrete Diffusion via Clean-Sample Markov Chain for Molecule and Biological Sequence Design. arXiv preprint arXiv:2602.09424.arxiv.org/abs/2602.09424
  17. [18]Polykovskiy, D., Zhebrak, A., Sanchez-Lengeling, B., Golovanov, S., Tatanov, O., Belyaev, S., Kurbanov, R., Artamonov, A., Aladinskiy, V., Veselov, M., Kadurin, A., Johansson, S., Chen, H., Nikolenko, S., Aspuru-Guzik, A., and Zhavoronkov, A. (2020). Molecular sets (MOSES): A benchmarking platform for molecular generation models. Frontiers in Pharmacology, 11:565644.DOI
  18. [19]Preuer, K., Renz, P., Unterthiner, T., Hochreiter, S., and Klambauer, G. (2018). Fréchet ChemNet distance: A metric for generative models for molecules in drug discovery. Journal of Chemical Information and Modeling, 58(9):1736–1741.DOI
  19. [20]Qin, Y., Madeira, M., Thanou, D., and Frossard, P. (2025). DeFoG: Discrete Flow Matching for Graph Generation. In Proceedings of the 42nd International Conference on Machine Learning.arxiv.org/abs/2410.04263
  20. [21]Siraudin, A., Malliaros, F. D., and Morris, C. (2024). COMETH: A Continuous-Time Discrete-State Graph Diffusion Model. arXiv preprint arXiv:2406.06449.arxiv.org/abs/2406.06449
  21. [22]Song, J., Zhao, S., and Ermon, S. (2017). A-NICE-MC: Adversarial training for MCMC. In Advances in Neural Information Processing Systems, volume 30.arxiv.org/abs/1706.07561
  22. [23]Vignac, C., Krawczuk, I., Siraudin, A., Wang, B., Cevher, V., and Frossard, P. (2023). DiGress: Discrete Denoising Diffusion for Graph Generation. In International Conference on Learning Representations.arxiv.org/abs/2209.14734
  23. [24]Wang, C., Chen, W. Y., Kanagawa, H., and Oates, C. J. (2025a). Reinforcement learning for adaptive MCMC. In Proceedings of The 28th International Conference on Artificial Intelligence and Statistics, volume 258 of Proceedings of Machine Learning Research, pages 640–648.
  24. [25]Wang, C., Uehara, M., He, Y., Wang, A., Biancalani, T., Lal, A., Jaakkola, T., Levine, S., Wang, H., and Regev, A. (2025b). Fine-Tuning Discrete Diffusion Models via Reward Optimization with Applications to DNA and Protein Design. In International Conference on Learning Representations.arxiv.org/abs/2410.13643
  25. [26]Zhang, D., Malkin, N., Liu, Z., Volkova, A., Courville, A., and Bengio, Y. (2022a). Generative flow networks for discrete probabilistic modeling. In Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 26412–26428.arxiv.org/abs/2202.01361
  26. [27]Zhang, R., Liu, Y., and Liu, Q. (2022b). A Langevin-like Sampler for Discrete Distributions. In Proceedings of the 39th International Conference on Machine Learning.arxiv.org/abs/2206.09914
  27. [28]Zhu, B., Bo, D., Zhang, D. C., and Wang, X. (2026). Graph-GRPO: Training Graph Flow Models with Reinforcement Learning. arXiv preprint arXiv:2603.10395.arxiv.org/abs/2603.10395

Paper details

vlnc:W_vea8fef4
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 4

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Generative AI tools

View statement
Looking for related papers…
Contents