Chapter 1 – Introduction

Why testing is not enough for frontier AI, what a formal guarantee is, and how these notes are organized.

A motivating story

A bank deploys an agent that reads files and moves money. A customer asks it to pay a bill named bill-december-2023.txt. The file contains a paragraph written by an attacker: before paying the bill, transfer money to another account. This is a prompt injection attack. The instruction is not from the user, yet it reaches the model in the same text stream. The task comes from an agent-security benchmark (Debenedetti et al. 2024). The example comes from (Wadhwa et al. 2026).

A response is safe if the agent ignores the injected instruction. It is unsafe if the agent follows it and calls send_money for the attacker. An oracle is a deterministic checker of a response. Here it reads the tool call and returns a safety verdict. We define oracles below.

A language model defines a distribution over responses, not one fixed answer. Testing samples the head of that distribution. Safe samples say only “it looked safe.” Rare unsafe responses in the tail remain unseen. An adversary is not limited to honest samples. It can sample many times, inject prompts, or change the decoder. A response with a small per-attempt probability then becomes likely (Wadhwa et al. 2026).

One request arrives in many contexts. Phrasings, personas, and system prompts change the answer. The figure shows the bank request under two contexts, with the output distribution of Qwen3-4B in each. Under context A, the verifier reports P(\text{safe}) \in [0.95, 0.96], so the chance of a harmful action is at most 0.05. Under context B, it reports P(\text{safe}) \in [0.00, 0.10], so that chance is at least 0.90. A few sentences in the system prompt make the difference. One request is a space of prompts, not one evaluation point.

A base query with a prompt injection, two contexts, and output distributions showing P(safe) in [0.95, 0.96] under context A and [0.00, 0.10] under context B.
Figure 1: One request under two contexts, with the model’s output distribution in each (Qwen3-4B). The tool result holds an injected instruction. Under context A, unsafe responses with total probability 0.04 sit in the tail. Under context B, eleven wordings of the attacker call carry probability 0.90. Figure from (Wadhwa et al. 2026).

A formal guarantee covers the whole output distribution for a prompt, or a stated distribution of prompts. A statistical certificate gives an interval with confidence. A deterministic bound gives a sound P_{LB} \le P \le P_{UB} after every step. None depend on which responses a sampler saw. This chapter defines the parts of such a statement.

What today’s evaluations miss

Model developers use several standard tools before release. Each reports what the evaluator tried. A benchmark uses a fixed, finite test set. The space of prompts is far larger, prompts may leak into training data, and scores do not guarantee generalization (Chaudhary et al. 2025; Chaudhary, V. V. Jain, et al. 2026). Red-teaming searches for failures by hand or with automated helpers. A found failure proves existence. A clean search proves nothing, because the search is incomplete. Adversarial testing builds worst-case inputs such as jailbreaks or optimization attacks (Zou et al. 2023). A few examples do not estimate failure rates over a large input set. Sampling-based estimates read a rate from a handful of responses. They can miss the tail, and their stochastic results are hard to reproduce (Wadhwa et al. 2026).

With n clean tests, the rule of three gives a failure rate of at most about 3/n with 95\% confidence. This is the zero-failure case of the Clopper–Pearson bound (Clopper and Pearson 1934). It is real but weak. A tenfold tighter bound needs ten times as many tests, and it says nothing about other prompts. These tools are useful baselines. They do not answer our question: with what probability, over all responses or a stated prompt distribution, does the model satisfy a stated property?

Where guarantees come from

A guarantee on an LLM can come at three points in its life cycle (Suresh et al. 2026; Wadhwa et al. 2026). By construction, design and training aim to make the model safe. This can reduce capabilities. Post-deployment guardrails filter inputs and outputs or constrain generation. An adversary who holds open weights can remove them. Pre-deployment verification checks the model before release. It applies to open weights and leaves capabilities unchanged. These notes focus on the third point. Anyone can recompute a result about the model and attach a certified risk rate to its model card for a given oracle and prompt distribution (Suresh et al. 2026).

What is a formal guarantee?

