Classical knowledge graph completion (KGC) methods rely solely on structural information, struggling with the inherent sparsity of knowledge graphs (KGs). Large Language Models (LLMs) learn extensive knowledge from large corpora with powerful context modeling, which is ideal for mitigating the limitations of previous methods. Directly fine-tuning LLMs offers great capability but comes at the cost of huge time and memory consumption, while utilizing frozen LLMs yields suboptimal results. In this work, we aim to leverage LLMs for KGC effectively and efficiently. We capture the context-aware hidden states of knowledge triples by employing prompts to stimulate the intermediate layers of LLMs. We then train a data-efficient classifier on these hidden states to harness the inherent capabilities of frozen LLMs in KGC. We also generate entity descriptions with subgraph sampling on KGs, reducing the ambiguity of triplets and enriching the knowledge representation. Extensive experiments on standard benchmarks showcase the efficiency and effectiveness of our approach. We outperform classical KGC methods on most datasets and match the performance of fine-tuned LLMs. Additionally, compared to fine-tuned LLMs, we boost GPU memory efficiency by \textbf{$188\times$} and speed up training+inference by \textbf{$13.48\times$}.
翻译:传统的知识图谱补全方法仅依赖结构信息,难以应对知识图谱固有的稀疏性问题。大语言模型通过强大的上下文建模能力从大规模语料库中学习到广泛的知识,这为弥补先前方法的局限性提供了理想方案。直接微调大语言模型虽能提供强大能力,但需付出巨大的时间和内存消耗;而直接使用冻结大语言模型则效果欠佳。本研究旨在高效且有效地利用大语言模型进行知识图谱补全。我们通过设计提示词激发大语言模型中间层的响应,从而捕获知识三元组的上下文感知隐藏状态。随后,我们在这些隐藏状态上训练一个数据高效的分类器,以充分利用冻结大语言模型在知识图谱补全中的内在能力。此外,我们通过对知识图谱进行子图采样来生成实体描述,这降低了三元组的歧义性并丰富了知识表示。在标准基准测试上的大量实验证明了我们方法的高效性和有效性。在多数数据集上,我们的方法超越了传统知识图谱补全方法,并达到了与微调大语言模型相当的性能。此外,与微调大语言模型相比,我们的方法将GPU内存效率提升了 \textbf{$188\times$},并将训练+推理速度加快了 \textbf{$13.48\times$}。