Manuscript Offprint

arXiv:2609.37604

GraphVQ: Structure-Aware Autoregressive Decoding over Context-Quantized Graph Tokens

Yuxiang Yao, Zijun Zhao

ABSTRACT

Graph foundation models need a discrete token representation, but casting a graph as a generatable token sequence faces a structural obstacle: edges spanning beyond the serialization window cannot be emitted in one pass—so one-pass autoregressive generators systematically under-produce cycles—and a single global condition cannot tell candidate edges apart. GRAPHVQ removes both obstacles: node contexts—features plus a local edge mask under multi-order breadth-first serialization—are quantized into a shared codebook by a VQ-VAE with BCE-calibrated Bernoulli edge decoding, and a second-stage structure-aware decoder emits the global adjacency conditioned on token-derived pair features, whose necessity over any global-summary condition is formalized in a scoped impossibility result. The tokenizer reconstructs node features at 0.86–0.99 accuracy and decodes local edges at AUROC ≥ 0.89 (ECE ≤ 0.007). Under one same-split protocol on four datasets, pair conditioning improves orbit MMD 0.248 → 0.174 on PROTEINS and 3.4× on a ring stress test, and vanishes on a random-label control—the signature of attribute–topology coupling—so the gain is claimed exactly where attributes carry edge-relevant signal. GRAPHVQ ranks first among learned generators on PROTEINS, ties for first on SYN-COMM, and improves orbit MMD 2.7–17× over one-stage generation on three datasets, with seed-level bootstrap intervals confirming the rankings are not seed noise; on MUTAG the unweighted edge target under-generates and is reported as such. These results locate the structural control of autoregressive graph generation in the granularity of the condition: pair-level token context turns a quantized vocabulary into a usable capacity axis for distribution-faithful graph generation and future token-level pretraining.

1 INTRODUCTION

Graphs describe molecules, proteins, social and citation networks, and knowledge bases, and graph neural networks are the standard tool for supervised learning over them Xu et al. (2019); Kipf & Welling (2017); Hamilton et al. (2017). Yet the field has not produced the analogue of a language or vision foundation model: a single pretrained model that transfers across graphs of different sizes, feature spaces, and domains Wang et al. (2024); Xia et al. (2024). A core obstacle is representational. Text and images are mapped to discrete token sequences before a shared autoregressive or masked model is trained at scale Kaplan et al. (2020); Hoffmann et al. (2022); graphs resist this recipe because nodes are not naturally ordered, node features vary in dimensionality, and topologies differ across datasets. Building a discrete, transferable graph vocabulary—a graph tokenizer—is therefore a central problem for graph foundation models Guo et al. (2026).

Vector quantization (VQ) is the natural candidate: encode local graph contexts and quantize them into a finite shared codebook, following VQ-VAE van den Oord et al. (2017) and the graph-specific designs GQT Wang et al. (2025) and GFT Wang et al. (2024). Discrete tokens bring a finite alphabet, cross-entropy training, and a uniform token-level interface—the ingredients of token-level pretraining.

†^{\dagger}Equal contribution. *Corresponding author.

We do not claim discretization is the only route to autoregressive generation; we claim something testable: the discrete vocabulary earns its keep inside the generative pipeline, verified against controls that vary the token representation (Sec. 4).

The second ingredient is structural. Under any fixed serialization, an edge whose endpoints lie more than W positions apart cannot be emitted in one pass, and a cycle needs every one of its edges—so the residual long-span edges that BFS leaves uncovered break cycles and motifs, and one-pass generators systematically under-produce cycles (Fig. B.2, Appendix B). A two-stage scheme—sample node tokens first, then decode the global adjacency—removes the window limit, but only if the edge phase is conditioned on information that actually predicts edges. A single global summary such as the mean node feature is provably insufficient when it carries no endpoint information (Proposition 1, scoped accordingly). We verify this directly: enriching the condition from the mean feature to token-derived pair features improves orbit MMD from 0.248 to 0.174 on PROTEINS (paired t=−6.1t=-6.1) and by 3.4×3.4\times on a synthetic ring stress test, while on a random-label control—which removes attribute-topology coupling but keeps the local adjacency context—the gain vanishes, exactly as the attribute-coupling hypothesis predicts.

We present GRAPHVQ, a minimal pipeline that combines both ideas. Nodes are serialized in breadth-first (BFS) order with random roots and tie-breaking; each node context is quantized into a shared codebook; a two-layer GRU prior factorizes the token sequence; and generation is two-stage, with Stage B an autoregressive edge decoder conditioned on token-derived pair features over the blocked upper-triangular adjacency. Our contributions are:

