# Statistical Hypothesis Testing for Auditing Robustness in Language Models

This page is generated by a language model

The explanation is generated from the linked sources. The abstract and citation refer to the original research.

Authors: Paulius Rauba; Qiyao Wei; Mihaela van der Schaar

ICML 2025. Conference paper.

Canonical page: https://www.pauliusrauba.com/research/statistical-hypothesis-testing-llm-robustness

Original record: https://proceedings.mlr.press/v267/rauba25a.html

arXiv: 2506.07947

Paper PDF: https://www.pauliusrauba.com/research/statistical-hypothesis-testing-llm-robustness/paper.pdf

Full paper text: https://www.pauliusrauba.com/research/statistical-hypothesis-testing-llm-robustness/full-text.txt

Research code: https://github.com/vanderschaarlab/dbpa

Page updated: 2026-11-23. Paper publication year: 2025.

## Original abstract

Consider the problem of testing whether the outputs of a large language model (LLM) system change under an arbitrary intervention, such as an input perturbation or changing the model variant. We cannot simply compare two LLM outputs since they might differ due to the stochastic nature of the system, nor can we compare the entire output distribution due to computational intractability. While existing methods for analyzing text-based outputs exist, they focus on fundamentally different problems, such as measuring bias or fairness. To this end, we introduce distribution-based perturbation analysis, a framework that reformulates LLM perturbation analysis as a frequentist hypothesis testing problem. We construct empirical null and alternative output distributions within a low-dimensional semantic similarity space via Monte Carlo sampling, enabling tractable inference without restrictive distributional assumptions. The framework is (i) model-agnostic, (ii) supports the evaluation of arbitrary input perturbations on any black-box LLM, (iii) yields interpretable p-values; (iv) supports multiple perturbations via controlled error rates; and (v) provides scalar effect sizes. We demonstrate the usefulness of the framework across multiple case studies, showing how we can quantify response changes, measure true/false positive rates, and evaluate alignment with reference models. Above all, we see this as a reliable frequentist hypothesis testing framework for LLM auditing.

## In brief

This ICML paper develops a statistical audit of LLM response changes. DBPA uses repeated samples, semantic similarity and permutation tests to distinguish detectable intervention effects from ordinary sampling variation.

## How can we statistically audit a black-box language model?

An intervention can change an LLM’s behavior in several ways: modifying an input, altering a system instruction, or replacing the model itself. Comparing a single response before and after the intervention is unreliable because language generation is stochastic. A useful audit must distinguish the intervention effect from changes that occur through sampling alone.

This ICML 2025 paper develops **Distribution-Based Perturbation Analysis (DBPA)** as a frequentist framework for that task. It compares sampled response distributions through semantic similarity, reports an effect size, and uses a permutation test to quantify statistical evidence. It requires the ability to sample outputs, so it can audit models whose weights are inaccessible.

## How the statistical test works

The procedure begins with independent responses from the reference condition and the perturbed condition. A semantic similarity function maps pairs of responses to scalar measurements. Within-reference similarities represent ordinary response variability; cross-condition similarities represent the relationship between the reference and intervention.

A discrepancy statistic summarizes how different those two collections are. The paper discusses Jensen–Shannon divergence as one choice, alongside alternatives. Its interpretation depends on the semantic representation and comparison function used in the audit.

The permutation step is especially important. Pairwise similarity measurements share response samples and are therefore dependent. **The paper permutes the original pooled responses and reconstructs the similarity distributions**, rather than treating all similarity scores as independent data. Under its null exchangeability assumption, this produces a valid randomization-based comparison.

