Flatten Graphs as Sequences: Transformers are Scalable Graph Generators

De-Xiong Chen, Markus Krimmel, Karsten M. Borgwardt
2/1/2025
15 citations
diffusion-flowtransformer-attention

No official code found. Best implementation: BorgwardtLab/AutoGraph (18 stars, Python, BSD-3-Clause, last commit 2025-10-17).

Abstract

We introduce AutoGraph, a scalable autoregressive model for attributed graph generation using decoder-only transformers. By flattening graphs into random sequences of tokens through a reversible process, AutoGraph enables modeling graphs as sequences without relying on additional node features that are expensive to compute, in contrast to diffusion-based approaches.

Show full abstract

This results in sampling complexity and sequence lengths that scale optimally linearly with the number of edges, making it scalable and efficient for large, sparse graphs. A key success factor of AutoGraph is that its sequence prefixes represent induced subgraphs, creating a direct link to sub-sentences in language modeling. Empirically, AutoGraph achieves state-of-the-art performance on synthetic and molecular benchmarks, with up to 100x faster generation and 3x faster training than leading diffusion models. It also supports substructure-conditioned generation without fine-tuning and shows promising transferability, bridging language modeling and graph generation to lay the groundwork for graph foundation models. Our code is available at https://github.com/BorgwardtLab/AutoGraph.

View on arXivView PDF

Code Implementations(1)

BSD-3-Clause

Official code for "Flatten Graphs as Sequences: Transformers are scalable graph generators" (NeurIPS 2025)

181Python, C++Jan 29, 20251 years agoBSD-3-Clause
autoregressive-modelsgraph-generative-modelsmolecular-generationneurips-2025

Similar Papers

Cite this paper

@article{chen2025flatten,
  title  = {Flatten Graphs as Sequences: Transformers are Scalable Graph Generators},
  author = {De-Xiong Chen and Markus Krimmel and Karsten M. Borgwardt},
  year   = {2025},
  eprint = {2502.02216},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2502.02216},
  url    = {https://doi.org/10.48550/arXiv.2502.02216},
  journal = {Neural Information Processing Systems}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.02216.svg)](https://codeofpaper.com/paper/2502.02216)

Discussion