arXiv:2610.19781stat.MLOct 2026

Manuscript Offprint

arXiv:2610.19781

SNACK: A Sequential Notation Framework for Probabilistic Graph Generation

Hohyun Kim, Hyesung Kim, Min-hwan Oh, Seunggeun Lee

Abstract

We introduce SNACK, a string representation for probabilistic graph generation that enables sequence models to generate and model graphs with discrete node and edge features. SNACK linearizes graphs by encoding the nonzero entries of the lower-triangular adjacency matrix, establishing a bijective correspondence between valid sequences and ordered adjacency matrices. This design enables invalid logit masking to enforce structural constraints—such as chemical valence and ordering rules—guaranteeing 100% valid generated sequences. SNACK also enables principled string-based GFlowNet training by explicitly accounting for node-ordering symmetries. Across standard graph-generation tasks and molecular distribution-learning benchmarks, SNACK achieves competitive sample quality, while substantially improving the throughput of GFlowNet training relative to graph-based generation. Probing analyses further show that models trained on SNACK encode meaningful local and global graph structure despite receiving only sequential supervision. These results position SNACK as a practical framework for probabilistic graph generation with deep sequence models. 1^{1}

1 Introduction

Two dominant paradigms have been widely explored for generative models for graphs with discrete features: graph-based methods [1, 2, 3], which operate directly on discrete structures, and string-based methods [4, 5, 6], which linearize graphs into sequences. While graph-based methods naturally handle valid actions or trajectories, they often demand specialized architectures and incur high computational costs. In contrast, string-based representations enable efficient training using standard sequence models. However, existing string-based methods fall short as flexible graph learning frameworks, as they typically address only a subset of key capabilities—such as guaranteed validity, general graph applicability, flexible conditional generation, or goal-directed exploration. Furthermore, a single graph can correspond to multiple valid string representations, which poses a significant challenge to probabilistic modeling. While this issue has been extensively studied in graph-based frameworks [7, 8], it has received comparatively little attention in the context of string-based approaches. Consequently, graph-based methods remain the predominant choice in frameworks such as Generative Flow Networks (GFlowNets) [9].

In this work, we address these challenges by introducing Sequential Notation of Adjacent Connectivity FrameworkK (SNACK), a novel string representation that addresses the aforementioned challenges by enabling flexible graph learning. The encoding process of SNACK mirrors the iterative construction found in adjacency matrix-based methods, where a graph is linearized row-wise. This design allows SNACK to inherit core advantages of graph-based methods, while utilizing efficient sequence training

∗^{*}Equal contribution

†^{\dagger}Corresponding authors. Emails: {minoh, lee7801}@snu.ac.kr

1^{1}Package available at https://github.com/leelabsg/snack

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

pipelines. Specifically, our learning framework provides three practical advantages: first, each representation decodes into a unique adjacency matrix, facilitating string-based GFlowNet training by introducing a node ordering policy; second, any sequence prefix can be readily decoded into a partial graph state, which enables conditioned optimization and direct logit masking during autoregressive generation; and third, SNACK maintains a compact representation, utilizing exactly N+2MN + 2M tokens for an attributed graph with N nodes and M edges, thereby avoiding redundancy while preserving structural correspondence.

We demonstrate the efficacy of SNACK across various graph-related tasks, including distribution learning and property optimization. Our results show that SNACK reliably generates high-quality samples, achieving 100% validity across all benchmarks. Furthermore, SNACK facilitates the implementation of string-based GFlowNets, significantly enhancing the scalability of GFlowNet training on graphs. We also introduce a conditioned Trajectory Balance (TB) loss specifically tailored for constrained generation. Beyond performance gains, we provide empirical evidence that SNACK internalizes graph structural information within its representation despite its sequential nature—a finding that is of independent interest. We summarize our contributions as follows.

• We introduce SNACK, a simple and efficient string representation that maintains a one-to-one correspondence with adjacency matrices.

• We propose a training methodology for string-based GFlowNets applicable to both de novo and conditioned settings, which significantly improves the scalability.

• We evaluate SNACK both on distribution and goal-directed learning tasks, showing competitive generation quality, guaranteed 100% validity, and superior exploration capabilities.

• We employ bilinear probing to show that SNACK-based models internalize graph structures within their representations from purely sequential data without explicit supervision.

References (69)