arXiv:2610.19946cs.LGOct 2026

Manuscript Offprint

arXiv:2610.19946

Learning Graph Energies for Finite-Time Generation

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

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

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.

Caroline Moosmüller

Dept. of Mathematics

UNC Chapel Hill

Harlin Lee

SDSS

UNC Chapel Hill

1 INTRODUCTION

For a generator stopped after K 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 (Nijkamp et al., 2019; Agoritsas et al., 2023).

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 a, and propose a flip with probability 3/4. At inverse temperature one, the correct energy accepts every flip and returns b with probability 3/4 after one step. Raising the energy of b by log⁡(3/2)\log(3/2) lowers the acceptance probability to 2/3, making the one-step output exactly uniform but moving the equilibrium probability of b to 2/5.

We introduce finite-horizon energy learning, 1^{1} which optimizes the acceptance energy using discriminator rewards on completed K-step samples. For pretrained graph generators such as Graph Energy Matching (GEM; Balcerak et al., 2026), which refines graphs with Metropolis–Hastings (MH) steps using gradient-informed proposals from a learned potential (Zhang et al., 2022b), this separates the frozen potential used for initialization and proposals 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.

1^{1}Code is available at https://github.com/amartya21/Finite-Time-Graph-Sampling.git.

Figure

Figure 1: Finite-horizon energy learning for a pretrained GEM graph sampler. Generation (top): one K-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.

(2023, 2024), 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).

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 (Polykovskiy et al., 2020). 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 Section 3.3.

• Exact finite-state evidence beyond scalar tempering. At K∈{4,8,16}K \in \{4, 8, 16\}, learned energies achieve lower median 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 (Section 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 (Section 5).

References (28)