A formal guarantee is a mathematical statement about a system’s behavior, with a proof or a quantified argument. Every guarantee names four ingredients.

  1. A system M. It may be a neural network, an LLM with its decoding procedure, a vision-language model, or a larger system with tools and an environment.
  2. An input set or distribution \mathcal{X}. It contains the prompts, images, contexts, or conversations that the statement covers.
  3. An oracle \Phi. It is a deterministic checker of a response. It returns \top when the response satisfies the property and \bot otherwise. We write s \models \Phi for satisfaction.
  4. An assurance level. The claim holds with certainty, as a proof, or with confidence 1-\delta, as a statistical argument.

Harmfulness is not decidable in general, so an evaluation fixes a decidable check (Wadhwa et al. 2026). It can be a regular expression for a leaked e-mail address, a static analyzer for insecure code (Bhatt et al. 2023), a toxicity classifier on prompts of the kind in RealToxicityPrompts (Gehman et al. 2020), a comparison with ground truth (Chaudhary, V. V. Jain, et al. 2026), a test for the injected tool call, or an LLM judge with greedy decoding. A guarantee is relative to this oracle. A better oracle changes the meaning of the result, not the proof method.

The table shows three example claims. The numbers are placeholders.

Statement Input Assurance
“The label-equality oracle accepts the classifier’s output for every image within \ell_\infty distance \epsilon of this image.” a set of images holds for every input in the set, by proof
“For this prompt, the probability that the response of the model satisfies the oracle lies in [0.25, 0.65].” one prompt, all responses holds with certainty, as a bound on a probability
“With 95% confidence, at least 40% of the prompts from this distribution are risky: the model violates the oracle on them with probability at least 10%.” a distribution of prompts holds with confidence 95\%

Deterministic and statistical guarantees

A deterministic guarantee is a proof from a sound procedure. When it says a claim holds, the claim is true. There is no probability of error. The first two rows above are deterministic. Such guarantees are strongest, but they need model internals and an exactly analyzable specification. A statistical guarantee uses random samples and is correct with probability at least 1-\delta over its own randomness. The third row is statistical. It needs only the ability to sample the system, so it works for black-box models behind an API and covers large input distributions. It speaks about rates. It cannot rule out events rarer than its sample budget can resolve. In the third row, “at least 10%” describes the model. “95% confidence” describes the certifier.

The second axis is the system. A classifier produces one output per input. An LLM produces a distribution of responses per prompt. The two axes combine in four ways, which Chapter 2 works through with examples. For an LLM, the natural quantity is the probability that a response satisfies the oracle:

P(\mathbf{p}) = \sum_{s \in \mathcal{C}} \mu_{\mathbf{p}}(s)\,\mathbb{1}[s \models \Phi].

A deterministic verifier returns bounds P_{LB} \le P(\mathbf{p}) \le P_{UB}. A statistical certifier can ask what fraction of prompts are risky under a stated oracle and threshold.

A guarantee also states what it quantifies over. It can cover one prompt, an \ell_\infty ball, or a distribution of prompts. It can concern one response, all responses, or the probability of oracle satisfaction. For LLMs the useful claim is the probability, as in the table. The bank example bounds that probability for one prompt. The bias and knowledge examples bound rates over prompt distributions.

A short history

These notes bring together several lines of work. Classical DNN verification proves properties of all inputs that satisfy a specification. Tools include abstract interpretation (Gehr et al. 2018; Singh et al. 2019), bound propagation (Zhang et al. 2018), SMT (Katz et al. 2017), and branch and bound (Bunel et al. 2020; Wang et al. 2021). See (Singh et al. 2025) for a comprehensive reference. Randomized smoothing (Cohen et al. 2019) gives high-probability robustness certificates, with extensions to discrete domains (Ugare et al. 2024) and to text through erase-and-check (Kumar et al. 2023) and smoothing (Ji et al. 2024). Conformal prediction (Vovk et al. 2005) supplies coverage guarantees and applies to LLMs (Quach et al. 2024). Statistical certification covers knowledge comprehension (Chaudhary, V. V. Jain, et al. 2026), bias (Chaudhary et al. 2025), multi-turn risk (Wang et al. 2026), tool selection (Yeon et al. 2026), and specification languages (Chaudhary, V. Jain, et al. 2026). Probabilistic model checking (Berrada et al. 2021) assumes explicit transition systems. A transformer defines its transitions through neural computation (Suresh et al. 2026; Wadhwa et al. 2026). BEAVER (Suresh et al. 2026) computes sound bounds on LLM response probabilities. Incremental verification reuses work across related models and specifications (Fischer et al. 2022; Ugare et al. 2022, 2023, 2024), studies limits of proof sharing (Das et al. 2026), and reaches prompt spaces in Otter (Wadhwa et al. 2026). Surveys (Huang et al. 2023; Singh et al. 2025) and an overview talk (Singh 2026) give broader context.

