Table of Contents
Fetching ...

Question-Aware Knowledge Graph Prompting for Enhancing Large Language Models

Haochen Liu, Song Wang, Chen Chen, Jundong Li

TL;DR

This work tackles the challenge of knowledge-intensive MCQA by integrating external knowledge graphs into large language models without fine-tuning. The proposed framework, QAP, combines a Question-Aware Neighborhood Aggregation (QNA) module that injects question context into KG graph reasoning with a Global Attention-Derived Prompting (GTP) module that leverages cross-option relations to enrich soft prompts. It optimizes an end-to-end objective with a cross-entropy loss while freezing the LLM, and demonstrates state-of-the-art performance on OBQA, Riddle, and MedQA using ConceptNet and UMLS as knowledge sources. The approach enables query-adaptive reasoning and robust handling of missing KG knowledge across answer options, offering a scalable path to integrating structured knowledge with LLMs in diverse domains.

Abstract

Large Language Models (LLMs) often struggle with tasks requiring external knowledge, such as knowledge-intensive Multiple Choice Question Answering (MCQA). Integrating Knowledge Graphs (KGs) can enhance reasoning; however, existing methods typically demand costly fine-tuning or retrieve noisy KG information. Recent approaches leverage Graph Neural Networks (GNNs) to generate KG-based input embedding prefixes as soft prompts for LLMs but fail to account for question relevance, resulting in noisy prompts. Moreover, in MCQA tasks, the absence of relevant KG knowledge for certain answer options remains a significant challenge. To address these issues, we propose Question-Aware Knowledge Graph Prompting (QAP), which incorporates question embeddings into GNN aggregation to dynamically assess KG relevance. QAP employs global attention to capture inter-option relationships, enriching soft prompts with inferred knowledge. Experimental results demonstrate that QAP outperforms state-of-the-art methods across multiple datasets, highlighting its effectiveness.

Question-Aware Knowledge Graph Prompting for Enhancing Large Language Models

TL;DR

This work tackles the challenge of knowledge-intensive MCQA by integrating external knowledge graphs into large language models without fine-tuning. The proposed framework, QAP, combines a Question-Aware Neighborhood Aggregation (QNA) module that injects question context into KG graph reasoning with a Global Attention-Derived Prompting (GTP) module that leverages cross-option relations to enrich soft prompts. It optimizes an end-to-end objective with a cross-entropy loss while freezing the LLM, and demonstrates state-of-the-art performance on OBQA, Riddle, and MedQA using ConceptNet and UMLS as knowledge sources. The approach enables query-adaptive reasoning and robust handling of missing KG knowledge across answer options, offering a scalable path to integrating structured knowledge with LLMs in diverse domains.

Abstract

Large Language Models (LLMs) often struggle with tasks requiring external knowledge, such as knowledge-intensive Multiple Choice Question Answering (MCQA). Integrating Knowledge Graphs (KGs) can enhance reasoning; however, existing methods typically demand costly fine-tuning or retrieve noisy KG information. Recent approaches leverage Graph Neural Networks (GNNs) to generate KG-based input embedding prefixes as soft prompts for LLMs but fail to account for question relevance, resulting in noisy prompts. Moreover, in MCQA tasks, the absence of relevant KG knowledge for certain answer options remains a significant challenge. To address these issues, we propose Question-Aware Knowledge Graph Prompting (QAP), which incorporates question embeddings into GNN aggregation to dynamically assess KG relevance. QAP employs global attention to capture inter-option relationships, enriching soft prompts with inferred knowledge. Experimental results demonstrate that QAP outperforms state-of-the-art methods across multiple datasets, highlighting its effectiveness.

Paper Structure

This paper contains 26 sections, 14 equations, 5 figures, 2 tables.

Figures (5)

  • Figure 1: Illustration of the limitations of question-agnostic GNNs and our proposed solution. Traditional methods compute GNN weights solely based on graph semantics, often overlooking question relevance. In contrast, our approach integrates question-aware GNN aggregation, prioritizing relevant knowledge while downweighting less pertinent edges.
  • Figure 2: Illustration of the limitation posed by missing KG knowledge for certain options and our proposed solution. When the KG lacks dietary information for tigers, traditional methods fail to retrieve relevant knowledge. In contrast, our approach utilizes global attention to capture the relationship between lions and tigers, enabling the model to infer that tigers are also carnivores.
  • Figure 3: Overview of our proposed framework QAP. The framework consists of: (1) Subgraph Retrieval, where contextualized subgraphs from the KG are extracted based on the question and answer options; (2) Question-Aware Neighborhood Aggregation (QNA), where the contextualized subgraphs are processed with neighborhood aggregation influenced by the question context; (3) Global Attention-Derived Prompting (GTP), which refines the node embeddings generated by QNA by aligning them with all question and option sequences, producing soft prompts enriched with global information. Finally, the soft prompts are prepended to the input question to guide the LLM in predicting the correct answer.
  • Figure 4: Parameter study on Flan-T5 (11B) and Llama2-chat (7B) for OBQA (general domain) and MedQA (biomedical domain).
  • Figure 5: Comparison of QAP and LLM-only performance using Flan-T5 (11B) across both general and biomedical domains. We list the logits given by LLM and our method QAP. The example shows that QAP provides a more accurate prediction. The correct answer and the option with the highest logit value are shown in red.