Abstract
Large Language Models (LLMs) frequently generate factually incorrect information, a phenomenon known as hallucination. LinkQ is a human-in-the-loop system designed to address this by requiring models to generate and execute formal queries against a Knowledge Graph (KG). By grounding responses in structured, verifiable data, LinkQ significantly outperforms standalone GPT-4 in accuracy, especially for complex multi-hop and comparative questions. This paper details the architecture of LinkQ and evaluates its performance across diverse datasets.
Introduction
LLMs are often characterized as "stochastic parrots," capable of generating confident but erroneous text. In high-stakes domains such as cybersecurity or national security, these hallucinations can lead to critical failures. Furthermore, LLMs are constrained by training cutoffs and lack access to proprietary or real-time data. While Knowledge Graphs (KGs) offer a "ground truth" source of structured data, they typically require expert knowledge of query languages like SPARQL or Cypher. LinkQ bridges this gap by providing a natural language interface that translates user intent into verifiable KG queries, ensuring that the LLM's role is focused on logic and summarization rather than fact retrieval.
The LinkQ Framework
LinkQ utilizes a multi-step prompting and message-passing protocol to ensure accuracy and user oversight. The process begins with a clarification dialogue where the system and LLM engage the user to ensure the question is well-formed and objective. The system then performs a "fuzzy search" to map user terms to specific entity and relation IDs within the KG schema.
Following mapping, the LLM generates a formal query via few-shot prompting. A critical component of LinkQ is the human-in-the-loop review; before execution, users are shown a natural language explanation and a preview of the query, allowing for manual refinement. Finally, the system executes the query against the KG, and the LLM summarizes the returned results, ensuring the final answer is derived entirely from ground-truth data.
Evaluation Methodology
The system was evaluated using two distinct datasets to test both general and domain-specific capabilities:
- Mintaka: A complex, crowdsourced KGQA dataset based on Wikidata. It includes various complexity types such as multi-hop, comparative, and intersection questions.
- BRON: A specialized cybersecurity KG that unifies data from MITRE ATT&CK, NIST’s CVEs (vulnerabilities), and CWEs (weaknesses). This was used for qualitative case studies with domain experts to assess the system's utility in specialized environments.
Results and Analysis
Quantitative evaluation across 120 questions demonstrated that LinkQ consistently outperformed standalone GPT-4 in every category of question complexity.
LinkQ achieved 91.7% accuracy on comparative questions and 75% on multi-hop questions, representing a massive improvement over GPT-4’s 16.7% in the latter category. Even in the most challenging "Intersection" category—questions requiring pattern-matching on multiple conditions—LinkQ maintained a significant lead (54.2% vs. 12.5%). However, this accuracy comes with a runtime trade-off; the multi-step process and human review cycle result in higher latency (runtime) compared to a single direct LLM prompt.
Discussion
The success of LinkQ highlights a core insight: LLMs are more effective as logic-driven translators than as static knowledge repositories. By offloading fact-finding to a database, the model's role is optimized for reasoning and summarization. Furthermore, the inclusion of transparency features—such as query graphs and entity-relation maps—is vital for building trust in high-stakes environments. Despite these gains, "Intersection" queries remain a challenge, suggesting a ceiling for current translation capabilities when dealing with highly complex logical patterns.
Conclusion and Future Work
LinkQ demonstrates a robust path toward mitigating hallucinations through structured grounding. While the system introduces higher latency, the gains in factual reliability are substantial for professional applications. Future work will focus on reducing this latency and improving schema mapping. Expert feedback also suggests exploring hybrid Retrieval-Augmented Generation (RAG) to provide semantic context for entities and implementing chain-of-thought processing to further decompose complex queries into manageable sequential steps.
Summary updated