SNACK: A Sequential Notation Framework for Probabilistic Graph Generation

stat.ML cs.LG Hohyun Kim, Hyesung Kim, Min-hwan Oh, Seunggeun Lee · Oct 14, 2026
Local to this browser
What it does
SNACK addresses the challenge of generating attributed graphs using standard sequence models without sacrificing structural validity or probabilistic correctness. Its core idea is a bijective string encoding of the lower-triangular...
Why it matters
Its core idea is a bijective string encoding of the lower-triangular adjacency matrix that, when paired with BFS ordering and invalid logit masking, guarantees 100% valid outputs and enables exact computation of the sequence-to-graph...
Main concern
Overall, SNACK is a conceptually clean and practically useful contribution. The bijectivity proof (Appendix A.
Community signal
0
0 up · 0 down
Sign in to vote with arrows
AI Review AI reviewed
Plain-language introduction

SNACK addresses the challenge of generating attributed graphs using standard sequence models without sacrificing structural validity or probabilistic correctness. Its core idea is a bijective string encoding of the lower-triangular adjacency matrix that, when paired with BFS ordering and invalid logit masking, guarantees 100% valid outputs and enables exact computation of the sequence-to-graph distribution $q(\mathbf{x}|G)$. This matters because it bridges the efficiency of autoregressive Transformers with the principled reward-matching guarantees of GFlowNets, a combination that prior non-injective string representations like SMILES could not support.

Critical review
Verdict
Bottom line

Overall, SNACK is a conceptually clean and practically useful contribution. The bijectivity proof (Appendix A.4) and the explicit derivation of $q(\mathbf{x}|G) = |\mathrm{Aut}(\mathbf{A})| \cdot q^{\mathrm{ord}}(\pi|G)$ give GFlowNet training a rigorous foundation that prior string-based molecular representations lacked. The logit masking mechanism genuinely guarantees 100% validity in the generated sequences. That said, the empirical case that SNACK dominates existing strings for distribution learning is weak—its metrics on QM9 and MOSES are competitive but not decisively better than SELFIES or SMILES—and some of the goal-directed gains may stem from architectural efficiency (a single Transformer forward pass versus repeated graph Transformer evaluations) rather than representational superiority alone. The paper also overstates the uniqueness of its conditioned-generation success rate without acknowledging that competing string formats were not designed for arbitrary prefix-extension.

“The SNACK representation is bijective with respect to the adjacency matrix.”
SNACK paper · Proposition 1, Section 2.5
“This corresponds to a reduction in both computational and memory complexity from cubic to quadratic in the number of nodes.”
SNACK paper · Section 2.7
What holds up

The strongest aspect of the paper is its formal grounding. Proposition 1 establishes a true bijection between ordered adjacency matrices and SNACK sequences, which directly solves the many-to-one sequence-to-graph problem that plagues SMILES and SELFIES and makes prior string-based GFlowNet objectives inherently biased. The prefix-decodability property is equally valuable: because every partial SNACK string maps to a well-defined partial graph, the authors can apply grammar, valence, and BFS logit masks during autoregressive decoding, rigorously guaranteeing valid outputs. The complexity analysis in Appendix C is precise, showing that trajectory evaluation drops from $O(N^3)$ for graph-based Transformers to $O(N^2)$ for SNACK.

“The SNACK representation is bijective with respect to the adjacency matrix.”
SNACK paper · Section 2.5, Proposition 1
“Each element in a SNACK sequence corresponds directly to a component of the graph, such as a node or an edge, making the representation easy to interpret. As a result, an intermediate graph can be readily decoded from a partially generated sequence.”
SNACK paper · Section 2.3
Main concerns

First, the distribution-learning experiments (Table 2) do not show a compelling advantage over SELFIES or even SMILES on QM9 and MOSES. SNACK (V+B) matches SELFIES on FCD but does not clearly dominate it, and the practical payoff of a more complex encoding scheme is limited when mature alternatives already achieve near-perfect validity and similar downstream metrics. The claim that BFS ordering outperforms Cuthill–McKee (Table 6) contradicts prior work by Diamant et al. and Jang et al., yet the rebuttal offered—dataset dependence and evaluation metrics—is post-hoc and based on a single benchmark comparison; the paper provides no principled reason to prefer BFS in general.

Second, the conditioned-generation success rate (Table 3) is misleading as a comparative metric. SNACK is designed so that any prefix ending in a node token is a valid partial graph, whereas SMILES and SELFIES are not constructed to allow arbitrary extension of internal substructures. Reporting that SMILES terminates immediately is therefore an expected artifact of representation design, not evidence of representational quality. Moreover, the evaluation uses only the 129 smallest MOSES test molecules with 100 random sequences each, a sample too small for robust statistical conclusions. Finally, while the probing analysis (Section 5) reports impressive adjacency reconstruction AUROC (0.9998), it controls only against a random model and SMILES; it does not rule out simple memorization of frequent bond patterns rather than deep structural abstraction.

“BFS ordering outperforms both uniform and CM orderings on both datasets... We attribute this discrepancy to two factors. First, the relative advantage of CM ordering is likely dataset-dependent.”
SNACK paper · Section 4.4
“SNACK (None) yields a high success rate... where success requires a generated molecule to be valid, connected, contain the target substructure, and possess strictly more heavy atoms.”
SNACK paper · Section 4.2, Table 3
Evidence and comparison

The evidence supports the technical claims about SNACK’s validity guarantees and GFlowNet compatibility, but key comparisons are incomplete or uneven. For goal-directed learning (Table 4), the graph-based baseline is a 4-layer graph Transformer that recomputes action probabilities at each construction step; SNACK’s advantage in Top-100 reward on albuterol and aripiprazole is confounded by the fact that SNACK amortizes trajectory evaluation into a single forward pass, whereas the graph baseline requires $N+M$ passes. The paper does not isolate the representation effect from the architectural/algorithmic efficiency effect. In the molecular string generation task (Table 2), the authors standardize the LLaMA-style Transformer across methods, which is fair for comparing representations, yet they omit recent graph-based diffusion or flow-matching baselines that currently set the state of the art in molecule generation, limiting the reader’s ability to gauge absolute performance.

“By standardizing the underlying architecture and excluding method-specific tricks, we ensure that any observed performance gains are directly attributable to the representations themselves.”
SNACK paper · Section 4.2
“Notably, results further improve when BFS masking is enforced. This constraint is particularly beneficial for GFlowNet training, as it ensures that every generated sequence possesses a strictly positive backward flow, thereby enhancing overall training stability.”
SNACK paper · Section 4.3
Reproducibility

Reproducibility is partially strong but missing critical details. The authors provide a public GitHub repository (footnote 1) and clearly specify the LLaMA-based Transformer architecture (6 layers for distribution learning, 4 for goal-directed; Appendix F). However, the main text omits training budgets (number of steps, wall-clock time, GPU types), exact learning rates, and batch sizes, pushing these to Appendix F without explicit page references. The GFlowNet reward functions and conditioning protocols are described only at a high level in the main text, with full derivations relegated to Appendices E and F. The nauty package dependency for automorphism counting is mentioned as efficient but version-specific behavior is not documented. Reproducing the exact BFS masking rules requires careful implementation of Algorithm 1 and the recursive constraints in Appendix A.2, which are non-trivial.

“Package available at https://github.com/leelabsg/snack”
SNACK paper · Footnote 1 / Abstract
“For distribution learning, we employ 8.9M-parameter, 6-layer Transformers based on the LLaMA architecture... Further implementation and experimental details are provided in Appendix F.”
SNACK paper · Section 4
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.

Challenge the Review

Pick a starting point or write your own. Challenges run in the background, so you can keep reading while the AI investigates.

No challenges yet. Disagree with the review? Ask the AI to revisit a specific claim.