# Learning-Order Autoregressive Models with Application to Molecular Graph Generation

LO-ARM learns its generation order instead of fixing or randomizing it

Zhe Wang, Jiaxin Shi, Nicolas Heess, Arthur Gretton, Michalis K. Titsias · arXiv · 2025-3-7

- **Problem** Fixed generation orders assume a structure that graphs and images may not have. Random orders fit worse, since the model cannot learn which orders the data favors.
- **Method** LO-ARM swaps the uniform order of AO-ARMs for a trainable order-policy. The policy picks the next dimension to generate based on the dimensions already filled in.
- **Results** On QM9, LO-ARM-st-sep reaches an FCD of 0.240, versus 0.441 for CatFlow, the previous best.

## Why fixed and any orders fall short

A preset generation order can hurt because autoregressive models factorize the joint distribution into conditionals that follow that order. For text, the left-to-right order is natural, but images and graphs lack such an obvious ordering. Fixed-order ARMs therefore write an assumption into the model that the data may not support.

A random order is the obvious alternative, and any order ARMs draw it uniformly from all L! permutations. These models are less effective in likelihood scores than ARMs, and the authors suggest training difficulty as a possible reason. The network must match all possible conditional distributions over all orderings, without learning any preference towards particular orderings.

A uniform random order doesn't let the model learn which orderings the data favours. That gap motivates a model that flexibly learns probabilistic orderings instead of fixing or randomizing them.

## A learned order-policy in place of the uniform order

LO-ARM changes one thing: the uniform distribution over orderings in AO-ARMs is replaced by a trainable order-policy. The order-policy dynamically decides which dimension to generate next, instead of sampling it uniformly. It conditions on the dimensions already generated together with their values, so each choice depends on the current partial state.

The authors expect this state dependence to beat a fixed or random order, because the policy can favor positions the model is already confident about.

Formally, the order-policy is a categorical distribution over the index of the next dimension, written p\_θ(z\_i \| z\_\<i, x\_z\<i). Each factor conditions on the earlier indices z\_\<i and on the data values x\_z\<i at those indices, not only on the indices. The order-policy replaces the uniform factor p(z\_i \| z\_\<i) that appears in the latent ordering model.

If every factor is set to uniform, the joint over z becomes the uniform distribution over the L! permutations. In that case the model reduces to a standard AO-ARM, so AO-ARMs become a special case of LO-ARM. The authors also let the variational distribution q\_θ condition on the full data vector x, which keeps training feasible.

## Training through a variational bound

The exact log-likelihood sums over latent orderings, so it is intractable and the authors maximize an evidence lower bound instead. The bound uses an amortized variational distribution q\_θ(z\|x) that conditions on the full data vector x. The order-policy p\_θ(z\_i\|z\_\<i, x\_z\<i) is more restricted, because it conditions only on the dimensions x\_z\<i already generated.

The authors say this amortized factorization makes training practically feasible while still giving an efficiently computed unbiased estimate of the ELBO.

Summing the bound over all permutations is too expensive, so each training step samples one term of the sum and one prefix z\_\<i from q\_θ. The resulting stochastic loss is L(θ) = −L F\_θ(z\_\<i, x), with z\_\<i drawn from q\_θ(z\_\<i\|x). Because the sampled ordering is discrete, gradients need REINFORCE, and the authors use the leave-one-out estimator with two sample paths.

The estimator draws one random index i and two prefixes, and its gradient involves the difference ΔF between the two paths.

The variational logits g\_θ(x) define a Plackett-Luce model, so each factor is a softmax over the still-masked dimensions. Because one forward pass yields all logits, a full ordering z can be sampled in parallel with the Gumbel-top-k trick. Algorithm 1 applies this per step with RLOO gradients and SGD, which keeps training scalable. At inference, Algorithm 2 needs only the order-policy and the categorical classifier, not the variational distribution.

## How the classifier and order-policy are parametrized

The classifier is a neural network with L heads, and each head outputs a softmax over the m categories of one dimension. The authors use a UNet as the classifier for image generation and a Graph Transformer for graph generation. Each conditional is evaluated on the state where only the dimensions in z\<i are unmasked and the rest stay masked.

The order-policy is a softmax over L scores h, one per dimension, restricted to the still-masked indices in z≥i. Two options define these scores: a scaled entropy of the classifier outputs, or a shared-torso head that adds one linear layer to the classifier. The entropy option favors dimensions whose value the classifier is certain about, especially early in generation.

