Graph-KV: Breaking Sequence via Injecting Structural Biases into Large Language Models

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Wang, Haoyu, Wang, Peihao, Li, Mufei, Liu, Shikun, Miao, Siqi, Wang, Zhangyang, Li, Pan
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866911367168000000
author Wang, Haoyu
Wang, Peihao
Li, Mufei
Liu, Shikun
Miao, Siqi
Wang, Zhangyang
Li, Pan
author_facet Wang, Haoyu
Wang, Peihao
Li, Mufei
Liu, Shikun
Miao, Siqi
Wang, Zhangyang
Li, Pan
contents Modern large language models (LLMs) are inherently auto-regressive, requiring input to be serialized into flat sequences regardless of their structural dependencies. This serialization hinders the model's ability to leverage structural inductive biases, especially in tasks such as retrieval-augmented generation (RAG) and reasoning on data with native graph structures, where inter-segment dependencies are crucial. We introduce Graph-KV with the potential to overcome this limitation. Graph-KV leverages the KV-cache of text segments as condensed representations and governs their interaction through structural inductive biases. In this framework, 'target' segments selectively attend only to the KV-caches of their designated 'source' segments, rather than all preceding segments in a serialized sequence. This approach induces a graph-structured block mask, sparsifying attention and enabling a message-passing-like step within the LLM. Furthermore, strategically allocated positional encodings for source and target segments reduce positional bias and context window consumption. We evaluate Graph-KV across three scenarios: (1) seven RAG benchmarks spanning direct inference, multi-hop reasoning, and long-document understanding; (2) Arxiv-QA, a novel academic paper QA task with full-text scientific papers structured as citation ego-graphs; and (3) paper topic classification within a citation network. By effectively reducing positional bias and harnessing structural inductive biases, Graph-KV substantially outperforms baselines, including standard costly sequential encoding, across various settings. Code and the Graph-KV data are publicly available.
format Preprint
id arxiv_https___arxiv_org_abs_2506_07334
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Graph-KV: Breaking Sequence via Injecting Structural Biases into Large Language Models
Wang, Haoyu
Wang, Peihao
Li, Mufei
Liu, Shikun
Miao, Siqi
Wang, Zhangyang
Li, Pan
Machine Learning
Modern large language models (LLMs) are inherently auto-regressive, requiring input to be serialized into flat sequences regardless of their structural dependencies. This serialization hinders the model's ability to leverage structural inductive biases, especially in tasks such as retrieval-augmented generation (RAG) and reasoning on data with native graph structures, where inter-segment dependencies are crucial. We introduce Graph-KV with the potential to overcome this limitation. Graph-KV leverages the KV-cache of text segments as condensed representations and governs their interaction through structural inductive biases. In this framework, 'target' segments selectively attend only to the KV-caches of their designated 'source' segments, rather than all preceding segments in a serialized sequence. This approach induces a graph-structured block mask, sparsifying attention and enabling a message-passing-like step within the LLM. Furthermore, strategically allocated positional encodings for source and target segments reduce positional bias and context window consumption. We evaluate Graph-KV across three scenarios: (1) seven RAG benchmarks spanning direct inference, multi-hop reasoning, and long-document understanding; (2) Arxiv-QA, a novel academic paper QA task with full-text scientific papers structured as citation ego-graphs; and (3) paper topic classification within a citation network. By effectively reducing positional bias and harnessing structural inductive biases, Graph-KV substantially outperforms baselines, including standard costly sequential encoding, across various settings. Code and the Graph-KV data are publicly available.
title Graph-KV: Breaking Sequence via Injecting Structural Biases into Large Language Models
topic Machine Learning
url https://arxiv.org/abs/2506.07334