arXiv:2605.14907cs.AI2026-05被引 1

让知识图谱模型通过上下文学习实现跨图推理,无需微调即可适应新数据。

KGPFN: Unlocking the Potential of Knowledge Graph Foundation Model via In-Context Learning

论文配图:KGPFN: Unlocking the Potential of Knowledge Graph Foundation Model via In-Context Learning
图 1 · 摘自论文原文
  • 用消息传递学习关系通用模式,结合局部与全局上下文进行推理
  • 在57个基准上仅靠上下文学习就超越微调模型,跨图泛化能力强
  • 适合需要快速适配新知识图谱的场景,如开放域问答、动态知识更新

知识图谱基础模型旨在通过学习可迁移的关系结构,在未见实体和关系上实现泛化。然而现有方法多聚焦于关系层面的普适性,对推理时的上下文学习(ICL)关注不足。知识图谱中的上下文具有固有的结构异质性:有效预测需依赖查询实体周围的局部上下文,以及反映关系整体行为的全局上下文。我们提出KGPFN,一种基于先验数据拟合网络(Prior-data Fitted Network)的知识图谱基础模型,统一可迁移的关系规律与推理时的结构化上下文学习。KGPFN首先通过关系图上的消息传递学习关系表示,捕捉跨图关系不变性;对于查询特定推理,使用多层NBFNet编码局部邻域作为局部上下文。为实现全局尺度的ICL,它通过检索查询关系的大量实例及其局部邻域,构建关系专属的全局上下文,并在先验数据拟合网络框架内融合特征级与样本级注意力。通过在多样化知识图谱上进行多图预训练,KGPFN学会何时复用通用模式,何时依据上下文证据进行调整。在57个知识图谱基准上的实验表明,仅通过上下文学习,KGPFN即可实现对未见图的强大适应能力,持续优于对比的微调型知识图谱基础模型。代码已开源。

原文摘要 · Abstract (English)

Knowledge graph (KG) foundation models aim to generalize across graphs with unseen entities and relations by learning transferable relational structure. However, most existing methods primarily emphasize relation-level universality, while in-context learning, the other pillar of foundation models remains under-explored for KG reasoning. In KGs, context is inherently structured and heterogeneous: effective prediction requires conditioning on the local context around the query entities as well as the global context that summarizes how a relation behaves across many instances. We propose KGPFN, a KG foundation model using Prior-data Fitted Network that unifies transferable relational regularities with inference-time in-context learning from structured context. KGPFN first learns relation representations via message passing on relation graphs to capture cross-graph relational invariances. For query-specific reasoning, it encodes local neighborhoods using a multi-layer NBFNet as local context. To enable ICL at global scale, it constructs relation-specific global context by retrieving a large set of instances of the query relation together with their local neighborhoods, and aggregates them within a Prior-Data Fitted Network framework that combines feature-level and sample-level attention. Through multi-graph pretraining on diverse KGs, KGPFN learns when to instantiate reusable patterns and when to override them using contextual evidence. Experiments on 57 KG benchmarks demonstrate that KGPFN achieves strong adaptation to previously unseen graphs through in-context learning alone, consistently outperforming competitive fine-tuned KG foundation models. Our code is available at https://github.com/HKUST-KnowComp/KGPFN.

知识图谱上下文学习基础模型

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。