• Structure-aware autoregressive decoding over token-derived pair contexts. Stage B builds per-pair features from token embeddings, their interaction, position, and a graph-level summary, pools them per chunk, and emits chunked bits as masked independent Bernoulli with positional readouts. Replacing the global mean condition with pair features improves orbit MMD 0.248→0.1740.248 \rightarrow 0.174 on PROTEINS ( t=−6.1t = -6.1) and 3.4×3.4 \times on a ring stress test, while the gain disappears on a random-label control—the signature of attribute-topology coupling.

• A calibrated context-quantized graph tokenizer. BCE-calibrated Bernoulli edge decoding reaches AUROC ≥0.95 and ECE ≤0.005 on real data, and removing the local-structure context collapses generation (orbit MMD 0.59–1.17): the quantized context, not the attributes alone, carries the structural signal.

• Competitive end-to-end generation under a same-split protocol. Against seven baselines and two controls on four datasets (five seeds, 10,000 samples, pre-registered mean-rank over ten methods), GRAPHVQ ranks first among learned generators on PROTEINS, ties Raw for first on SYN-COMM, and beats the continuous-latent control on three of four datasets.

• Separate conditional-reconstruction and free-generation evaluation, and order-robust serialization. Conditional Stage B metrics under true conditions are reported apart from free-generation distribution metrics, the condition gap (0.005–1.68 nats/bit) is reported without over-reading, and shuffled-condition plus unconditional controls locate where the condition earns its gain. Multi-order BFS augmentation lowers held-out sequence NLL from 1.44 to 1.10 on MUTAG.

References (31)

  • Molgan: An implicit generative model for small molecular graphs (opens arXiv in a new tab)
  • Taming transformers for high-resolution image synthesis
  • Graph tokenization for bridging graphs and transformers
  • Inductive representation learning on large graphs
  • Training Compute-Optimal Large Language Models
  • Score-based generative modeling of graphs via the system of stochastic differential equations
  • Graph generation with diffusion mixture
  • Scaling Laws for Neural Language Models
  • Semi-supervised classification with graph convolutional networks
  • Autoregressive diffusion model for graph generation
  • Efficient graph generation with graph recurrent attention networks
  • Towards neural scaling laws on graphs (opens arXiv in a new tab)
  • SPECTRE: Spectral conditioning helps to overcome the expressivity limits of one-shot graph generators
  • TUDataset: A collection of benchmark datasets for learning with graphs (opens arXiv in a new tab)
  • Generating diverse high-fidelity images with VQ-VAE-2
  • GraphVAE: Towards generation of small graphs using variational autoencoders
  • Neural discrete representation learning
  • Digress: Discrete denoising diffusion for graph generation
  • Learning graph quantized tokenizers for transformers
  • Gft: Graph foundation model with transferable tree vocabulary
  • Opengraph: Towards open graph foundation models (opens arXiv in a new tab)
  • How powerful are graph neural networks? In International Conference on Learning Representations (ICLR), 2019
  • Graphrnn: Generating realistic graphs with deep auto-regressive models
  • Structure-aware multi-token graph transformer for node classification
  • BFS keeps edges local ( $\geq$93% coverage at W=8 and $\geq$98% at W=16); the uncovered remainder—long-span edges—breaks the cycles and motifs that contain them, motivating Stage B
  • BFS keeps $\geq$ 88% of edges within W=8 and 0.98–1.00 within W=16; the residual long-span edges are what one-stage generation cannot emit
  • The oracle-to-generated gap is $\leq 0.009$ nats/bit on MUTAG/PROTEINS and substantially larger on the synthetic benchmarks, where the token prior's samples diverge most from true conditions
  • Two-stage decoding restores denser motifs than one-stage sampling; residual under-generation remains (cf
  • On MUTAG the direction reverses: GRAPHVQ beats only the configuration model ($p = .002$) and is significantly worse than the continuous control ($p = .030$) and GraphRNN ($p = .049$), the honest fourth place of Table 1
  • (i) Utilization is data-limited, not model-limited: active codes and perplexity grow with dataset complexity (SYN-COMM > PROTEINS > MUTAG > SYN-RING-ROLE)—the effective vocabulary size is set by the data, so $K$ should be read as an upper bound
  • >MUTAG</td><td>context</td><td>12/32</td><td>.625</td><td>9.49</td><td>.76</td></tr><tr><td>feature-only</td><td>4/32</td><td>.875</td><td>2.30</td><td>.94</td></tr><tr><td rowspan=