Learning-Order Autoregressive Models with Application to Molecular Graph Generation

Zhe Wang, Jiaxin Shi, Nicolas Heess, Arthur Gretton, Michalis Titsias

TL;DR

Autoregressive models (ARMs) usually require a fixed, predefined sequence (like left-to-right text), which doesn't work well for complex structures like molecules or graphs. Learning-Order Autoregressive Models (LO-ARMs) solve this by learning a "trainable order-policy" that dynamically decides which part of a graph or image to generate next. This approach achieves state-of-the-art results in molecular graph generation, producing highly realistic drug-like molecules by learning its own optimal construction strategy.

What Problem Does This Paper Address?

Autoregressive models are the backbone of modern AI (think GPT), but they have a "sequencing" problem. For text, the order is obvious: left-to-right. But how do you "sequence" a molecule or a 2D image?

Existing methods usually take one of two paths:

  1. Fixed Ordering: Use a heuristic like Breadth-First Search (BFS). This is rigid and might not capture the true underlying dependencies of the data.
  2. Random Ordering (AO-ARMs): Train the model to handle any random permutation. While flexible, this is incredibly difficult to train because the model must learn to predict the next component from every possible starting point, often leading to mediocre performance.

The authors argue that the "best" generation order is often context-dependent. For example, a chemist might build a stable carbon skeleton before adding functional groups. LO-ARMs aim to learn this "natural" order directly from the data.

Methods

The core innovation is the Learning-Order Autoregressive Model (LO-ARM). Instead of a fixed or random sequence, it uses a probabilistic order-policy to decide the generation path.

  • The Unmasking Process: The model treats generation as "unmasking." It starts with a fully masked state (all nodes and edges hidden). At each step, the order-policy picks one masked dimension to reveal.
  • Trainable Order-Policy: This is a neural network that looks at the current partially generated structure and assigns probabilities to all remaining masked dimensions. It essentially asks, "Given what I've built so far, what is the most certain or logical next step?"
  • Variational Inference & ELBO: Because there are $L!$ (factorial) possible orders, calculating the exact likelihood is impossible. The authors derive a Variational Lower Bound (ELBO) and use an amortized variational distribution ($q_\theta$) that sees the full data during training to guide the model toward efficient generation orders.
  • RLOO Gradient Estimation: To train through the discrete step of "picking the next dimension," they use the REINFORCE Leave-One-Out (RLOO) estimator, which provides a stable way to optimize the discrete policy.

Key Insights and Ideas

  • Confidence-Based Ordering: A fascinating "aha moment" is that the model naturally learns to generate dimensions it is most certain about first. In MNIST, it fills the black borders first. In molecules, it builds the "skeleton" before the "details."
  • Emergent Strategies: Without any chemistry-specific rules, the LO-ARM trained on the ZINC250k dataset converged on a consistent three-phase strategy.
Visualization of the emergent generation strategy

As visualized above, the model learns to:

  1. Build Skeleton: Create the basic bond structure.
  2. Infill "No-Edges": Explicitly decide where bonds don't exist in the dense adjacency matrix.
  3. Assign Atoms: Finally, determine the specific element (Carbon, Nitrogen, etc.) for each node.
  4. Order Matters for Quality: The authors found that learning the order significantly outperforms random ordering. By focusing on a few "good" paths, the model can allocate its capacity more effectively than a model trying to master every possible random sequence.

Key Results

LO-ARM achieved state-of-the-art (SOTA) performance on molecular benchmarks, particularly in distribution similarity.

ZINC250k Benchmark Results
  • FCD (Fréchet ChemNet Distance): On ZINC250k, LO-ARM achieved an FCD of 3.229, a massive improvement over the previous best autoregressive model, CatFlow (13.21). Lower FCD means the generated molecules are statistically much closer to real-world drugs.
  • Validity & Uniqueness: The model maintained high validity (~99% on QM9 and ~96% on ZINC250k) while ensuring almost 100% uniqueness in its samples.
  • Consistency: Statistical analysis showed that 99.9% of the molecules generated by the model followed the learned "edge-first" strategy, proving that the model successfully discovered and stuck to a robust construction logic.

Limitations and Future Work

  • The Validity Gap: While LO-ARM is SOTA for ARMs, some diffusion-based models still show slightly higher validity on very complex graphs. The authors hypothesize that diffusion models might be better at "denoising" or correcting errors in sub-graphs.
  • Scaling the Adjacency Matrix: The current implementation uses a dense adjacency matrix ($O(n^2)$), which becomes computationally expensive for very large molecules or proteins.
  • Future Directions: The authors suggest exploring more memory-efficient graph representations and applying the LO-ARM framework to other domains like high-resolution image synthesis and protein design.

Summary updated

BibTeX
@inproceedings{wang2025learning,
  author = {Zhe Wang and Jiaxin Shi and Nicolas Heess and Arthur Gretton and Michalis Titsias},
  title = {{Learning-Order Autoregressive Models with Application to Molecular Graph Generation}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=EY6pXIDi3G},
}
Figure