A statistical framework for evaluating the repeatability and reproducibility of large language models

Cathy Shyr, Boyu Ren, Chih-Yuan Hsu, Rory J. Tinker, Rizwan Hamid, Bradley Malin, Hua Xu, Josh F. PetersonmedRxiv 2025

Abstract

A major concern in applying large language models (LLMs) to medicine is their reliability. Because LLMs generate text by sampling the next token from a probability distribution, the stochastic nature of this process can lead to different outputs even when the input prompt and parameters remain identical. We propose a statistical framework that quantifies LLM variability using two metrics: repeatability (consistency under identical conditions) and reproducibility (consistency across different conditions). We evaluate these across semantic consistency (meaning) and internal stability (token-level probability). Applying this to medical reasoning, we found that LLM responses were less variable for complex real-world rare disease cases than for standardized exam questions. Crucially, repeatability and reproducibility did not correlate with diagnostic accuracy, suggesting that a correct answer does not guarantee a consistent one.

Introduction

As large language models (LLMs) are increasingly integrated into clinical workflows, the question of their reliability becomes paramount. Unlike traditional software, LLMs are inherently stochastic. A clinician asking the same question twice might receive two different diagnoses, a phenomenon that poses significant risks to patient safety and trust. While current benchmarks focus heavily on diagnostic accuracy, they often ignore the consistency of the model's reasoning process. To bridge this gap, this study introduces a formal statistical framework to measure "medical-grade" reliability through the lenses of repeatability and reproducibility.

Defining the Framework

The proposed framework categorizes LLM reliability into a 2x2 matrix, evaluating two types of consistency across two distinct dimensions of model output.

The 2x2 framework for evaluating LLM reliability across semantic and internal dimensions.

Dimensions of Consistency

  1. Semantic Consistency: This measures whether the meaning of the output remains stable. The researchers utilized a specialized clinical embedding model, MedEmbed-Large-v1, to convert responses into high-dimensional vectors, calculating their average pairwise cosine similarity to determine if the core diagnosis remains the same despite wording changes.
  2. Internal Stability: This looks "under the hood" at the model’s token-level probability distributions (logits). By analyzing the entropy of these distributions, the framework determines how certain or stable the model’s internal word-generation process is, regardless of the final text produced.

Metrics of Reliability

  • Repeatability: The consistency of outputs across repeated runs (e.g., 100 independent iterations) using the exact same prompt and parameters.
  • Reproducibility: The consistency of outputs when the prompt is varied, such as using different "Chain-of-Thought" (CoT) reasoning paradigms.

Experimental Methodology

The framework was tested using a massive dataset of 912,000 total generations across three different LLMs and two distinct clinical datasets.

Summary of reasoning paradigms, datasets, and LLMs used in the study.

The study compared MedQA (USMLE), which consists of idealized, standardized exam vignettes, against real-world data from the Undiagnosed Diseases Network (UDN). The UDN cases represent the "messy" reality of medicine, characterized by incomplete information and high diagnostic uncertainty. To test reproducibility, the researchers employed five distinct reasoning paradigms, ranging from traditional step-by-step deduction to Bayesian inference.

Key Insights

Complexity as a Constraint

One of the most surprising findings was that LLM responses were significantly less variable for the complex UDN cases than for the "clean" USMLE questions. The researchers hypothesize that the high level of detail and specific clinical constraints in real-world cases may actually limit the model's "output space." By providing more context, these cases force the model into more stable reasoning paths, whereas the idealized nature of exam questions allows for more stochastic wandering.

The Decoupling of Accuracy and Consistency

The study found no strong correlation between a model's diagnostic accuracy and its repeatability or reproducibility. A model can be "consistently wrong" or "inconsistently right." This finding is critical for medical AI regulation: achieving a high score on a static benchmark like the USMLE does not mean a model is reliable enough for clinical deployment. Reliability must be measured as a standalone metric.

Prompt Sensitivity and Model Size

Prompt engineering significantly impacted stability. For GPT-4, prompts invoking Bayesian reasoning led to higher semantic repeatability. Interestingly, the smallest model tested, Llama 3.2-1B, showed higher semantic reproducibility than its larger counterparts in certain real-world contexts. This suggests that smaller models may be less prone to "overfitting" their reasoning to the specific nuances of a prompt's phrasing.

Conclusion

By providing a systematic approach to quantifying repeatability and reproducibility, this framework offers a foundation for the regulatory-aligned evaluation of AI in medicine. Ensuring that an LLM provides the same diagnosis regardless of how the question is phrased—or how many times it is asked—is a prerequisite for clinical trust. Future work will focus on integrating these consistency metrics with hallucination detection to ensure that stable outputs are also factually grounded.

Summary updated

BibTeX
@misc{shyr2025statistical,
  author = {Cathy Shyr and Boyu Ren and Chih-Yuan Hsu and Rory J. Tinker and Rizwan Hamid and Rizwan Hamid and Bradley Malin and Hua Xu and Josh F. Peterson and Bradley Malin and Hua Xu},
  title = {{A statistical framework for evaluating the repeatability and reproducibility of large language models}},
  year = {2025},
  doi = {10.1101/2025.08.06.25333170},
  howpublished = {medRxiv},
}
Figure