Question-Aware Knowledge Graph Prompting for Enhancing Large Language Models

Haochen Liu, Song Wang, Chen Chen, Jundong Li · DOI

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities across a wide array of natural language processing tasks. However, they remain susceptible to "hallucinations" and often struggle with tasks requiring specialized, domain-specific, or rapidly evolving knowledge. To mitigate these issues, researchers have increasingly turned to Knowledge Graphs (KGs)—structured repositories of entities and their interrelations—to provide a factual grounding for model outputs.

Despite their potential, integrating KGs into LLMs effectively remains a significant challenge. Current approaches typically face three primary hurdles: the prohibitive computational cost of fine-tuning large models on graph data, the introduction of semantic noise through irrelevant retrieval, and the inherent incompleteness of most KGs. To address these limitations, this paper introduces Question-Aware Knowledge Graph Prompting (QAP), a novel framework designed to enhance LLM reasoning through question-sensitive graph aggregation and global attention mechanisms.

The QAP Framework

QAP utilizes a three-phase pipeline to generate lightweight "soft prompts"—prefix embeddings that guide the LLM's reasoning process without requiring modifications to the underlying model parameters. This parameter-efficient approach allows the LLM to remain frozen while benefiting from structured external knowledge.

1. Subgraph Retrieval

For any given question and its associated multiple-choice options, the system first extracts a localized "contextualized subgraph" from a comprehensive KG, such as ConceptNet for general knowledge or UMLS for biomedical applications. This step ensures that the model focuses on a manageable subset of facts relevant to the entities mentioned in the query.

2. Question-Aware Neighborhood Aggregation (QNA)

Standard Graph Neural Networks (GNNs) typically aggregate information based solely on the topological structure of the graph. QAP improves upon this by making the aggregation process question-aware. By incorporating the question embedding into the GNN's attention mechanism, the model dynamically prioritizes edges and neighbors that are semantically relevant to the specific query. For example, if a question asks about a fruit's appearance, the QNA module will prioritize "color" relations over "taste" or "origin" relations.

3. Global Attention-Derived Prompting (GTP)

A critical innovation of QAP is the Global Attention-Derived Prompting (GTP) module. Traditional retrieval-augmented systems often process multiple-choice options in isolation. GTP, however, employs a global attention mechanism to capture relationships between all candidate options simultaneously. This allows the model to perform a form of analogical reasoning to compensate for KG incompleteness. If the KG lacks specific data for one option but contains it for a similar entity in another option, the global attention mechanism allows the model to bridge the gap and infer the missing information.

Experimental Evaluation

The researchers evaluated the QAP framework across three diverse Multiple Choice Question Answering (MCQA) benchmarks:

  • OpenBookQA (OBQA): Elementary-level science questions requiring multi-step reasoning.
  • RiddleSense (Riddle): Complex common-sense reasoning tasks presented as riddles.
  • MedQA (USMLE): High-stakes medical board exam questions requiring specialized domain knowledge.

The framework was tested using the Llama2-chat (7B) model as the backbone LLM, utilizing ConceptNet for general tasks and UMLS for medical tasks.

Key Results and Insights

QAP consistently outperformed existing state-of-the-art methods, including the previous leading graph-based method, GNP.

  • Performance Gains: On the Riddle dataset, QAP achieved an accuracy of 66.42%, nearly doubling the performance of the base Llama2 model (37.35%) and significantly exceeding the previous state-of-the-art (54.82%).
  • Domain Robustness: The framework demonstrated strong generalization in the specialized medical domain (MedQA), proving that the architecture is effective across both general and technical knowledge bases.
  • Ablation Studies: Systematic removal of the QNA and GTP modules resulted in significant performance declines. These results confirm that both the question-aware filtering of noise and the ability to reason across multiple options are essential to the framework's success.

Conclusion and Future Work

Question-Aware Knowledge Graph Prompting represents a significant step forward in the integration of structured knowledge and large language models. By leveraging soft prompting and question-sensitive graph aggregation, QAP provides a parameter-efficient way to reduce hallucinations and improve reasoning accuracy.

While the system is currently dependent on the density of the underlying KG and introduces some inference latency due to the GNN layers, it offers a robust solution for knowledge-intensive tasks. Future research will explore the application of QAP to open-ended reasoning tasks beyond the multiple-choice format and investigate methods to resolve conflicts between KG facts and the LLM's internal pre-trained knowledge.

Summary updated

BibTeX
@inproceedings{liu2025question,
  author = {Haochen Liu and Song Wang and Chen Chen and Jundong Li},
  title = {{Question-Aware Knowledge Graph Prompting for Enhancing Large Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure