Knowledge-based Consistency Testing of Large Language Models

Sai Sathiesh Rajan, Ezekiel Soremekun, Sudipta Chattopadhyay
7/3/2024
cs.CLcs.AIcs.LG

No official code found. Best implementation: sparkssss/KonTest (0 stars, last commit 2025-09-21).

Abstract

In this work, we systematically expose and measure the inconsistency and knowledge gaps of Large Language Models (LLMs). Specifically, we propose an automated testing framework (called KonTest) which leverages a knowledge graph to construct test cases. KonTest probes and measures the inconsistencies in the LLM's knowledge of the world via a combination of semantically-equivalent queries and test oracles (metamorphic or ontological oracle). KonTest further mitigates knowledge gaps via a weighted LLM model ensemble. Using four state-of-the-art LLMs (Falcon, Gemini, GPT3.5, and Llama2), we show that KonTest generates 19.2% error inducing inputs (1917 errors from 9979 test inputs). It also reveals a 16.5% knowledge gap across all tested LLMs. A mitigation method informed by KonTest's test suite reduces LLM knowledge gap by 32.48%. Our ablation study further shows that GPT3.5 is not suitable for knowledge-based consistency testing because it is only 60%-68% effective in knowledge construction.

View on arXivView PDF

Code Implementations(1)

sparkssss/KonTestCommunity100%

Replication Package for KonTest

00PythonOct 26, 20231 years ago

Cite this paper

@article{rajan2024knowledgebased,
  title  = {Knowledge-based Consistency Testing of Large Language Models},
  author = {Sai Sathiesh Rajan and Ezekiel Soremekun and Sudipta Chattopadhyay},
  year   = {2024},
  eprint = {2407.12830},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2407.12830v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2407.12830.svg)](https://codeofpaper.com/paper/2407.12830)

Discussion