Lune

NeurIPS2025Top-tier venue

From Sequence to Structure: Uncovering Substructure Reasoning in Transformers

Xinnan Dai, Kai Yang, Jay Revolinsky, Kai Guo, Aoran Wang, Bohang Zhang, Jiliang Tang

Abstract

Recent studies suggest that large language models (LLMs) possess the capability to solve graph reasoning tasks. Notably, even when graph structures are embedded within textual descriptions, LLMs can still effectively answer related questions. This raises a fundamental question: How can a decoder-only Transformer architecture understand underlying graph structures? To address this, we start with the substructure extraction task, interpreting the inner mechanisms inside the transformers and analyzing the impact of the input queries. Specifically, through both empirical results and theoretical analysis, we present Induced Substructure Filtration (ISF), a perspective that captures the substructure identification in the multi-layer transformers. We further validate the ISF process in LLMs, revealing consistent internal dynamics across layers. Building on these insights, we explore the broader capabilities of Transformers in handling diverse graph types. Specifically, we introduce the concept of thinking in substructures to efficiently extract complex composite patterns, and demonstrate that decoder-only Transformers can successfully extract substructures from attributed graphs, such as molecular graphs. Together, our findings offer a new insight on how sequence-based Transformers perform the substructure extraction task over graph data.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • When Do Hallucinations Arise? A Graph Perspective on the Evolution of Path Reuse and Path Compression cites Benefits and Pitfalls of Reinforcement Learning for Language Model Planning: A Theoretical Perspective
  • When Do Hallucinations Arise? A Graph Perspective on the Evolution of Path Reuse and Path Compression cites The Pitfalls of Next-Token Prediction
  • The Pitfalls of Next-Token Prediction cites Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective
  • Talk like a Graph: Encoding Graphs for Large Language Models cites Can Language Models Solve Graph Problems in Natural Language?
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. Benefits and Pitfalls of Reinforcement Learning for Language Model Planning: A Theoretical PerspectiveSiwei Wang, Yifei Shen, Haoran Sun, Shi Feng et al.ICLR 2026 · 7 citations
  2. When Do Hallucinations Arise? A Graph Perspective on the Evolution of Path Reuse and Path CompressionXinnan Dai, Kai Yang, cheng Luo, Shenglai Zeng et al.ICML 2026

Builds on19

  1. Do Transformers Really Perform Badly for Graph Representation?Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng et al.NeurIPS 2021 · 1,632 citations
  2. Towards Revealing the Mystery behind Chain of Thought: A Theoretical PerspectiveGuhao Feng, Bohang Zhang, Yuntian Gu, Haotian Ye et al.NeurIPS 2023 · 470 citations
  3. Can Language Models Solve Graph Problems in Natural Language?Heng Wang, Shangbin Feng, Tianxing He, Zhaoxuan Tan et al.NeurIPS 2023 · 420 citations
  4. Talk like a Graph: Encoding Graphs for Large Language ModelsBahare Fatemi, Jonathan Halcrow, Bryan PerozziICLR 2024 · 194 citations
  5. The Pitfalls of Next-Token PredictionGregor Bachmann, Vaishnavh NagarajanICML 2024 · 163 citations

Related papers

  1. Flatten Graphs as Sequences: Transformers are Scalable Graph GeneratorsDexiong Chen, Markus Krimmel, Karsten M. BorgwardtNeurIPS 2025 · 13 citations
  2. Faith and Fate: Limits of Transformers on CompositionalityNouha Dziri, Ximing Lu, Melanie Sclar, Xiang Lorraine Li et al.NeurIPS 2023 · 728 citations
  3. Structural Reasoning Improves Molecular Understanding of LLMYunhui Jang, Jaehyung Kim, Sungsoo AhnACL 2025
  4. Can Graph Descriptive Order Affect Solving Graph Problems with LLMs?Yuyao Ge, Shenghua Liu, Baolong Bi, Yiwei Wang et al.ACL 2025
  5. MolecularIQ: Characterizing Chemical Reasoning Capabilities Through Symbolic Verification on Molecular GraphsChristoph Bartmann, Johannes Schimunek, Mykyta Ielanskyi, Philipp Seidl et al.ICLR 2026 · 5 citations
Dusk over the sea between two cliffs drawn in fine vertical lines