用图作为记忆增强大模型推理,提升知识图谱补全效果
Beyond Prefixes: Graph-as-Memory Cross-Attention for Knowledge Graph Completion with Large Language Models
- 将局部图结构转为记忆令牌,通过深层交叉注意力注入大模型
- 在多个基准数据集上显著超越前代方法,尤其在复杂推理任务中表现突出
- 适合需要精准知识推理的场景,如智能问答与逻辑推断
将知识图谱与大语言模型融合对知识密集型任务(如知识图谱补全)至关重要。现有基于LLM的方法通常通过拼接前缀注入图信息,导致交互浅层,难以支持生成过程中的细粒度证据检索。本文提出图作为记忆调优(GMT),将局部图结构显式表示为图记忆,并通过深度、逐标记的交叉注意力注入大模型。具体地,首先使用语义图模块编码由知识增强关系引导的局部邻域上下文语义,并压缩为固定数量的图记忆令牌;随后,图记忆交叉注意力融合模块将这些令牌融入多个Transformer层,使大模型隐藏状态可动态检索相关图证据。为实现高效适配,GMT仅对记忆交叉注意力应用LoRA,保持基础模型冻结。大量实验表明,GMT显著优于前缀调优及其他强基线,在提供更强推理信号方面表现更优。
原文摘要 · Abstract (English)
Fusing Knowledge Graphs with Large Language Models (LLMs) is crucial for knowledge-intensive tasks like knowledge graph completion. Existing LLM-based approaches typically inject graph information via prefix concatenation, resulting in shallow interactions that fail to support fine-grained evidence retrieval during generation. Beyond prefixes, we propose Graph-as-Memory Tuning (GMT), a new paradigm that represents local graph structure as explicit graph memory and injects it into LLMs via deep, token-wise cross-attention. Specifically, GMT first employs a Semantic Graph Module to encode context-aware semantics from local neighborhoods guided by knowledge-enhanced relations, and compresses them into a fixed number of graph memory tokens. A Graph-as-Memory Cross-Attention Fusion Module then integrates these tokens into multiple Transformer layers, allowing LLM hidden state to dynamically retrieve relevant graph evidence. To enable efficient adaptation, GMT applies LoRA only to the memory cross-attention while keeping the base LLM frozen. Extensive experiments show that GMT significantly outperforms prefix-tuning and other strong baselines, providing more potent signals for robust reasoning. The code is published at https://github.com/tongruiliu/GMT.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。