Coarse-to-Fine Autoregression over Hierarchical Discrete Codes for Molecular Graph Generation

Haozhuo Zheng, Cheng Wang, Pengyu Chen, YajunTian, Yang LiuNeurIPS 2026

TL;DR

Generating new molecules with AI usually forces a painful choice: slow diffusion models that sculpt coherent global structures, or fast autoregressive (AR) models that lay down atoms one by one without a master blueprint. This paper introduces the Hierarchical Graph VQ-Transformer (H-GVT), which teaches a standard Transformer to sketch a molecule’s coarse skeleton before filling in atomic details. The result is diffusion-grade structural quality at autoregressive speeds—sampling 68× faster than leading diffusion baselines.

What Problem Does This Paper Address?

Imagine building a house by laying bricks in a single line from the front door, deciding on plumbing and load-bearing walls on the fly without ever looking at a floor plan. That is essentially how standard autoregressive molecular generators work. Because they traverse a graph in a flat sequence (like breadth-first search), they commit to local atomic choices before establishing long-range topology like ring systems. Worse, to score well on benchmarks, flat AR models often fall back on memorizing training molecules rather than learning true chemical distributions.

Diffusion models solve the blueprint problem by refining the whole graph simultaneously, but they require hundreds of iterative denoising steps—taking around 1,000 seconds just to generate 10,000 molecules. Meanwhile, earlier hierarchical approaches relied on rigid, hand-crafted chemical motif vocabularies. The authors ask: can we learn a purely data-driven, multi-scale hierarchy of discrete tokens so a fast, off-the-shelf Transformer can plan globally before acting locally?

Methods

H-GVT operates in two stages: compressing graphs into multi-scale discrete tokens, and generating those tokens from coarse to fine.

Figure 1: Overview of the H-GVT framework. Stage 1 (Graph Compression): The Spectrally-Regularized Multi-Scale VQ-VAE compresses the input molecular graph into hierarchical discrete codes via Adaptive Min- Cut Pooling, regularized by the Spectral Topology Consistency Loss. Stage 2 (Coarse-to-Fine Generation): A standard decoder-only Transformer generates tokens ordered from coarse to fine with level embeddings, first committing to global structural codes and then refining atomic details.
  • Stage 1: Spectrally-Regularized Multi-Scale VQ-VAE (Novel Compression). Molecules vary wildly in size, making fixed-grid downsampling (like in images) impossible. The authors repurpose Adaptive Min-Cut Pooling to group atoms into soft clusters across multiple scales, extracting every coarse scale directly in parallel from the original graph to avoid compounding errors. To prevent the pooling layers from collapsing into meaningless blobs, they introduce a novel Spectral Topology Consistency Loss. Grounded in spectral graph theory, it forces coarsened graphs to match the smallest eigenvalues of the original graph's normalized Laplacian—preserving global signatures like connectivity and community structure with just 2.8% training overhead. All scales are quantized into a shared discrete codebook, though notably, only the finest atom-level codes are fed to the decoder to reconstruct the graph.
  • Stage 2: Coarse-to-Fine Generation (Intentionally Standard). All multi-scale tokens are flattened into a single sequence ordered from coarsest to finest, tagged with simple level embeddings. A completely standard decoder-only Transformer with a conventional causal mask models this sequence—no custom tree decoders, motif-attachment modules, or specialized attention masks required.

Datasets

The authors evaluate H-GVT on four standard 2D molecular benchmarks (no new datasets are introduced):

  • QM9 (small molecules with up to 9 heavy atoms) and ZINC250k (drug-like molecules averaging 23 heavy atoms), using 80%/20% splits.
  • MOSES and GuacaMol, larger drug-discovery benchmarks evaluated using official scaffold splits to test distribution learning and novelty.

Key Insights and Ideas

  • Sequence order is the secret sauce: Is H-GVT better just because it has a richer, multi-scale vocabulary? No. When the authors kept the exact same tokens, codebook, and level embeddings, but shuffled the token order randomly across scales, structural error (NSPDK) exploded by 29×—even though chemical validity stayed above 97%. Having the coarse blueprint first in the causal chain is what enables global planning.
  • Coarse tokens genuinely capture topology: Even though coarse tokens aren't passed to the Stage-1 decoder, linear probes and causal interventions prove they aren't dummy variables. Freezing a real molecule's coarse prefix and resampling the fine tokens 16 times yields 46% unique molecules, yet 90.7% of them share the exact same ring count! The coarse prefix locks in the macro-skeleton while fine tokens explore local chemistry.
  • Standard causal masking beats fancy masks: Allowing bidirectional attention within the same scale ("scale-causal masking") actually hurts performance, dropping validity on ZINC250k from 99.86% to 87.99%. Standard left-to-right causal masking works best.
  • Policing the memorization trap: The authors demonstrate that benchmark metrics like FCD (Fréchet ChemNet Distance, which measures distribution similarity) actively reward training-set memorization. By evaluating models at matched Novelty thresholds, they show H-GVT genuinely learns better distributions rather than cheating via memorization.