The variational logits g are also produced either by a shared torso or by a separate network with L outputs. The separate network option lets the authors capture the form of the variational distribution more freely. The variant names encode these choices, so LO-ARM-st-sep uses a shared torso for the policy and a separate network for the variational policy.

The authors keep the classifier fixed to the DiGress and CatFlow design and vary only the policy choices.

The ablation compares these options on molecular graph generation, using the QM9 and ZINC250k results. On QM9, LO-ARM-st-sep reaches an FCD of 0.240, versus 0.671 for AO-ARM.

## Generating samples by unmasking

Generation starts from a fully masked state, and the model fills one dimension per step. At each step, the order-policy samples the data index, and the classifier then samples a value for that index. Each step conditions on the dimensions already unmasked, so the order can differ from one sample to the next. The variational distribution is only needed during training, so inference uses just the order-policy and the classifier.

The order-policy scores come from one of two options: a scaled entropy of the classifier outputs, or a shared-torso linear output. The entropy option favors dimensions whose values the classifier is more certain about, which is why the order follows certainty early on.

Top-p sampling is an optional inference step that sharpens the classifier distribution after the policy has picked a dimension. The Top-p sampler draws only from dimensions with high probability, and p is the cumulative probability of the top dimensions. Setting p to 1.0 samples the entire distribution, and a lower p makes the sampler greedier.

On ZINC250k, Top-p = 0.9 raised validity for LO-ARM-st-st-topp from 90.84 to 96.02, while FCD worsened from 4.087 to 9.237. Because the sharpening happens only at test time, the training-time NLL is omitted for the Top-p rows.

LO-ARM-st-sep stays robust under Top-p, and its FCD moved only from 3.229 to 3.859 when p was set to 0.3. The authors read this as evidence that the policy concentrates probability mass on certain dimensions. LO-ARM-st-st-topp is cheaper to train because it needs no separate network, while inference costs stay close.

## QM9 FCD results: does the learned order help?

The authors generated 16384 samples per model variant and scored them on validity, uniqueness and FCD. Every LO-ARM variant in Table 1 gets a lower FCD than AO-ARM, which the authors read as the learned order helping. The sharpest gap is LO-ARM-st-sep, with an FCD of 0.240, compared to 0.441 for CatFlow, the previous best method.

