Manuscript Offprint

arXiv:2610.28618

Efficient Edge-aware Attention Network for Graph Generation

Vincent Jung, Alba Carballo-Castro, Yiming Qin, Lonneke van der Plas, Pascal Frossard

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Graph generative models commonly use graph-specific Transformer architectures to jointly update node and edge features. However, these architectures do not directly benefit from recent hardware-aware attention implementations, limiting their scalability. The adaptation is, however, non-trivial: edge and graph-level features must be injected into pairwise attention scores, graph masks must be respected, and dynamic edge updates remain a major source of quadratic memory usage. We propose an edge-aware attention layer for graph generation that incorporates structural information through head-wise score modulation, while updating edge representations with a lightweight residual mechanism that retains attention-score dependent edge updates. This layer can be effectively implemented using PyTorch's FlexAttention. We achieve similar generation quality to our baseline while reducing peak GPU memory by around 65% and substantially improving training and sampling throughput. These results suggest that the proposed architecture is a practical step toward scalable graph foundation models.

Code

1. Introduction

Graph generation (Simonovsky & Komodakis, 2018; Martinkus et al., 2022; Jo et al., 2024) has advanced substantially with discrete diffusion and flow-based models. A particularly influential line of work, initiated by the diffusion model DiGress (Vignac et al., 2023), and then flow-based models such as CatFlow (Eijkelboom et al., 2024), DeFoG (Qin et al., 2025a), BWFlow (Jiang et al., 2026), and VBFN (Xiong et al., 2026), and diffusion models such as Cometh (Siraudin et al., 2025), relies on a specific transformer backbone to denoise categorical node and edge features. This architecture is inspired by the original Graph Transformer (Dwivedi & Bresson, 2021), which already updates edge states from attention scores and uses edge states to modulate self-attention. The main differences are that it computes attention between all nodes as opposed to restricting it to neighbors, maintains a graph-level feature vector and uses FiLM (Perez et al., 2018) modules to couple node, edge, and graph-level features. This dense, layered interaction is central to its success in graph generation, where the model must capture both local connectivity and global graph structure.

However, this expressivity comes with a computational cost. Since the model must maintain dense pairwise edge states, both attention computation and dynamic edge representations scale quadratically with the number of nodes, making training expensive and difficult under limited GPU resources. A large body of work addresses this bottleneck through sparse attention patterns (Shirzad et al., 2023); hybrid local-global designs (Rampášek et al., 2022); linear and operator-based alternatives (Deng et al., 2024; Sancak et al., 2025); or tokenization-based formulations that cast graphs as sequences of node and edge tokens and apply standard Transformers with minimal graph-specific modifications (Kim et al., 2022). These methods are effective, but typically modify or replace dense self-attention altogether. In graph generation specifically, SparseDiff (Qin et al., 2025b) exploits sparsity to enable training on larger graphs, although this increases sampling time.

In this work, we take a complementary route and ask whether the original dense edge-aware architecture can be implemented more efficiently while fully preserving its inductive bias. We focus on the computationally-expensive and memory-hungry attention layer in the original implementation, and design a kernel-friendly version which still modulates attention scores using edge and global features, respects graph masks, and enables edge features update from its attention map. This version can be implemented entirely using FlexAttention (Dong et al., 2025), which supports custom attention score modifications and masking. This enables us to use fused attention kernels, bringing throughput and memory gains.

∗^{*}Equal contribution 1^{1}LTS4, EPFL, Lausanne, Switzerland 2^{2}Università della Svizzera italiana, Lugano, Switzerland. Correspondence to: first_name.last_name@epfl.ch.

The Workshop on Graph Foundation Models at the 43rd43^{rd} International Conference on Machine Learning, Seoul, South Korea. Copyright 2026 by the author(s).

Empirically, our proposed model (FlexAttentionGT) matches the generation quality of DeFoG (Qin et al., 2025a)'s original backbone while reducing peak memory by 65% and improving training and inference throughput by 45% and 94% on average. Ablations show that the edge update is critical: simplifying it causes generation collapse, whereas reducing model size leads to slower convergence and worse final performance. Together, these results demonstrate that edge-aware graph Transformers can be made more efficient with tailored design while preserving their expressivity, supporting their scalability to the larger graphs encountered in foundation model settings.

References (51)