KGLens: A Parameterized Knowledge Graph Solution to Assess What an LLM Does and Doesn't Know

Shangshang Zheng, He Bai, Yizhe Zhang, Yi Su, Xiaochuan Niu, Navdeep JaitlyarXiv 2023 · DOI

Introduction

Large Language Models (LLMs) have demonstrated remarkable capabilities in natural language understanding and generation. However, their tendency to "hallucinate"—producing factually incorrect or outdated information—remains a significant hurdle for reliable deployment. Traditional methods for evaluating factual accuracy often rely on static benchmarks or brute-force probing of Knowledge Graphs (KGs). These approaches are either limited in scope or computationally prohibitive given the millions of facts contained in modern KGs. Furthermore, converting structured KG triplets into natural language questions introduces ambiguities that complicate automated grading.

To address these challenges, researchers have developed KGLens, a novel framework that treats knowledge probing as an optimization problem. By utilizing a parameterized knowledge graph and reinforcement learning techniques, KGLens identifies an LLM's "knowledge blind spots" with surgical precision and significantly higher efficiency than traditional methods.

The KGLens Framework

KGLens shifts the paradigm from static evaluation to an iterative, adaptive process. The architecture is built around three core components designed to maximize the information gained from every query sent to the LLM.

The KGLens framework architecture illustrates the iterative loop: sampling edges from a Parameterized Knowledge Graph (PKG), generating natural language questions (QG), and updating the PKG based on LLM prediction correctness.

1. Parameterized Knowledge Graph (PKG)

Instead of viewing a KG as a static set of facts, KGLens treats each edge as a probability distribution—specifically a Beta distribution. This distribution parameters ($\alpha, \beta$) track the history of an LLM's successes and failures for that specific fact, allowing the system to model the uncertainty of the model's knowledge.

2. Thompson Sampling and Signal Propagation

To decide which fact to test next, KGLens employs Thompson sampling, a classic strategy for the multi-armed bandit problem. The system prioritizes "exploitation" (testing facts where the model is likely to fail) while maintaining "exploration" (probing new areas of the graph). A key innovation is signal propagation: if a model fails to correctly identify a specific attribute of an entity, KGLens propagates this failure signal to neighboring edges, assuming that related knowledge may also be missing.

3. Graph-Guided Question Generation (QG)

To overcome linguistic ambiguity, KGLens uses GPT-4 to transform KG triplets into natural language. It incorporates entity aliases (e.g., specifying "Waterloo, Ontario" vs. "Waterloo, Iowa") and dynamically chooses between Yes/No and open-ended "Wh-" questions based on the graph's structure to ensure clear, verifiable answers.

Experimental Setup and Results

The researchers evaluated KGLens using three domain-specific KGs curated from Wikidata: Country (7,844 facts), NBA (2,689 facts), and Movies (8,704 facts). The evaluation focused on identifying "blind spots"—facts the model consistently fails to retrieve.

Superior Efficiency

KGLens demonstrates a significant reduction in the computational cost of evaluation. By focusing on challenging facts rather than redundant probing of known information, the framework achieves the same level of assessment accuracy as a 4.5-epoch brute-force search while using only 65% of the compute resources.

Comparison of Mean Squared Error (MSE) across different sampling strategies. Thompson sampling with propagation (green) achieves lower error rates with significantly fewer API requests compared to brute-force methods.

Model Insights

  • The "Cautious" LLM: High-performing models like GPT-4o often exhibit a "cautious disposition," preferring to withhold specific details rather than hallucinate. This manifests as a higher "zero-sense" rate (facts never correctly answered) in specific niche domains.
  • Temporal Blindness: Using the Movie KG, the authors visualized knowledge degradation. Models trained on data through 2021 showed a sharp spike in errors for films released in 2022 and 2023, providing a clear visualization of the "knowledge cutoff."
  • Verification Accuracy: The automated answer verification system, powered by GPT-4, achieved a 95.7% alignment with human annotators, validating the feasibility of large-scale automated probing.

Conclusion and Future Work

KGLens provides a robust and efficient solution for mapping the boundaries of LLM knowledge. By reframing evaluation as a bandit problem, it allows researchers to find model weaknesses faster and more reliably. Future work aims to expand the framework to support "multi-hop" reasoning questions (e.g., connecting multiple edges) and to refine the Bayesian update methods for even greater sampling efficiency. As LLMs continue to scale, tools like KGLens will be essential for ensuring the factual integrity of AI systems.

Summary updated

BibTeX
@misc{zheng2023kglens,
  author = {Shangshang Zheng and He Bai and Yizhe Zhang and Yi Su and Xiaochuan Niu and Navdeep Jaitly},
  title = {{KGLens: A Parameterized Knowledge Graph Solution to Assess What an LLM Does and Doesn't Know}},
  year = {2023},
  eprint = {2312.11539},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2312.11539},
}
Figure