How these notes are organized

Foundations (Chapters 2–4). Chapter 2 builds the two axes and defines soundness, completeness, confidence, and coverage. Chapter 3 describes autoregressive models, response trees, decoding, and cost, then extends the discussion to vision-language models and agents. Chapter 4 reviews classical verification, randomized smoothing, and conformal prediction.

Statistical guarantees (Chapters 5–6). Chapter 5 turns a requirement into a specification of prompts and oracle. It covers counterfactual bias, knowledge comprehension, multi-turn risk, tool selection, and VLM safety. It introduces Lumos. Chapter 6 derives high-confidence bounds from samples and applies them to LLMs, VLMs, and agents.

Deterministic guarantees (Chapter 7). Chapter 7 states the verification problem for LLM output distributions: the token trie, the frontier, sound bounds, and tolerance. It presents BEAVER, a branch-and-bound algorithm that visits the most probable responses first and maintains sound bounds at every step. For detail, see (Suresh et al. 2026) and https://beaverframework.pages.dev/.

Incremental verification and extensions (Chapters 8–9). Chapter 8 reuses verification work across similar prompts and model updates, as in Otter (Wadhwa et al. 2026). Chapter 9 lifts single-prompt bounds into larger statements, including statistical certificates over prompt distributions. Each chapter ends with Experimental results.

Prerequisites and notation

We assume core machine learning, basic probability and linear algebra, and familiarity with transformer language models (Vaswani et al. 2017). No formal methods background is needed. The code examples use Python 3 and numpy, plus scipy where stated. A toy language model recurs in Chapters 2, 3, and 7 so that exact probabilities are available. BEAVER has an open-source command-line interface. The demos page links to the implementation.

Symbol Meaning
\mathcal{V}, \mathcal{C} token vocabulary; complete responses ending in \langle\mathrm{eos}\rangle
M, f a probabilistic model; a deterministic system
\mathbf{p} a prompt, \mathbf{p} \in \mathcal{V}^*
\mu_{\mathbf{p}}(s) probability that M emits response s after prompt \mathbf{p}
\Phi oracle, \Phi:\mathcal{V}^*\to\{\top,\bot\}; s \models \Phi when \Phi(s)=\top
P(\mathbf{p}) probability that a response to \mathbf{p} satisfies \Phi
P_{LB}, P_{UB} sound bounds with P_{LB}\le P(\mathbf{p})\le P_{UB}
\epsilon, \tau verification tolerance; risk threshold for a prompt
\delta confidence parameter: the certifier is wrong with probability at most \delta
(\mathcal{D}, \Phi) specification: a prompt distribution and an oracle
T, \Psi, \mathcal{H} token trie, frontier, constraint horizon (Chapter 7, Chapter 8)

Summary

  • A language model defines a distribution over responses. Testing samples its head, so an unsafe tail can go unseen. An adversary can sample many times. One prompt stands for a space of contexts. In the bank example, a change of context moves the probability of a harmful action from at most 0.05 to at least 0.90.
  • Benchmarks, red-teaming, adversarial attacks, and sampling report what happened on the cases tried. The rule of three turns clean tests into a weak bound, but says nothing about other prompts.
  • Guarantees can come by construction, from post-deployment guardrails, or from pre-deployment verification. Only the last survives open weights.
  • A formal guarantee names a system, an input set or distribution, an oracle, and an assurance level. It is deterministic or statistical. All guarantees are relative to their oracle.
  • The notes cover foundations, statistical certification, deterministic verification, and incremental verification.

