Abstract
Large Language Models (LLMs) have demonstrated impressive performance on several benchmarks. However, traditional studies do not provide formal guarantees on the performance of LLMs. In this work, we propose a novel certification framework for LLM, QuaCer-C, wherein we formally certify the knowledge-comprehension capabilities of popular LLMs. Our certificates are quantitative - they consist of high-confidence, tight bounds on the probability that the target LLM gives the correct answer on any relevant knowledge comprehension prompt. Our certificates for the Llama, Vicuna, and Mistral LLMs indicate that the knowledge comprehension capability improves with an increase in the number of parameters and that the Mistral model is less performant than the rest in this evaluation.
Introduction
As Large Language Models (LLMs) are increasingly deployed in safety-critical fields like precision medicine, their ability to perform knowledge comprehension—extracting relevant facts from a provided context and reasoning over them—becomes paramount. However, current evaluation methods suffer from three major flaws: data leakage (training on benchmarks), limited scope (static datasets), and a lack of statistical reliability. A simple accuracy score on a small test set does not provide a guarantee of how a model will perform on the "average case" in real-world deployments.
To address this, we introduce QuaCer-C, a framework that treats evaluation as a formal verification problem. Instead of reporting a single accuracy metric, QuaCer-C provides a certificate: a high-confidence lower bound on the probability of correct reasoning across a vast distribution of potential queries. This approach moves beyond static benchmarks to provide formal probabilistic guarantees for how reliably a model can reason over in-context information.
Methodology
The QuaCer-C framework defines a "specification"—a mathematical distribution of millions of possible multi-hop reasoning prompts—using Knowledge Graphs (KGs).
- Multi-hop Reasoning via DAGs: Queries are represented as paths through a graph. For example, to answer a medical query, the model might need to link a drug to a specific gene, and that gene to a disease.
- Natural Noise Injection: To simulate real-world complexity, the framework injects "distractors" (irrelevant but semantically related information) and "shuffling" (randomizing the order of facts) into the prompts.
- Quantitative Certification: The framework uses the Clopper-Pearson method to calculate high-confidence (95%) intervals. Instead of a simple percentage, it provides a range representing the true probability of the model answering any query from the distribution correctly.
Experimental Evaluation
We evaluated a range of models, including GPT-4o, Gemini 1.5, Llama-3.2, Vicuna, Mistral, and Phi-3, using two primary knowledge bases: PrimeKG (a specialized graph for precision medicine with ~4 million relationships) and Wikidata5m (a massive, general-purpose graph).
Key Insights
- The "Distractor" Vulnerability: A striking finding is how easily state-of-the-art models are "distracted." When irrelevant but related text is added to a prompt, performance drops significantly. For instance, GPT-4o’s certified lower bound for Wikidata accuracy dropped from 0.80 to 0.62 in the presence of distractors.
- Performance Hierarchies: The use of formal bounds allows for rigorous ranking. Gemini-1.5-Pro and GPT-4o lead the pack, especially in the medical domain (PrimeKG), achieving certified lower bounds near 0.97 in vanilla settings. Conversely, the Mistral model was found to be less performant in this evaluation.
- Impact of Precision and Scale: Knowledge comprehension generally improves with an increase in parameters. However, 4-bit quantization consistently degrades a model's ability to reason compared to fp16 precision. For smaller models like Phi-3, adding Chain-of-Thought (CoT) steps significantly raised the certified lower bounds.
Conclusion
QuaCer-C provides a rigorous path forward for certifying LLMs in high-stakes environments. By providing formal probabilistic guarantees, it offers a more reliable measure of a model's true reasoning capabilities than traditional static benchmarks, which often overestimate performance. Future work will focus on optimizing the inference pipeline to reduce computational costs and extending the framework to certify properties like safety and fairness.
Summary updated