The resulting p-value and effect size answer different questions. The statistic describes the measured change; the p-value evaluates how unusual that statistic is under the null procedure. Reusing the collected responses for permutations avoids generating fresh model outputs for every permutation. See [Section 3 and Algorithm 1](https://www.pauliusrauba.com/research/statistical-hypothesis-testing-llm-robustness/paper.pdf#page=4).

## What the case studies measure

The paper investigates three practical uses: measuring response changes under persona instructions, distinguishing relevant from irrelevant prompt perturbations, and comparing outputs with a reference language model. Additional studies examine input length, alternative similarity measures, embeddings and cost.

![ROC curves compare true-positive and false-positive detection across three language models in a controlled perturbation study.](https://www.pauliusrauba.com/research/statistical-hypothesis-testing-llm-robustness/framework.png)

Original Figure 1, from the paper’s healthcare-prompt case study. These curves concern the specified perturbation task, not general clinical performance. Source: [Section 4.2](https://www.pauliusrauba.com/research/statistical-hypothesis-testing-llm-robustness/paper.pdf#page=7), CC BY 4.0.

In that case study, the authors define **control perturbations**, which should leave a recommendation unchanged, and **target perturbations**, which should alter it. The test then provides true-positive and false-positive rates over those interventions. Varying the significance threshold yields an ROC curve.

| Model shown in Figure 1 | Reported ROC-AUC in this experiment |
| --- | ---: |
| Mistral 7B Instruct | 0.65 |
| Phi-3 mini 4k | 0.56 |
| MagicPrompt | 0.43 |

The paper also shows why the model with the highest overall AUC need not be the preferred model at every operating point. In its example, the choice changes when the allowed false-positive rate changes from 1% to 5%. This illustrates a useful evaluation principle: an aggregate benchmark score can conceal differences that matter at a specific error tolerance.

These results should not be interpreted as clinical validation. The healthcare prompts provide a controlled setting in which expected response changes can be specified. The paper evaluates a statistical auditing procedure, not a deployed medical service.

## What “alignment with a reference model” means here

One case study compares the response distributions of candidate models with a reference model. In this context, alignment means agreement under the chosen behavioral comparison. It is a way to study whether substituting a model changes responses in the tested setting.

This is narrower than alignment with human values or a demonstration of safety. A reference model can itself be wrong, and matching its response distribution does not resolve that issue. The framework supplies a measurement; the choice and interpretation of the reference remain substantive evaluation decisions.

## Scope and limitations

The test is sensitive to differences captured by the selected semantic similarity function. Non-rejection means that the audit did not detect a shift with that representation and sample size. It does not establish exact equality of the full distributions over text.

The permutation argument requires exchangeability under the null. Model updates, changing decoding parameters, or dependent sampling can complicate that assumption. Multiple perturbation tests also need an appropriate correction; the paper discusses Bonferroni control and the power–sample-size trade-off.

In practical use, record the model version, prompt, decoding configuration, embedding choice, sample count and testing procedure. Those details determine what the result actually supports and whether another researcher can reproduce it.

## Questions about the paper

### Why not compare two answers with an embedding distance?

A single distance contains both intervention effects and ordinary sampling variation. Repeated samples provide a reference for separating those sources of difference.

### Can DBPA prove that two models are equivalent?

This procedure tests for detectable differences. Failure to reject its null is not an equivalence test or a proof that two systems behave identically in every setting.

### How does this differ from token-importance visualization?

DBPA tests arbitrary interventions. The related DBSA paper focuses on the sensitivity associated with individual input tokens and presents the results as visual explanations.

## Sources and implementation

The authoritative conference record is [PMLR volume 267, pages 51297–51313](https://proceedings.mlr.press/v267/rauba25a.html). The method and assumptions are in Sections 2–3; the reported examples are in Section 4. Code is available in the authors’ [DBPA repository](https://github.com/vanderschaarlab/dbpa). The earlier 2024 workshop paper is separately documented in this collection.


## Cite this paper

Rauba, P., Wei, Q., & van der Schaar, M. (2025). Statistical Hypothesis Testing for Auditing Robustness in Language Models. Proceedings of the 42nd International Conference on Machine Learning, 267, 51297–51313. https://proceedings.mlr.press/v267/rauba25a.html

```bibtex
@InProceedings{pmlr-v267-rauba25a,
  title = 	 {Statistical Hypothesis Testing for Auditing Robustness in Language Models},
  author =       {Rauba, Paulius and Wei, Qiyao and Van Der Schaar, Mihaela},
  booktitle = 	 {Proceedings of the 42nd International Conference on Machine Learning},
  pages = 	 {51297--51313},
  year = 	 {2025},
  editor = 	 {Singh, Aarti and Fazel, Maryam and Hsu, Daniel and Lacoste-Julien, Simon and Berkenkamp, Felix and Maharaj, Tegan and Wagstaff, Kiri and Zhu, Jerry},
  volume = 	 {267},
  series = 	 {Proceedings of Machine Learning Research},
  month = 	 {13--19 Jul},
  publisher =    {PMLR},
  pdf = 	 {https://raw.githubusercontent.com/mlresearch/v267/main/assets/rauba25a/rauba25a.pdf},
  url = 	 {https://proceedings.mlr.press/v267/rauba25a.html},
  abstract = 	 {Consider the problem of testing whether the outputs of a large language model (LLM) system change under an arbitrary intervention, such as an input perturbation or changing the model variant. We cannot simply compare two LLM outputs since they might differ due to the stochastic nature of the system, nor can we compare the entire output distribution due to computational intractability. While existing methods for analyzing text-based outputs exist, they focus on fundamentally different problems, such as measuring bias or fairness. To this end, we introduce distribution-based perturbation analysis, a framework that reformulates LLM perturbation analysis as a frequentist hypothesis testing problem. We construct empirical null and alternative output distributions within a low-dimensional semantic similarity space via Monte Carlo sampling, enabling tractable inference without restrictive distributional assumptions. The framework is (i) model-agnostic, (ii) supports the evaluation of arbitrary input perturbations on any black-box LLM, (iii) yields interpretable p-values; (iv) supports multiple perturbations via controlled error rates; and (v) provides scalar effect sizes. We demonstrate the usefulness of the framework across multiple case studies, showing how we can quantify response changes, measure true/false positive rates, and evaluate alignment with reference models. Above all, we see this as a reliable frequentist hypothesis testing framework for LLM auditing.}
}
```
