arXiv(opens in a new tab)cs.LGSep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.02881

Graph Machine: Towards Better Pretraining via Edges

Lintai Hou

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

Abstract

We introduce the Graph Machine (GM), an architecture that maintains an O(n)O(n)-sized state and accesses it through sparse, dynamic routing. Unlike methods with fixed-size states or sparse but static routing, GM preserves O(n)O(n) complexity in its sparse layers without restricting the potentially accessible state size to O(1)O(1). Instead, GM uses edges—pointer-like objects updated differentially by a referral mechanism resembling pointer chasing. We replace 75% of the dense Transformer layers in Qwen3-0.6B with GM sparse layers and pretrain from scratch on 15.7B tokens. With only 2 of 4,096 tokens retrieved per KV head in each sparse layer, loss degrades only slightly; with 4, the best model marginally improves loss.

Figure

Figure 1: Attention and referral viewed as pointer operations.

Figure

Figure 2: Different referral approaches with ℓ=2\ell = 2 (simplified).

Preprint. Links: code, checkpoints, training curves.

1 Introduction

We classify sequence modeling approaches by the sizes of their state, access, and dynamic addresses. Recurrent models such as RNNs¹ and SSMs² maintain a Θ(1)\Theta(1)-sized state and must therefore compress their history.

Transformers³ avoid this compression by retaining a Θ(n)\Theta(n)-sized state in their keys and values. However, vanilla attention allows each step (token) to access the entire state, leading to Θ(n2)\Theta(n^2) complexity.

Methods such as sliding-window attention⁴ reduce this access to Θ(1)\Theta(1). Yet the accessible positions are fixed independently of the new step's content: all but Θ(1)\Theta(1) positions can be excluded in advance. Thus, their access is sparse but static.

A simple information-theoretic argument shows that dynamic, Θ(1)\Theta(1)-sized access to a Θ(n)\Theta(n)-sized state requires each new token to provide Θ(log⁡n)\Theta(\log n) bits that can be used directly to address—identify and retrieve—a constant-sized portion of the state. Together, these properties define a fourth category.

Table 1: A sequence-model taxonomy by state size, per-step access size, and per-step dynamic address bits

TypeExample(s)StateAccessDynamic address bits
1RNN, SSMΘ(1)\Theta(1)Θ(1)\Theta(1)\
2Vanilla transformerΘ(n)\Theta(n)Θ(n)\Theta(n)\
3Sliding-window transformerΘ(n)\Theta(n)Θ(1)\Theta(1)O(1)O(1)
4GMΘ(n)\Theta(n)Θ(1)\Theta(1)Θ(log⁡n)\Theta(\log n)

Although each dynamic address theoretically contains Θ(log⁡n)\Theta(\log n) bits, at practical sequence lengths it fits in a fixed-width integer such as int64, making its storage cost effectively constant. The Graph Machine therefore instantiated this fourth class: it maintains Θ(n)\Theta(n) state entries, accesses Θ(1)\Theta(1) entries per step, and uses Θ(log⁡n)\Theta(\log n) bits of dynamic addressing per step. Thus, GM stores both floating-point hidden states, which we call node features, and integer edge targets which we call edge indices. At each new step, stored edge indices are used to retrieve Θ(1)\Theta(1) positions for information aggregation by attention (Figure 1).

To update the stored edges across layers, we use a referral⁵ mechanism that constructs the next neighborhoods from the current ℓ\ell-hop neighborhoods. Referral can be understood as neighbors recursively referring to their neighbors for ℓ\ell rounds, as composing ℓ\ell-hop edges into one-hop edges, or as taking an adjacency matrix AA and producing AℓA^\ell (Figure 1). If each node retains ss neighbors, referral can produce up to sℓs^\ell candidate paths. Keeping the neighborhood size fixed at ss therefore requires a hard selection that reduces these candidates to ss neighbors. To learn the selection, a probabilistic policy is needed in the form of

Abinary′∼πθ(⋅∣Abinaryℓ),A_{\mathrm{binary}}^{\prime} \sim \pi_{\theta}(\cdot \mid A_{\mathrm{binary}}^{\ell}),

which would introduce credit assignment difficulties.

Instead, we soften the edges rather than the policy, reformulating the top-ss selection into a top-ss approximation over soft weights. We start with a soft and sparse adjacency matrix, take its ℓ\ell-th power, and then sparsify the result to form the new adjacency matrix (Figure 2). I.e., we approximate

Adense′=AdenseℓA_{\mathrm{dense}}^{\prime} = A_{\mathrm{dense}}^{\ell}

with

Asparse′=Sparsifys(Asparseℓ).A_{\mathrm{sparse}}^{\prime} = \mathrm{Sparsify}_{s}(A_{\mathrm{sparse}}^{\ell}).

The resulting edge weights then contribute to the attention weights alongside the usual query-key factors in a product-of-experts⁶ manner.

Intuitively, referral seeks to provide useful relational representations to attention through sparsity-constrained intermediaries. Rather than learning to shift the support directly, it learns from redistributing weight mass within the support. From another perspective, each edge is now jointly represented by integer edge indices and floating-point edge weights, the latter carrying gradients that discrete indices cannot.

Viewed globally, the Graph Machine maintains and updates a graph with soft directed edges. Sparse attention passes features along edges to update nodes, while referral passes addresses along edges to form new ones. In this paper, we hybridize GM and Transformer layers and train the resulting Graph Language Machines (GLMs) under a standard language-model pretraining setup. Throughout the paper, we move between the vocabularies of adjacency matrices, edges, neighbors, addresses, pointers, and indices as appropriate.

References (14)

  • Efficiently modeling long sequences with structured state spaces
  • Attention is all you need
  • Longformer: The long-document transformer, 2020
  • Qwen3 technical report, 2025
  • Ro-Former: Enhanced transformer with rotary position embedding
  • The FineWeb datasets: Decanting the web for the finest text data at scale
  • PyTorch: An imperative style, high-performance deep learning library
  • Kung, and David Cox
  • Mamba: Linear-time sequence modeling with selective state spaces
  • Gated delta networks: Improving Mamba2 with delta rule
  • Jamba: A hybrid transformer-mamba language model, 2024
  • Generating long sequences with sparse transformers, 2019
  • Efficient content-based sparse attention with routing transformers
  • Native sparse attention: Hardware-aligned and natively trainable sparse attention