Source-linked AI summary
Knowledge-Augmented Language Model Prompting for Zero-Shot Knowledge Graph Question Answering
Jinheon Baek, Alham Fikri Aji, Amir Saffari
TL;DR
LLMs can answer zero-shot questions from internal parameters, but that knowledge may be inaccurate or outdated, and updating it through fine-tuning is costly. KAPING retrieves semantically relevant facts from knowledge graphs, prepends them to the question prompt, and performs zero-shot generation without parameter updates. It significantly outperforms relevant zero-shot baselines on KGQA tasks, while its performance remains dependent on retrieval and entity-linking effectiveness.
Problem
LLM parameter knowledge can be incomplete, incorrect, or outdated, while updating it through parameter changes is expensive.
Method
KAPING retrieves relevant knowledge-graph triples using semantic similarity, verbalizes them, and prepends them to the question prompt for zero-shot LLM generation.
Results
KAPING significantly outperforms relevant zero-shot baselines on Knowledge Graph Question Answering tasks.
Takeaways & Limitations
Knowledge-graph fact retrieval and augmentation provide a zero-shot approach for generating knowledge-grounded answers without additional training or parameter updates.
Takeaways & Limitations
Performance depends on retriever effectiveness, neighborhood coverage, and entity linking when question entities are not provided.
Abstract
from arXiv · showhide
Large Language Models (LLMs) are capable of performing zero-shot closed-book question answering tasks, based on their internal knowledge stored in parameters during pre-training. However, such internalized knowledge might be insufficient and incorrect, which could lead LLMs to generate factually wrong answers. Furthermore, fine-tuning LLMs to update their knowledge is expensive. To this end, we propose to augment the knowledge directly in the input of LLMs. Specifically, we first retrieve the relevant facts to the input question from the knowledge graph based on semantic similarities between the question and its associated facts. After that, we prepend the retrieved facts to the input question in the form of the prompt, which is then forwarded to LLMs to generate the answer. Our framework, Knowledge-Augmented language model PromptING (KAPING), requires no model training, thus completely zero-shot. We validate the performance of our KAPING framework on the knowledge graph question answering task, that aims to answer the user's question based on facts over a knowledge graph, on which ours outperforms relevant zero-shot baselines by up to 48% in average, across multiple LLMs of various sizes.
1 Introduction
KAPING addresses the incompleteness and cost of updating LLM-internal knowledge by retrieving relevant KG facts and prepending them to prompts for zero-shot QA. It filters irrelevant triples through semantic similarity and significantly outperforms relevant zero-shot baselines on KGQA tasks.
- Motivation: LLMs can answer closed-book questions from parameterized knowledge, but that knowledge may be incomplete, incorrect, or outdated.
- Approach: KAPING retrieves KG facts associated with question entities, verbalizes them, and prepends them to the question prompt without updating model parameters.The framework uses knowledge graph triples and requires no additional training.
- Challenges: 27% of WebQSP samples have more than 1,000 associated triples, making exhaustive triple encoding computationally costly.
- Approach: Semantic similarity filtering selects a small number of triples that are closer to the question embedding, reducing irrelevant knowledge and computational cost.This addresses settings where question entities have many associated triples, including over 1,000 for 27% of WebQSP samples.
- Results: KAPING significantly outperforms relevant zero-shot baselines on Knowledge Graph Question Answering tasks.The study validates the framework on KGQA tasks and analyzes knowledge retrieval and augmentation schemes.
- Contributions: The work presents a zero-shot knowledge-augmented prompting framework, a semantic-similarity retriever, and KGQA benchmark validation.
2 Related Work
Prior work uses language-model prompting, document or KG retrieval, and specialized KGQA models, but these approaches differ in knowledge source, prompting regime, and training requirements. KAPING is positioned as zero-shot KG prompting without additional model training.
- Language Model Prompting: Language-model pre-training enables zero-shot learning by storing knowledge in parameters and generating answers from textual prompts.
- Knowledge-Augmented LMs: Knowledge-augmented LM methods retrieve documents or KG facts, but many require substantial training data and model updates for downstream tasks.
- Knowledge-Augmented LMs: Prompting methods that extract knowledge from LLM parameters can produce inaccurate knowledge and answers when parameterized knowledge is insufficient.
- Knowledge-Augmented LMs: Web-retrieval prompting uses Google Search documents with few-shot demonstrations, whereas this work focuses on zero-shot prompting with knowledge graphs.
- Knowledge Graph Question Answering: KGQA approaches include neural semantic parsing, information retrieval, and differentiable KG methods, which generally require annotated data and additional training.
3 Method
KAPING augments zero-shot language-model prompting with relevant knowledge-graph facts, retrieved and verbalized before being prepended to the question. It addresses inaccurate, outdated, or excessive internal knowledge by selecting semantically relevant triples without fine-tuning.
- Zero-shot language models can answer questions from parameterized knowledge, but that knowledge may be inaccurate, outdated, or costly to update.
- LM Prompting with Knowledge Graphs: KAPING injects relevant knowledge-graph facts into the question prompt so LLMs can generate answers conditioned on external facts.
- Knowledge Access: The framework extracts question entities, matches them to knowledge-graph entities, and treats their incident triples as associated facts.
- Knowledge Verbalization: Knowledge-graph triples are transformed from symbolic (s, r, o) structures into textual strings before injection into language-model prompts.
- Knowledge Injection: The knowledge prompt enumerates verbalized triples, adds an instruction, prepends them to the question prompt, and generates answers from P(y|[k′, x′]).
- Knowledge Retriever: Because associated triples can be numerous and irrelevant, KAPING retrieves only those semantically closest to the question before augmentation.
4 Experimental Setups
The experiments evaluate KAPING for zero-shot knowledge-graph question answering across multiple datasets, retrievers, baselines, and language models. They measure both answer generation and retrieval quality under one- and two-hop settings.
- Datasets: The evaluation uses WebQuestionsSP and Mintaka, including Freebase- and Wikidata-based test settings.
- Models: The benchmark covers T5, T0, OPT, and GPT-3 language models ranging from 0.8B to 175B parameters.
- Baselines and Our Model: The baselines include no knowledge, random knowledge, popular knowledge, and generated knowledge prompting schemes.
- Retriever Evaluation: Retrieval experiments compare random, popular, and MPNet retrievers for one- and two-hop retrievals, with MPNet providing the text-based retrieval model.
- Baselines and Our Model: KAPING retrieves the top-K triples similar to the question and augments them as a prompt.
- Metrics: Generation accuracy checks whether generated tokens contain an answer entity or one of its aliases, while retrieval uses MRR and Top-K accuracy.
5 Experimental Results and Analyses
KAPING substantially improves zero-shot KGQA by retrieving relevant knowledge, while performance depends on retrieval correctness, knowledge amount, and model size. Analyses examine retrieval quality, ordering, quantity, efficiency, and factual adaptation.
- Main Results: KAPING significantly outperforms all LM prompting baselines on zero-shot KGQA tasks.
- Main Results: Smaller LMs show larger performance improvements, sometimes reaching performance similar to larger OPT models with augmented knowledge.The authors suggest knowledge augmentation can be beneficial in low-resource factual-knowledge settings instead of increasing model size.
- Retriever Results: MPNet retrieves more relevant knowledge than random and popular retrievers, supporting the use of graph-to-text verbalization with existing retrieval models.
- Impact of Correct & Incorrect Retrievals: Correctly retrieved triples improve generation, whereas failed retrievals can reduce performance below no-knowledge models by conditioning LLMs on irrelevant facts.
- Varying the Amount of Knowledge: Most LLMs achieve their highest performance with 5 or 10 triples, while OPT performance decreases substantially with 15 or 30 triples.The analysis attributes this decrease to distraction from irrelevant triples when the augmented knowledge volume is high.
- Efficiency: For T0, fewer than 10 augmented triples can reduce generation time because augmented knowledge leads to shorter answers, whereas OPT becomes slower as input knowledge increases.
- Case Study: The case study shows that augmented facts can replace a hallucinated answer with a correct answer and support adaptation to changed knowledge.
KAPING (Ours)
Additional analyses test KAPING’s efficiency, sensitivity to knowledge order and amount, entity-linking robustness, and ability to use updated facts. These results also illustrate that retrieved facts can correct hallucinated answers.
- Efficiency: KAPING’s generation time varies with augmented knowledge amount, with decoder-only OPT models becoming slower as more triples are added.
- Impact of Orders of Retrieved Triples: KAPING is reported as insensitive to whether more similar retrieved triples appear at the top, bottom, or randomly in the prompt.
- Effectiveness with Entity Linking: Entity linking causes a slight performance decrease compared with labeled entities, but KAPING still yields meaningful gains over the no-knowledge model.
- Case Study: A case study shows that retrieved and augmented facts can correct a hallucinated answer and allow the model to adapt when augmented knowledge changes.
- Additional Results: Additional experiments cover retriever comparisons, template sensitivity, extra metrics, few-shot settings, verbalization, and efficiency.
6 Conclusion
The paper concludes that KAPING addresses unreliable, static knowledge in LLM parameters by injecting relevant KG facts into prompts. It remains zero-shot and model-agnostic while producing factual-knowledge gains, especially for smaller LMs.
- Conclusion: KAPING retrieves relevant KG facts and injects them into LLM prompts without additional parameter updates or training datasets.
- Conclusion: The framework is completely zero-shot and versatile across language models, targeting incomplete, inaccurate, and outdated parametric knowledge.
- Conclusion: KAPING produces large performance gaps over prompting models relying on internal knowledge, especially with smaller LMs, on KGQA tasks.
Limitations
The framework’s performance is constrained by retrieval and evaluation choices, especially when required facts or entities are not correctly identified. The authors also note scope limitations from using labeled entities rather than fully realistic entity linking.
- Retrieval: Retriever failures can condition the LLM on irrelevant facts, producing incorrect answers.Performance depends on retrieving relevant facts for the question.
- Retrieval: 2-hop retrieval increases answerable Mintaka questions from 40% to 62%, but retrieving multi-hop facts remains challenging.The comparison concerns questions answerable with 1-hop versus 2-hop facts.
- Evaluation: Current evaluation may inadequately measure generated sentences against entity-level KGQA answers.F1 and Exact Match can heavily penalize longer, factually correct sentences.
- Entity linking: The evaluation uses labeled KG entities, whereas real-world applications require entity linking before retrieval.Entity-linking results reduce the answerable portion from 40% with labeled entities to 22% with linked entities.
Ethics Statement
The supplied passages describe the datasets, model implementations, evaluation details, and a caution that KAPING remains imperfect for high-risk applications. They do not provide a distinct ethics statement.
- Scope and caution: KAPING can ground KGQA answers in provided knowledge, but failures in entity linking, retrieval, or generation remain possible.The authors advise particular caution for high-risk domains.
- Datasets: WebQuestionsSP uses questions and answers annotated with Freebase entities and cleaned to remove invalid annotations.
- Datasets: Mintaka targets complex KGQA questions, including superlative and comparative questions, with Wikidata entities.
- Models: The evaluated models include T5, T0, GPT-3, OPT, and AlexaTM, spanning encoder-decoder and decoder-only architectures.
A.4 Implementation Details
The implementation explores knowledge-injection choices, text retrievers, prompt templates, and computational settings for zero-shot KAPING experiments. Results indicate robustness across retrievers but sensitivity to instruction wording and retrieval correctness.
- Knowledge injection: KAPING searches over the number of retrieved facts, hop count, fact order, and prompt-template wording.The authors seek an effective configuration without exhaustively searching the full design space.
- Experimental setup: The experiments use maximum input lengths of 1,024 tokens and run models on 8 V100 GPUs with 32GB memory each.Decoder-only models allow up to 1,152 total tokens including 128 output tokens.
- Retrieval models: MPNet and TAS-B show similar retrieval performance, supporting the robustness of simple graph-to-text verbalization across retriever types.Experiments therefore mainly use MPNet to reduce GPU costs.
- Prompt templates: Instruction-template preferences vary by LLM: T5 favors the default template, OPT favors the please template, and T0 and GPT-3 differ only marginally.Template selection can affect optimal performance across models.
B.3 Additional Evaluation Metrics
Additional analyses examine evaluation metrics, few-shot prompting, verbalization, retrieval, and efficiency. They show that metric choice interacts with generated output length, while simple triple augmentation remains competitive and faster than document augmentation.
- Evaluation metrics: F1 and Exact Match can sharply undervalue zero-shot generated answers because they penalize sentence-level outputs against entity-level targets.T0 is an exception because it can generate entity-level outputs.
- Evaluation metrics: KAPING consistently outperforms other baselines on averaged F1 and Exact Match scores despite those metrics being suboptimal for generative prompting.
- Few-shot prompting: Adding more few-shot examples generally decreases KGQA performance, except for OPT, when examples are less relevant to the factual question.The reported analysis uses WebQSP with Wikidata.
- Knowledge verbalization: Simple triple-form verbalization performs better for fact retrieval than free-form graph-to-text verbalization, while generation performance is comparable between them.The comparison uses MPNet for retrieval and KAPING for generation.
- Efficiency: Triple augmentation generates answers faster than document augmentation because fewer tokens require encoding and conditioning.Document augmentation uses retrieved documents, whereas KAPING augments relevant KG triples.
B.7 Result Analyses Across Question Types
KAPING improves generation accuracy across Mintaka question categories, except Comparative questions. Its analysis also identifies weak Count performance for T0 models and highlights examples across models and datasets.
- Question categories: Mintaka questions span Generic, Multihop, Intersection, Difference, Comparative, Superlative, Ordinal, Count, and Yes/No categories.Yes/No questions are excluded under the evaluation protocol because questions without answer names are filtered out.
- Category-level results: KAPING significantly improves performance across all categories except Comparative questions.The comparison averages performance across LLMs for each question category.
- Category-level results: Comparative questions remain difficult because relevant triples are hard to retrieve and associate with the question.For example, comparing LeBron James and Steph Curry’s NBA Season MVP totals is challenging for the retrieval scheme.
- Category-level results: Knowledge-augmented models outperform other baselines on Comparative questions, supporting further improvements to retrieval or prompt design.The authors leave these retrieval and prompting improvements for future work.
- Category-level results: T0 models show significantly lower performance than other LLMs on Count questions.The authors attribute this to the absence of counting-related prompted tasks during T0 fine-tuning.
- Qualitative examples: The paper includes generation comparisons for GPT-3 and T0, plus KAPING examples from T5, OPT, T0, and GPT-3.Examples cover WebQSP with Freebase and Wikidata knowledge graphs.
C Discussions on Prompt Design/Tuning
The discussion distinguishes zero-shot LM prompting and prompt design from trainable prompt tuning. It positions KAPING as a zero-shot QA framework that injects entity-linked KG triples rather than relying on supervised prompt or task-instance training.
- Prompting and prompt design: LM prompting generates answers from an input textual prompt, while prompt design modifies the prompt content to enhance performance.The discussion cites prompt design work that deliberately constructs prompt contents for language-model tasks.
- Prompt tuning: Prompt tuning trains prompt-relevant parameters with supervised objectives while leaving the LLM parameters unchanged.The paper contrasts this with prompt design, which does not require training and is easier to interpret and manipulate.
- Prior knowledge-aware methods: Prior knowledge-aware prompt-tuning methods target cloze-style prediction and classify a masked token rather than performing zero-shot question answering.Their settings include relation extraction and text classification, with a mask token used for prediction.
- Prior knowledge-aware methods: Those methods require training data or supervised objectives, making them unsuitable for the paper’s zero-shot QA setting.The discussion contrasts their training-data dependence with KAPING’s zero-shot formulation.
- KAPING distinction: KAPING matches question entities to KG entities and augments the resulting associated triples as factual knowledge for LLM prompting.This knowledge source differs from prior methods using word relationships, relation-associated words, or sentence-label pairs.
- Examples: The appendix provides generation examples for GPT-3, T0, and KAPING with T5, OPT, T0, and GPT-3 on WebQSP datasets.The examples use Freebase and Wikidata settings.