cs.LGOct 27, 2026

GTFormer: A Syntax-Free Graph Network Alternative to Transformers for 8192×\times Length Extrapolation in Linear Time

Authors: Elisabeth Fink

Organizations: Middlesex University, Department of Computer Science The Burroughs, Hendon, London NW4 4BT, UK.

Abstract

Self-attention mechanisms have established the Transformer as the dominant backbone across natural language processing, source code intelligence, and automated theorem proving. However, all-to-all pairwise token comparison enforces a quadratic O(N2)\mathcal{O}(N^2) compute and memory barrier alongside severe softmax attention dilution as sequence length NN scales beyond the training horizon. Inspired by recent advances in algebraic graph learning (WPNet), this work introduces GTFormer, a syntax-free hierarchical Graph Neural Network (GNN) that replaces flat self-attention for general long-context sequence modeling. GTFormer organizes raw token streams into a bounded-degree hierarchy combining a balanced binary reduction tree (⌈log⁡2N⌉\lceil \log_2 N \rceil depth), horizontal boundary-bridging shift edges, random expander shortcuts, multi-channel convex highway gating, and a top-down broadcast pass. Across eight long-context code, log, and multi-hop retrieval benchmarks trained exclusively on sequences of length N≤512N \le 512, GTFormer extrapolates zero-shot to N=4,194,304N = 4{,}194{,}304 (8192×8192\times) on a single commodity GPU in linear O(N)\mathcal{O}(N) memory, maintaining near-perfect accuracy where standard and RoPE Transformers suffer from out-of-distribution attention collapse and out-of-memory exhaustion.

Figures & tables

Appendix figures & tables16 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Graph Memory Transformer (GMT)

    Apr 26, 2026Nicola Zanarini, Niccolò Ferrari, Evelina LammaMemory-Augmented Neural NetworksTransformer FFNs

  2. Teaching LLMs to See Graphs: Unifying Text and Structural Reasoning

    May 11, 2026Dario VajdaLLM Reasoning with GraphsText-Attributed Graph Learning

  3. LongAttnComp: Cross-Family Context Compression for Long-Context Reasoning

    May 31, 2026Mengmeng Ji, Ravi Shanker Raju, Jonathan Lingjie Li +1LLM CompressionLLM Fine-Tuning