![Table 1: Molecule generation on QM9. We directly cite the results of other methods. The negative loglikelihoods (NLLs) of our methods are evaluated against the…](https://refivu.com/papers/504d6ec4-8539-4bc7-b02b-fe990e79896e/figures/figure-cc4cf57ced859c55ad3f3aad2d9291b1.png?thumb=512)

**Table 1** . Molecule generation on QM9. We directly cite the results of other methods. The negative loglikelihoods (NLLs) of our methods are evaluated against the test set, and other metrics are calculated with the generated samples with the corresponding methods.

[Original paper](https://arxiv.org/abs/2503.05979v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

LO-ARM-st-st scores an FCD of 0.437, which sits close to CatFlow's 0.437 and 0.441 range, so it performs similarly to the previous best. The authors credit the further gain to the separate variational network, which adds capacity to the variational order policy. Inference with LO-ARM-st-sep stays close in cost to other Graph Transformer methods, because only the model order policy and the classifier run at inference.

They didn't test a different variational network size in this section, so the capacity claim rests on the two variants compared. FCD and validity aren't tied to each other, since invalid molecules can still have latent activations close to valid ones.

## ZINC250k FCD and the Top-p trade-off

On ZINC250k, LO-ARM faces a harder benchmark of larger drug-like molecules. The number of data dimensions grows as O(n2) with the atom count n, because the graph is stored as a dense adjacency matrix. AO-ARM reaches an FCD of 6.541 in Table 2, and Biased-AO-ARM reaches 5.026. LO-ARM-st-sep brings the FCD down to 3.229, which is well below AO-ARM's 6.541.

The lowest prior FCD in Table 2 is CatFlow's 13.21, so the gap to earlier work is wide.

![Table 2: Molecule generation on ZINC250K. In particular, the NLLs of the LO-ARMs with the Top-p sampling are omitted as the sampler is only used in inference t…](https://refivu.com/papers/504d6ec4-8539-4bc7-b02b-fe990e79896e/figures/figure-4169761c79117ec38fcc24823b2ffa53.png?thumb=512)

**Table 2** . Molecule generation on ZINC250K. In particular, the NLLs of the LO-ARMs with the Top-p sampling are omitted as the sampler is only used in inference time and does not change the training-time metrics.

[Original paper](https://arxiv.org/abs/2503.05979v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

Top-p sampling is the test-time lever that trades validity against FCD. The Top-p sampler picks from high-probability dimensions, with p set to the cumulative probability of the top dimensions. With Top-p = 0.9, LO-ARM-st-st raises validity from 90.84 to 96.02. In the same step, its FCD rises from 4.087 to 9.237. The authors describe this as a small bias that moves the model away from the data distribution.

LO-ARM-st-sep is more robust to Top-p, so lowering p to 0.3 is a useful test. Its FCD moves from 3.229 to 3.859, which the authors call a marginal downgrade. The authors read this as the model order policy putting most of its probability on confidently predicted dimensions.

LO-ARM-st-st-topp matches LO-ARM-st-sep on validity and uniqueness. LO-ARM-st-sep gives the better FCD, while LO-ARM-st-st-topp trains more efficiently without a separate network. Inference costs are close for both, because the variational order policy isn't needed at inference. The authors say both options can be useful, depending on what the user needs.

## Chemistry measures beyond FCD

FCD alone can't show whether generated molecules are good, so the authors added QED, SAS and pairwise similarity. SAS measures how easy a compound is to synthesize, where a lower score means easier synthesis. QED measures how well a compound's physicochemical properties match those of successfully administered drugs, where a higher score means a closer match.

Pairwise similarity measures diversity in the samples, and a lower score means higher diversity. LO-ARM-st-sep reaches a QED of 0.75 and an SAS of 3.08 on ZINC250k. The ground truth test data scores 0.75 on QED and 2.76 on SAS. Its pairwise similarity is 0.34, close to the ground truth value of 0.35, so its samples are about as diverse as the data.

![Table 3: LO-ARM’s perforamance on chemistry-specific metrics on ZINC250k. Specifically, lower similarity indicates higher diver- sity for molecules in the data…](https://refivu.com/papers/504d6ec4-8539-4bc7-b02b-fe990e79896e/figures/figure-44a2f8444d4498851db90e896f9b1bb2.png?thumb=512)

**Table 3** . LO-ARM’s perforamance on chemistry-specific metrics on ZINC250k. Specifically, lower similarity indicates higher diver- sity for molecules in the dataset. On all these metrics, LO-ARM exceeds or matches the performance of the state-of-the-art results of the models. The results of other methods are cited from (Mazuz et al., 2023). V .is short for Validity.

[Original paper](https://arxiv.org/abs/2503.05979v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)

The authors checked the same metrics on QM9 and found that the sample distributions match the ground truth there too. Figure 2 shows these distributions for both ZINC250k and QM9. The metric rows for JT-VAE, GCPN and Taiga are cited from Mazuz et al. (2023), so the authors didn't rerun those methods. JT-VAE reports a QED of 0.64, GCPN 0.65, and Taiga 0.75 on QED.

LO-ARM matches or exceeds the previous best results on all three metrics, as the authors state.

LO-ARM doesn't lead on every row, because Taiga's SAS of 2.89 is lower than LO-ARM's 3.08. Validity is a separate column, and LO-ARM's 96.26 sits below JT-VAE's 100.00 in the same table. Validity and uniqueness are fairly saturated by existing methods, so the authors focused on these chemistry metrics.

## What order the model learns

Figure 1 follows one ZINC250k molecule through generation, showing the order-policy distribution and classifier entropy at each step. Generation runs in three phases: bond skeleton construction, then the no-edge states that stand in for imaginary bonds, then atom type assignment. Each step first has the order-policy select a dimension, and then the classifier determines its value.

At Step 1, dimensions with higher policy probability correspond to lower entropy.

![Figure 1: An example of molecule generation with our best LO-ARM model trained on ZINC250k. Our model generates molecules step-by-step, commencing with all nod…](https://refivu.com/papers/504d6ec4-8539-4bc7-b02b-fe990e79896e/figures/figure-93c70fbf0873892ef4bb92cab922ee0b.png?thumb=512)

**Figure 1** . An example of molecule generation with our best LO-ARM model trained on ZINC250k. Our model generates molecules step-by-step, commencing with all nodes and edges masked (in the figures masked nodes are labeled as x) and adding one node or edge at a time. First, an order-policy selects which dimension (node or edge) to fill, and then a classifier determines its value. Each step is illustrated in the provided figures: Columns (a) and (b) illustrate the (partially) generated molecular structures at two successive generation steps. Columns (c), (d), and (e) provide detailed insights: (c) the order-policy’s probability distribution over dimensions, (d) the classifier’s entropy for each dimension, and (e) the classifier’s prediction at the selected dimension. Note that, the order-policy and classifier entropy are zeroed for unmasked dimensions. The generation proceeds through three phases: bond skeleton construction, “no-edge” state population (representing “imaginery” bonds in the dense adjacency matrix), and atom type assignment. In particular, the order-policy learns to favor dimensions with high classifier certainty, demonstrated by an inverse relationship between policy probability and classifier entropy. For example, at Step 1, dimensions with higher probabilities in (c) correspond to lower entropies in (d). This trend is especially evident during the “no-edge” infilling phase, where masked edge dimensions at Step 20 and 152 exhibit high order-policy probabilities and near-zero classifier entropies, while masked node dimensions show the inverse. Importantly, the classifier assigns probabilities to potential values, enabling valid molecular variations. For instance, at Step 171, as shown in (e), the final masked atom has a near-equal chance of being Carbon, Nitrogen, or Sulfur, resulting in three different yet valid molecules. Step 19 also demonstrates this, with each possible edge value offering a different, yet feasible, molecular structure. We provide the full generation path in Appendix B.2.

[Original paper](https://arxiv.org/abs/2503.05979v2) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Zhe Wang, Jiaxin Shi, Nicolas Heess, Arthur Gretton, Michalis K. Titsias · Learning-Order Autoregressive Models with Application to Molecular Graph Generation · Original paper figure · Extracted the figure area from page 2 of the original PDF.

In the no-edge phase, masked edge dimensions at Step 20 and 152 get high policy probability and near-zero classifier entropy. Masked node dimensions show the inverse pattern in the same phase. To check consistency, the authors sampled 30, 000 molecules from three LO-ARM-st-sep models trained with different random seeds. They found that 99.9% of these molecules were generated with the edge-first ordering.

The authors compare LO-ARM with Biased-AO-ARM, which uniformly samples edges first and then nodes after all edges are unmasked. Biased-AO-ARM fixes the edge-first structure but chooses uniformly within each group. So the gain comes from choosing within each group, not only from picking edges first.

## Where the reported gains stop

LO-ARM-st-sep reaches a validity of 96.26 on ZINC250k, while CatFlow reaches 99.21. The authors hypothesize that this gap comes from errors accumulated during autoregressive sampling. They explain that the model unmasks one new dimension at a time and doesn't refine the dimensions it already unmasked. Even so, LO-ARM gains validity over AO-ARM and GraphARM, which the authors credit to training an order-policy that maximizes the ELBO.

Top-p sampling narrows the validity gap further, with Biased-AO-ARM-topp and LO-ARM-st-st-topp both rising by a large margin. That gain comes at a cost in FCD, because Top-p sampling adds a small bias that moves the model away from the true data distribution. LO-ARM-st-sep-topp with p set to 0.3 reaches 96.70 validity and 3.859 FCD, so the two goals trade off.

The experiments cover only QM9 and ZINC250K molecular graphs. The MNIST image experiment is a qualitative illustration rather than a quantitative evaluation. The authors evaluate each variant on 16384 generated samples, scored by validity, uniqueness and FCD. They name richer molecular constraints in the ordering policies as one route to better validity.

They also point to a more memory-efficient graph representation, since the full adjacency matrix must be stored now. Scaling to higher-resolution images and protein design remains future work in the authors' view.

## Paper info

- **Authors**: Zhe Wang, Jiaxin Shi, Nicolas Heess, Arthur Gretton, Michalis K. Titsias
- **Venue**: arXiv · Preprint
- **First published**: 2025-3-7
- **Added**: 2026-10-31
- **Updated**: 2025-7-13
- **Version**: v2
- **arXiv**: 2503.05979
- **Category**: cs.LG · cs.AI · stat.ML
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2503.05979v2) · [PDF ↗](https://arxiv.org/pdf/2503.05979v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Autoregressive models (ARMs) have become the workhorse for sequence generation tasks, since many problems can be modeled as next-token prediction. While there appears to be a natural ordering for text (i.e., left-to-right), for many data types, such as graphs, the canonical ordering is less obvious. To address this problem, we introduce a variant of ARM that generates high-dimensional data using a probabilistic ordering that is sequentially inferred from data. This model incorporates a trainable probability distribution, referred to as an order-policy, that dynamically decides the autoregressive order in a state-dependent manner. To train the model, we introduce a variational lower bound on the log-likelihood, which we optimize with stochastic gradient estimation. We demonstrate experimentally that our method can learn meaningful autoregressive orderings in image and graph generation. On the challenging domain of molecular graph generation, we achieve state-of-the-art results on the QM9 and ZINC250k benchmarks, evaluated across key metrics for distribution similarity and drug-likeless.

## Quote from the paper

Zhe Wang, Jiaxin Shi, Nicolas Heess, Arthur Gretton, Michalis K. Titsias (2025). Learning-Order Autoregressive Models with Application to Molecular Graph Generation. arXiv:2503.05979v2. https://arxiv.org/abs/2503.05979v2

**BibTeX**

```
@misc{wang2025learning,
  title = {{Learning-Order Autoregressive Models with Application to Molecular Graph Generation}},
  author = {Zhe Wang and Jiaxin Shi and Nicolas Heess and Arthur Gretton and Michalis K. Titsias},
  year = {2025},
  eprint = {2503.05979},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.05979v2}
}
```

## Other paper commentary

- [Subgroups Matter for Robust Bias Mitigation](https://refivu.com/en/papers/2a39c8a2-c675-4178-942e-a231ced5722f-subgroups-matter-for-robust-bias-mitigation.md)
- [Stochastic Encodings for Active Feature Acquisition](https://refivu.com/en/papers/dafe6547-b3c0-4ca9-a7fe-82ee925a0c88-stochastic-encodings-for-active-feature-acquisition.md)
- [Scalable Gaussian Processes with Latent Kronecker Structure](https://refivu.com/en/papers/1d5b6ab1-f72e-49ab-842e-cf71b44106cd-scalable-gaussian-processes-with-latent-kronecker-structure.md)
- [On the Computational Complexity of Performative Prediction](https://refivu.com/en/papers/7a4b721a-31e6-4690-bc6d-b8f8286675f0-on-the-computational-complexity-of-performative-prediction.md)
- [Learning to Discover at Test Time](https://refivu.com/en/papers/16b1e431-51ac-4e6b-a951-6aa5a5c017bb-learning-to-discover-at-test-time.md)
- [A unified framework for learning with nonlinear model classes from arbitrary linear samples](https://refivu.com/en/papers/cd3c393f-7a82-47bc-9d3e-9770cfc27865-a-unified-framework-for-learning-with-nonlinear-model.md)
- [DataDecide: How to Predict Best Pretraining Data with Small Experiments](https://refivu.com/en/papers/b2e5b927-f525-4063-8956-246603aff1fb-datadecide-how-to-predict-best-pretraining-data-with.md)
- [From Generative to Episodic: Sample-Efficient Replicable Reinforcement Learning](https://refivu.com/en/papers/b78b13e6-6d29-4338-85d7-9e0fdb6ad862-from-generative-to-episodic-sample-efficient-replicable.md)
- [Improving Transformer World Models for Data-Efficient RL](https://refivu.com/en/papers/bf0a569b-7476-4cd0-91b8-a28e0935c805-improving-transformer-world-models-for-data-efficient-rl.md)
- [Geometry-Informed Neural Networks](https://refivu.com/en/papers/da0a16b6-9d7a-4d46-a972-fe3929ea063a-geometry-informed-neural-networks.md)
- [The Surprising Agreement Between Convex Optimization Theory and Learning-Rate Scheduling for Large Model Training](https://refivu.com/en/papers/3a431e7f-c68b-477b-a0ef-073c8d045e7b-the-surprising-agreement-between-convex-optimization-theory.md)
- [History-Guided Video Diffusion](https://refivu.com/en/papers/6108fb68-ef01-4b85-84db-35036f8a36f4-history-guided-video-diffusion.md)

## Terms in this paper

- [MNIST](https://refivu.com/en/terms/28b9bb66d1c6-mnist)
- [UNet](https://refivu.com/en/terms/0da000173b9b-unet)
- [evidence lower bound](https://refivu.com/en/terms/ab8bf35324c3-evidence-lower-bound)
- [NLL](https://refivu.com/en/terms/3041c8261098-nll)
- [DiGress](https://refivu.com/en/terms/9aa0a52bdef5-digress)
- [QM9](https://refivu.com/en/terms/368ccd2fa100-qm9)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/504d6ec4-8539-4bc7-b02b-fe990e79896e-learning-order-autoregressive-models-with-application-to)
