Graph Tokenization for Bridging Graphs and Transformers
Zeyuan Guo, Enmao Diao, Cheng Yang, Chuan Shi
Abstract
The success of large pretrained Transformers is closely tied to tokenizers, which convert raw input into discrete symbols. Extending these models to graph-structured data remains a significant challenge. In this work, we introduce a graph tokenization framework that generates sequential representations of graphs by combining reversible graph serialization, which preserves graph information, with Byte Pair Encoding (BPE), a widely adopted tokenizer in large language models (LLMs). To better capture structural information, the graph serialization process is guided by global statistics of graph substructures, ensuring that frequently occurring substructures appear more often in the sequence and can be merged by BPE into meaningful tokens. Empirical results demonstrate that the proposed tokenizer enables Transformers such as BERT to be directly applied to graph benchmarks without architectural modifications. The proposed approach achieves state-of-the-art results on 14 benchmark datasets and frequently outperforms both graph neural networks and specialized graph transformers. This work bridges the gap between graph-structured data and the ecosystem of sequence models. Our code is available at bluehere.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Cited by top-tier papers2
- GS-Quant: Granular Semantic and Generative Structural Quantization for Knowledge Graph CompletionQizhuo Xie, Yunhui Liu, Yu Xing, Qianzi Hou et al.ACL 2026
- Toward Graph-Tokenizing Large Language Models with Reconstructive Graph Instruction TuningZhongjian Zhang, Xiao Wang, Mengmei Zhang, Jiarui Tan et al.WWW 2026
Builds on14
- An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-AwarenessTri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra et al.NeurIPS 2022 · 5,493 citations
- Open Graph Benchmark: Datasets for Machine Learning on GraphsWeihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong et al.NeurIPS 2020 · 3,935 citations
- Recipe for a General, Powerful, Scalable Graph TransformerLadislav Rampásek, Michael Galkin, Vijay Prakash Dwivedi, Anh Tuan Luu et al.NeurIPS 2022 · 1,216 citations
- GraphGPT: Graph Instruction Tuning for Large Language ModelsJiabin Tang, Yuhao Yang, Wei Wei, Lei Shi et al.SIGIR 2024 · 182 citations
Related papers
- Graph Generative Pre-trained TransformerXiaohui Chen, Yinkai Wang, Jiaxing He, Yuanqi Du et al.ICML 2025
- Towards Next Graph Token Prediction: Discrete Graph Tokenization for Structural Reasoning in Large Language ModelsZhonghao Wang, Yugang Ji, Zhuonan Zheng, Sheng Zhou et al.KDD 2026
- : One LLM Token for Explicit Graph Structural UnderstandingJingyao Wu, Bin Lu, Zijun Di, Xiaoying Gan et al.ICLR 2026 · 2 citations
- Learning Graph Quantized TokenizersLimei Wang, Kaveh Hassani, Si Zhang, Dongqi Fu et al.ICLR 2025
- From Pixels to Tokens: Byte-Pair Encoding on Quantized Visual ModalitiesWanpeng Zhang, Zilong Xie, Yicheng Feng, Yijiang Li et al.ICLR 2025