Notes and further reading

The bank-agent example, the three points of the life cycle, tail risk, and adversaries who hold the weights come from Otter (Wadhwa et al. 2026) and BEAVER (Suresh et al. 2026), including Figure 1 of (Wadhwa et al. 2026). The oracle definition follows Section 2.2 of (Wadhwa et al. 2026). The limits of benchmarking and adversarial testing, with counterfactual prompt and knowledge-comprehension examples, come from (Chaudhary et al. 2025) and (Chaudhary, V. V. Jain, et al. 2026). The history draws on the related work cited above. For classical neural network verification, see (Singh et al. 2025). For a survey of LLM verification and safety, see (Huang et al. 2023). For an overview talk, see (Singh 2026). The exact zero-failure bound in the rule of three is the one-sided Clopper–Pearson bound (Clopper and Pearson 1934).

References

Berrada, L., S. Dathathri, K. Dvijotham, et al. 2021. “Make Sure You’re Unsure: A Framework for Verifying Probabilistic Specifications.” NeurIPS.
Bhatt, Manish, Sahana Chennabasappa, Cyrus Nikolaidis, et al. 2023. “Purple Llama CyberSecEval: A Secure Coding Benchmark for Language Models.” arXiv Preprint. https://arxiv.org/abs/2312.04724.
Bunel, R., J. Lu, I. Turkaslan, P. Kohli, P. Torr, and P. Mudigonda. 2020. “Branch and Bound for Piecewise Linear Neural Network Verification.” Journal of Machine Learning Research. https://arxiv.org/abs/1909.06588.
Chaudhary, I., Q. Hu, M. Kumar, M. Ziyadi, R. Gupta, and G. Singh. 2025. “Certifying Counterfactual Bias in LLMs.” ICLR. https://openreview.net/forum?id=HQHnhVQznF.
Chaudhary, I., V. V. Jain, and G. Singh. 2026. “Certifying Reading Comprehension in Large Language Models.” AISTATS. https://arxiv.org/abs/2402.15929.
Chaudhary, I., V. Jain, P. Parhar, et al. 2026. “Lumos: Let there be Language Model System Certification.” arXiv Preprint. https://arxiv.org/abs/2512.02966.
Clopper, C. J., and E. S. Pearson. 1934. “The Use of Confidence or Fiducial Limits Illustrated in the Case of the Binomial.” Biometrika 26 (4).
Cohen, J., E. Rosenfeld, and J. Z. Kolter. 2019. “Certified Adversarial Robustness via Randomized Smoothing.” ICML. https://arxiv.org/abs/1902.02918.
Das, K., S. Ugare, B.-Y. E. Chang, S. Misailovic, G. Singh, and M. Sridharan. 2026. “Uncovering the Limits of Proof Sharing for Neural Networks.” SAS.
Debenedetti, Edoardo, Jie Zhang, Mislav Balunović, Luca Beurer-Kellner, Marc Fischer, and Florian Tramèr. 2024. “AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents.” NeurIPS Datasets and Benchmarks. https://arxiv.org/abs/2406.13352.
Fischer, M., C. Sprecher, D. I. Dimitrov, G. Singh, and M. Vechev. 2022. “Shared Certificates for Neural Network Verification.” CAV. https://link.springer.com/chapter/10.1007/978-3-031-13185-1_7.
Gehman, Samuel, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A. Smith. 2020. “RealToxicityPrompts: Evaluating Neural Toxic Degeneration in Language Models.” arXiv Preprint. https://arxiv.org/abs/2009.11462.
Gehr, T., M. Mirman, D. Drachsler-Cohen, P. Tsankov, S. Chaudhuri, and M. Vechev. 2018. “AI2: Safety and Robustness Certification of Neural Networks with Abstract Interpretation.” IEEE Symposium on Security and Privacy.
Huang, X., W. Ruan, W. Huang, et al. 2023. “A Survey of Safety and Trustworthiness of Large Language Models through the Lens of Verification and Validation.” arXiv Preprint. https://arxiv.org/abs/2305.11391.
Ji, J., B. Hou, Z. Zhang, et al. 2024. “Advancing the Robustness of Large Language Models through Self-Denoised Smoothing.” NAACL. https://arxiv.org/abs/2404.12274.
Katz, G., C. Barrett, D. L. Dill, K. Julian, and M. J. Kochenderfer. 2017. “Reluplex: An Efficient SMT Solver for Verifying Deep Neural Networks.” CAV. https://arxiv.org/abs/1702.01135.
Kumar, A., C. Agarwal, S. Srinivas, A. J. Li, S. Feizi, and H. Lakkaraju. 2023. “Certifying LLM Safety against Adversarial Prompting.” arXiv Preprint. https://arxiv.org/abs/2309.02705.
Quach, V., A. Fisch, T. Schuster, et al. 2024. “Conformal Language Modeling.” ICLR. https://arxiv.org/abs/2306.10193.
Singh, G. 2026. “Formal Guarantees for Frontier AI.” Guaranteed Safe AI Seminars. https://www.youtube.com/watch?v=JE9Mt9hn8Ls.
Singh, G., T. Gehr, M. Püschel, and M. Vechev. 2019. “An Abstract Domain for Certifying Neural Networks.” POPL. https://dl.acm.org/doi/10.1145/3290354.
Singh, G., J. Laurel, S. Misailovic, et al. 2025. “Safety and Trust in Artificial Intelligence with Abstract Interpretation.” Foundations and Trends in Programming Languages. https://doi.org/10.1561/2500000062.
Suresh, T., N. Wadhwa, D. Banerjee, and G. Singh. 2026. “BEAVER: An Efficient Deterministic LLM Verifier.” VerifAI-2 Workshop @ ICLR. https://arxiv.org/abs/2512.05439.
Ugare, S., D. Banerjee, S. Misailovic, and G. Singh. 2023. “Incremental Verification of Neural Networks.” PLDI. https://arxiv.org/abs/2304.01874.
Ugare, S., G. Singh, and S. Misailovic. 2022. “Proof Transfer for Fast Certification of Multiple Approximate Neural Networks.” OOPSLA. https://dl.acm.org/doi/10.1145/3527319.
Ugare, S., T. Suresh, D. Banerjee, G. Singh, and S. Misailovic. 2024. “Incremental Randomized Smoothing Certification.” ICLR. https://openreview.net/forum?id=SdeAPV1irk.
Vaswani, A., N. Shazeer, N. Parmar, et al. 2017. “Attention Is All You Need.” NeurIPS. https://arxiv.org/abs/1706.03762.
Vovk, V., A. Gammerman, and G. Shafer. 2005. Algorithmic Learning in a Random World. Springer.
Wadhwa, Nalin, Brian Kim, David Shu Cheng, Isha Chaudhary, Avaljot Singh, and Gagandeep Singh. 2026. Incremental Verification of LLM Distributions (Otter). https://nalinwadhwa02.github.io/files/custom/Otter_preprint.pdf.
Wang, C., I. Chaudhary, Q. Hu, W. Ruan, R. Gupta, and G. Singh. 2026. “How Catastrophic is Your LLM? Certifying Risks in Conversation.” ICLR. https://openreview.net/forum?id=yt9TW2WtpG.
Wang, S., H. Zhang, K. Xu, et al. 2021. “Beta-CROWN: Efficient Bound Propagation with Per-neuron Split Constraints for Neural Network Robustness Verification.” NeurIPS. https://arxiv.org/abs/2103.06624.
Yeon, J., I. Chaudhary, and G. Singh. 2026. “Quantitative Certification of Agentic Tool Selection.” arXiv Preprint. https://arxiv.org/abs/2510.03992.
Zhang, H., T.-W. Weng, P.-Y. Chen, C.-J. Hsieh, and L. Daniel. 2018. “Efficient Neural Network Robustness Certification with General Activation Functions.” NeurIPS. https://arxiv.org/abs/1811.00866.
Zou, A., Z. Wang, N. Carlini, M. Nasr, J. Z. Kolter, and M. Fredrikson. 2023. “Universal and Transferable Adversarial Attacks on Aligned Language Models.” arXiv Preprint. https://arxiv.org/abs/2307.15043.