Key Results

H-GVT establishes a new Pareto frontier for speed versus structural quality.

Figure 2: Speed–quality trade-off on QM9. x-axis: generation time (log scale; left is faster). y-axis: NSPDK metric (log scale; bottom is better). H-GVT (star) occupies the Pareto-optimal bottom-left region: it achieves the lowest NSPDK (2×10−4) while generating 10K molecules in 14.3s, 68× faster than DiGress and 23× faster than SwinGNN. Bubble size indicates validity.
  • Speed & Topology: On QM9 and ZINC250k, H-GVT achieves the lowest NSPDK (a subgraph-based topological error metric; lower is better) among all baselines at $2\times10^{-4}$ and $1\times10^{-4}$—roughly 700× better than the flat GVT baseline on ZINC250k. It generates 10,000 QM9 molecules in 14.3 seconds, making it 68× faster than DiGress and 23× faster than SwinGNN.
  • Fidelity vs. Diversity: Under fair novelty-matched protocols on MOSES, H-GVT achieves 4.8× better FCD than flat GVT (0.19 vs. 0.92) while simultaneously achieving higher Novelty (86.4% vs. 80.5%) and Validity (98.5%). On GuacaMol, it improves official FCD scores from 73.24 (flat GVT) and 54.9 (hierarchical diffusion MolHIT) up to 83.66.
  • Controllability: Freezing Stage 1 and retraining only Stage 2 with property embeddings allows targeted generation that tracks desired QED ($r = 0.966$) and $\log P$ ($r = 0.988$) values.

Limitations and Future Work

  • Graph size scaling: Computing the exact Laplacian eigenvalues takes $O(N^3)$ time. While tiny for small molecules, scaling to massive graphs (like proteins or materials) will require sparse top-$k$ eigensolvers.
  • Stage-1 bottleneck: Compressing and regularizing graphs in Stage 1 accounts for 81–96% of total training time.
  • 2D only & fixed hierarchies: H-GVT currently operates only on 2D topological graphs. Extending the framework to 3D molecular geometry, scaling up property-conditioned generation, and dynamically adapting the number of hierarchy levels across diverse chemical domains remain open avenues for future work.

Summary updated

Abstract

Molecular graph generation typically involves a trade-off between two paradigms: diffusion models capture global structure well but require hundreds of denoising steps, while autoregressive (AR) models sample in a single pass yet generate atoms in a flat canonical order with no semantic hierarchy, leaving long-range topology to chance. We introduce the **Hierarchical Graph VQ-Transformer (H-GVT)**, which removes this dichotomy by performing coarse-to-fine AR generation over hierarchical discrete codes. A **Spectrally-Regularized Multi-Scale VQ-VAE** first compresses each molecule into a sequence of discrete tokens at multiple scales, where coarse tokens provide regularized low-resolution structural context and fine tokens encode atom-level details. The compression combines Adaptive Min-Cut Pooling with a novel **Spectral Topology Consistency Loss** that aligns low-frequency normalized Laplacian spectra across scales, adding only 2.8\% training overhead. A standard decoder-only Transformer with level embeddings then generates these tokens from coarse to fine, allowing fine-grained atom tokens to condition on coarser structural context. This requires no specialized tree, motif, or scale-causal masking. On QM9 and ZINC250k, H-GVT achieves the best NSPDK among compared baselines ($2\times10^{-4}$ on QM9 and $1\times10^{-4}$ on ZINC250k), while sampling 10K molecules $68\times$ faster than DiGress. On MOSES, H-GVT achieves $4.8\times$ better FCD than a Novelty-thresholded GVT baseline under the same thresholded protocol (0.19 vs. 0.92; 86.4% vs. 80.5% Novelty). Crucially, ablations reveal that the coarse-to-fine ordering itself, not merely multi-scale tokenization, is what enables global structural planning: randomizing the order while keeping the same tokens, codebook, and level embeddings degrades NSPDK by $29\times$. Code, configurations, and checkpoints are available at https://github.com/zzccppp/H-GVT.
BibTeX
@inproceedings{zheng2026coarse,
  author = {Haozhuo Zheng and Cheng Wang and Pengyu Chen and YajunTian and Yang Liu},
  title = {{Coarse-to-Fine Autoregression over Hierarchical Discrete Codes for Molecular Graph Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=L66jzxk7cl},
}
Figure