BEAVER: An Efficient Deterministic LLM Verifier

arXiv:2512.05439 · cs.AI, cs.FL · Submitted 2025-12-05 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: AI Radio. Generated commentary on the latest Artificial Intelligence papers.

Tom: We're looking at the paper: "BEAVER: An Efficient Deterministic LLM Verifier".

Paper summary: Tom: So we’re looking at this paper called BEAVER: An Efficient Deterministic LLM Verifier and the first thing we see is that it tackles a big problem when you move large language models from research labs to actual production systems.

Jane: That sounds like something every practitioner in the field is grappling with, right? The core idea here seems to be moving past just guessing how good a model is by using sampling-based estimates and instead getting some kind of sound guarantee about what the model will actually do.

Lu: Exactly. Sampling gives you an intuition but no real guarantees, and BEAVER aims to give you deterministic, sound probability bounds on whether an LLM's response satisfies a specific property.

Meng: So if I’m running a model and I need to know the risk of it leaking sensitive data or generating insecure code, I don't want that intuition; I want something provable.

Tom: Right. And the authors say BEAVER systematically explores the model output space using two specific data structures: a token trie and a frontier. That’s how they manage this exploration without just brute-forcing every single possibility.

Jane: A token trie that tracks explored satisfying prefixes with their probabilities, and then a frontier for those incomplete sequences that are still eligible for expansion—that sounds like it’s managing the search space very intelligently.

Lu: Right. At each step, BEAVER selects an incomplete sequence from that frontier, queries the model for the next token probabilities, expands those into the trie with valid continuations, and updates bounds. It’s this iterative process that gives you anytime guarantees; you can stop at any point and still have a provably sound probability interval

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg2>: .

Meng: Anytime guarantees are good, but what about the practical side? Does this thing actually keep up with the speed of modern LLMs when we’re talking about deploying models that need to be fast?

Tom: That’s where they claim efficiency. They say BEAVER identifies two point five to three times more risky instances compared to baselines while only taking a tenth of the compute budget

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg1>: . That’s a massive win for practical risk assessment.

Jane: So, what does that mean for the people who only listen to the show? It means we can find significantly more dangerous instances than if we just used random sampling, and we do it using much less computing power.

Lalam: From my perspective, I see this framework as a way to characterize model properties and risk that constrained decoding or other inference time techniques simply cannot do

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg3>: .

Tom: Right. And they formalize the problem by modeling safety properties using linear temporal logic, specifically something called G phi, which means the property has to hold at every position of an execution

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg3>: .

Paper summary: Lu: That G phi structure is what allows BEAVER to aggressively prune the generation space during expansion because it knows exactly what kind of sequence it’s looking for

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg8>: .

Jane: So, if you’re thinking about the naive question a person might ask, "How does this actually work?" the answer is that it uses branch-and-bound over those two data structures to maintain provably sound upper and lower bounds on the probability of success

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg2>: .

Meng: And what about the cost? I’m worried about running this thing at scale. The paper says that for each instance, verification takes around nine point four seconds on Enron, eighteen point eight seconds on Secure Code, and so on

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg8>: .

Tom: And they keep the per-instance trie under five megabytes across all those tasks by pruning low-probability nodes and tokens during each expansion step

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg6>: . That keeps the memory footprint manageable.

Jane: It’s interesting because BEAVER doesn't just check one thing; it can provide distributional results too, which is useful for understanding broader risk

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg6>: . For example, on Llama-three point two point three billion instruct models, it certifies that twenty-nine out of fifty sampled instances are risky <ref:2512.05439#pg1>.

Lu: That means we can state with ninety five percent confidence that more than forty three percent of all possible adversarial contexts in that distribution would be certified as risky by BEAVER

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg6>: . That shifts the verification from a single example to characterizing a whole set of possibilities.

Tom: So, to wrap up on the title and authors, "BEAVER: An Efficient Deterministic LLM Verifier" points toward making this deterministic verification framework practical for real-world deployment

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg1>: .

Jane: And the implication is that we can move from just having an ad-hoc intuition about model behavior to having a systematic, provable method for characterizing tail risk before we let these models go live.

Meng: For those of us shipping models, it means we have a tool that identifies more risky prompts with less compute than existing methods

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg1>: . It’s a way to do principled risk assessment instead of just relying on empirical evaluation.

Lu: The limitation they flag is that BEAVER targets prefix-closed safety properties, which means it's focused on the G phi structure of safety properties

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg7>: . Extending this framework to richer temporal patterns is definitely the next direction for research in this area.

Tom: So, we’ve seen that BEAVER identifies more risky instances than ad-hoc evaluation with a fraction of the budget, establishing that deterministic verification of LLM behavior is feasible and practical for real-world deployment

BEAVER: An Efficient Deterministic LLM Verifier <ref:2512.05439#pg8>: .

Jane: And it gives us a concrete way to measure and characterize that risk across different models, which is really what we need when deploying AI systems.

Conclusion: Tom: So we're wrapping up this discussion on BEAVER, which is that new framework for checking if an AI model will actually do what we want it to do before we put it into a real system.

Jane: Exactly, so the authors are saying they built this tool to give us a solid way to calculate the probability of an LLM following a specific safety rule instead of just guessing with random tests.

Lu: They use these two data structures, the token trie and the frontier, to systematically explore all the possible ways an AI can respond to a prompt while keeping track of sound bounds at every step.

Meng: So it’s basically a smart search algorithm that doesn't just stop when it finds one good answer; it explores enough of the possibilities to give you a reliable number on the risk.

Tom: And what this means for us is that we can move away from just hoping our models are safe to actually getting a mathematical proof or at least a really tight bound on how risky they are.

Jane: It gives us a way to characterize the tail risk of these language models, which is that hard part where things go wrong in unexpected ways.

Lu: The method proves that this approach is sound, and it's actually optimal for finding the best bounds up to any level of accuracy you want.

Meng: I’m still looking at how much compute this thing takes compared to just running a few thousand samples, but the results say we get way more risky examples with less work.

Tom: Yeah, they showed it finds two point five to three times more risky instances while only using a tenth of the computing budget that other methods need.

Jane: That means for anyone building or deploying AI today, this could be a much more efficient way to do risk assessment than just running simple sampling tests.

Lu: The authors also showed they can use these per-prompt bounds to give you statistical results about the entire distribution of prompts, not just one example at a time.

Meng: That’s interesting because it means we can get a broader view of what kind of inputs might cause trouble across a whole set of data.

Tom: It really seems like this work establishes that deterministic verification isn't just some theoretical idea anymore; it’s something practical we can actually use in the real world to check on AI behavior.

Tarun Suresh, Nalin Wadhwa, Debangshu Banerjee, Gagandeep Singh

University of Illinois, Urbana-Champaign

cs.AI, cs.FL

Submitted: 2025-12-05

Updated: 2026-11-24

Code: https://github.com/unitaryai/detoxify

License: http://creativecommons.org/licenses/by/4.0/

Importance score: 97/100

The gist: As large language models (LLMs) transition from research prototypes to production systems, practitioners often need reliable methods to verify model outputs and characterize tail risk for safe…

Key concepts

Token Trie
A data structure used by BEAVER that tracks all explored sequences of tokens that satisfy a certain safety property. It helps the system efficiently store and manage the set of potentially valid output prefixes, allowing for systematic exploration without re-evaluating already pruned paths.
Frontier
The frontier in BEAVER is a collection of incomplete token sequences that are eligible for expansion. The algorithm selects sequences from this frontier to query the LLM for next-token probabilities, effectively guiding the search toward promising output paths.
Sound Bounds
These are mathematically provable upper and lower limits on the probability that an LLM response satisfies a given safety property. Unlike sampling, which is intuitive but not guaranteed, BEAVER ensures these bounds are always correct throughout its process.
Safety Properties (LTL Gϕ)
Safety properties are defined using Linear Temporal Logic (LTL), specifically the 'always' operator (Gϕ). This means a prompt satisfies the property if every position in the generated sequence adheres to a specific safety condition, modeling critical deployment constraints.

Terminology

Summary

As large language models (LLMs) transition from research prototypes to production systems, practitioners often need reliable methods to verify model outputs and characterize tail risk for safe deployment. p. 0

Where the paper says it

BEAVER: An Efficient Deterministic LLM Verifier Tarun Suresh*, Nalin Wadhwa*, Debangshu Banerjee, Gagandeep Singh ∗ University of Illinois, Urbana-Champaign {nalinw2,tsuresh3}@illinois. edu Abstract As large language models (LLMs) transition from research prototypes to production systems, practitioners often need reliable methods to verify model outputs and characterize tail risk for safe deployment.

<ref:2512.05439#pg1>. BEAVER is the first practical framework for computing deterministic, sound probability bounds on LLM satisfaction of safety properties. p. 0
Where the paper says it

While sampling-based estimates provide an ad-hoc intuition of model behavior, they offer no sound guarantees. We present BEAVER, the first practical framework for computing deterministic, sound probability bounds on LLM satisfaction of safety properties.

<ref:2512.05439#pg1>.

Pruning redundant reasoning tokens

BEAVER realizes this via branch-and-bound over two novel data structures: 1 a token trie tracking explored satisfying prefixes with their probabilities, and 2 a frontier of incomplete sequences eligible for expansion.<ref:2512.05439#pg2>. At each iteration, BEAVER selects an incomplete sequence, queries the LLM for next-token probabilities, expands satisfying continuations into the trie, and updates monotonically tightening upper and lower bounds. p. 1

Where the paper says it

BEAVER realizes this via branch-and-bound over two novel data structures: 1 a token trie tracking explored satisfying prefixes with their probabilities, and 2 a frontier of incomplete sequences eligible for expansion. At each iteration, BEAVER selects an incomplete sequence, queries the LLM for next-token probabilities, expands satisfying continuations into the trie, and updates monotonicallytightening upper and lower bounds.

<ref:2512.05439#pg2>. The bound gap PUB[Ψ] − PLB[Ψ] represents the uncertain probability mass, the set of incomplete sequences (corresponding to leaf nodes in Ψi) that may or may not lead to valid completions. p. 4
Where the paper says it

Meanwhile, wPUB[Ψ] represents the total probability mass of all sequences (both incomplete and complete) that satisfy constraint Φ, captured by sequences corresponding to all leaf nodes in Ψi ∪ Ψc. The bound gap PUB[Ψ] − PLB[Ψ] represents the uncertain probability mass, the set of incomplete sequences (corresponding to leaf nodes in Ψi) that may or may not lead to valid completions.

<ref:2512.05439#pg5>. To enable scalability (Section 4. p. 4
Where the paper says it

The bound gap PUB[Ψ] − PLB[Ψ] represents the uncertain probability mass, the set of incomplete sequences (corresponding to leaf nodes in Ψi) that may or may not lead to valid completions. We provide soundness and completeness proofs of our algorithm in Appendix D Pruned mass accumulator: To enable scalability (Section 4.

3), BEAVER may prune low-probability nodes and tokens during each expansion step. p. 4
Where the paper says it

We provide soundness and completeness proofs of our algorithm in Appendix D Pruned mass accumulator: To enable scalability (Section 4. 3), BEAVER may prune low-probability nodes and tokens during each expansion step.

<ref:2512.05439#pg6>.

How the training signal is built

The probability of generating a token sequence s = t1 · t2 · · ·tn given prompt p is defined as µ(s) = Yn i=1 PM(ti p · t1 · ···t i−1) (Equation 1).<ref:2512.05439#pg3>. Safety properties are modeled as linear temporal logic (LTL) and the broader safety/liveness classification of [Alpern and Schneider, 1985]. p. 2

Where the paper says it

We discuss common decoding strategies and their effects in Appendix A. Safety properties We model desired requirements on model outputs as safety properties in the sense of linear temporal logic (LTL) and the broader safety/liveness classification of [Alpern and Schneider, 1985, Lamport, 1977]: properties asserting that “nothing bad ever happens” along an execution.

<ref:2512.05439#pg3>. These are expressed as Gϕ, where the always-operator G requires the per-position predicate ϕ to hold at every position of an execution. p. 2
Where the paper says it

Safety properties We model desired requirements on model outputs as safety properties in the sense of linear temporal logic (LTL) and the broader safety/liveness classification of [Alpern and Schneider, 1985, Lamport, 1977]: properties asserting that “nothing bad ever happens” along an execution. In the LTL fragment, these are exactly the properties expressible as G ϕ, where the always-operator G requires the per-position predicate ϕ to hold at every position of an execution.

<ref:2512.05439#pg3, Definition 3. p. 2
Where the paper says it

We adapt this view to autoregressive generation by treating each token sequence as an execution and each prefix as a prefix of that execution. Definition 3.

1 (Safety property)>. p. 0
Where the paper says it

We present BEAVER, the first practical framework for computing deterministic, sound probability bounds on LLM satisfaction of safety properties. Given a prompt & any safety property, BEAVER systematically explores the model output space using novel Token trie and Frontier data structures, maintaining provably sound bounds at every iteration.

The verification problem is formalized as computing P = X s∈C µ(s) · 1[s = Φ] (Equation 2). p. 1
Where the paper says it

These results establish that LLM tail risk can be characterized soundly and tractably, enabling principled risk assessment that empirical evaluation cannot provide. Our main contributions are: • Formalization: We formalize LLM tail-risk assessment as a verification problem: computing probability bounds for safety properties of the form Gϕ, and introduce token trie and frontier data structures that enable sound bound computation.

<ref:2512.05439#pg4>.

Where the gains come from

BEAVER identifies 2.5−3× more risky instances compared to baselines while taking 1/10 of the compute budget. p. 0

Where the paper says it

BEAVER identifies 2. 5 − 3× more risky instances compared to baselines while taking 1/10 of the compute budget, surfacing tail risks that loose bounds and ad-hoc evaluation misses.

<ref:2512.05439#pg1>. This result establishes that LLM tail risk can be characterized soundly and tractably, enabling principled risk assessment that empirical evaluation cannot provide. p. 1
Where the paper says it

3× more risky instances across all datasets. These results establish that LLM tail risk can be characterized soundly and tractably, enabling principled risk assessment that empirical evaluation cannot provide.

<ref:2512.05439#pg1>. BEAVER consistently produces substantially tighter bounds than rejection sampling at the same compute budget. p. 7
Where the paper says it

4%) while comparable to peers on privacy and secure code. 2-3B appears broadly safest in our set, potentially because it is uniformly uncertain as its near-budget N across all tasks indicates that BEAVER exhausts its budget without converging, and tighter bounds would likely surface risks currently masked by interval width.

<ref:2512.05439#pg2>. This result shows that the verification framework is not specifically tied to safety properties. p. 0
Where the paper says it

We show that sound LLM verification is both possible and practical. We present BEAVER, the first framework to compute deterministic, sound probability bounds on LLM satisfaction of safety properties.

<ref:2512.05439#pg6>.

Cost and Runtime Analysis

BEAVER terminates in modest wall-clock time across all tasks.<ref:2512.05439#pg8>. Averaged across the evaluated models, per-instance verification takes 9. p. 7

Where the paper says it

BEAVER terminates in modest wall-clock time across all tasks. Averaged across the evaluated models, per-instance verification takes 9.

4s on Enron, 18. p. 1
Where the paper says it

practitioner can terminate at any iteration and obtain provably sound probability intervals. We evaluate BEAVER across 12 open-weight instruction-tuned models from six families on four safety properties: privacy leakage (Enron email leakage[Noever, 2020]), insecure code generation (CyberSecEval[Bhatt et al.

8s on Secure Code, 13. p. 2
Where the paper says it

We write s |= Φ for Φ(s) = ⊤. This formulation captures a wide range of deployment-relevant requirements, including syntactic validity, secure code generation, absence of toxic or private content, and functional correctness invariants.

7s on Stereotype, and 13. p. 1
Where the paper says it

We evaluate BEAVER across 12 open-weight instruction-tuned models from six families on four safety properties: privacy leakage (Enron email leakage[Noever, 2020]), insecure code generation (CyberSecEval[Bhatt et al. , 2023]), stereotype bias (DecodingTrust[Wang et al.

5s on Toxicity. p. 1
Where the paper says it

, 2023]), stereotype bias (DecodingTrust[Wang et al. , 2024]), and toxicity (RealToxicityPrompts[Gehman et al.

<ref:2512.05439#pg8>. Probability mass pruning (top-p = 0. p. 8
Where the paper says it

5s on Toxicity, well within the budget of any practical safety pre-deployment workflow. Probability mass pruning (top-p = 0.

99, top-k = 500, frontier cap 10,000) keeps the per-instance trie under 5 MB on every task. p. 8
Where the paper says it

Probability mass pruning (top-p = 0. 99, top-k = 500, frontier cap 10,000) keeps the per-instance trie under 5 MB on every task, with average pruned mass between 0.

<ref:2512.05439#pg8>.

Distributional Safety Certification

BEAVER’s per-prompt guarantees can be used to provide distributional results.<ref:2512.05439#pg6>. For Llama-3. p. 1

Where the paper says it

• BEAVER Algorithm: We present a novel branch-and-bound verification algorithm with formal soundness proofs, producing valid bounds at every iteration that converge toward the true probability. • Empirical Validation: We evaluate BEAVER on four safety properties (privacy, insecure code, stereotype bias, toxicity) across 12 models over 6 familie (Llama, Qwen, Gemma, Phi, OLMo, Mistral).

2-3B-Instruct, BEAVER certifies that 29 out of 50 sampled instances are risky. p. 8
Where the paper says it

For Llama-3. 2-3B-Instruct, BEAVER certifies that 29 out of 50 sampled instances are risky.

<ref:2512.05439#pg6>. This means we can state with 95% confidence that more than 43% of all possible adversarial contexts in this distribution would be certified as risky by BEAVER. p. 8
Where the paper says it

718] for the true fraction of risky instances. This means we can state with 95% confidence that more than 43% of all possible adversarial contexts in this distribution would be certified as risky by BEAVER.

<ref:2512.05439#pg6>.

Limitations

BEAVER targets prefix-closed safety properties (LTL Gϕ) which cover a broad class of deployment-critical specifications.<ref:2512.05439#pg7>. Extending the framework to richer temporal patterns is a natural next step in this direction. p. 8

Where the paper says it

7 Limitations BEAVER targets prefix-closed safety properties (LTL Gϕ) which cover a broad class of deploymentcritical specifications, and admit extention to non prefix-closed properties (Section 3. Extending the framework to richer temporal patterns is a natural next step in this direction.

<ref:2512.05439#pg7>. Finally, BEAVER scales efficiently to large LLMs, though computing sound bounds relies on white-box access to full token probability distributions. p. 8
Where the paper says it

The Max-µ heuristic performs well across our benchmarks; integrating learned value functions or other non-trivial selection is a promising direction for accelerating convergence on harder specs and properties requiring very long output generation lengths. Finally, BEAVER scales efficiently to large LLMs, though computing sound bounds relies on white-box access to full token probability distributions.

<ref:2512.05439#pg7>.

Conclusion

In this work, we developed BEAVER, the first practical framework for computing deterministic probability bounds on LLM constraint satisfaction.<ref:2512.05439#pg9>. Our frontier-based algorithm leverages Gϕ structure of safety properties to aggressively prune the generation space. p. 8

Where the paper says it

8 Conclusion In this work, we developed BEAVER, the first practical framework for computing deterministic probability bounds on LLM constraint satisfaction. Our frontier-based algorithm leverages Gϕ structure of safety properties to aggressively prune the generation space.

<ref:2512.05439#pg8>. We introduced novel Token Trie and Frontier data structures that explore the generation space while maintaining sound bounds at every iteration. p. 8
Where the paper says it

Our frontier-based algorithm leverages Gϕ structure of safety properties to aggressively prune the generation space. We introduced novel Token Trie and Frontier data structures that explore the generation space while maintaining sound bounds at every iteration.

<ref:2512.05439#pg8>. Through our experiments over multiple state-of-the-art LLMs, we demonstrate that BEAVER identifies more risky instances than ad-hoc evaluation with a fraction of the budget. p. 8
Where the paper says it

We introduced novel Token Trie and Frontier data structures that explore the generation space while maintaining sound bounds at every iteration. Through our experiments over multiple state-of-the-art LLMs, we demonstrate that BEAVER identifies more risky instances than ad-hoc evaluation with a fraction of the budget, establishing that deterministic verification of LLM behavior is both feasible and practical for realworld deployment.

<ref:2512.05439#pg1>. We establish that deterministic verification of LLM behavior is both feasible and practical for real-world deployment. p. 8
Where the paper says it

We introduced novel Token Trie and Frontier data structures that explore the generation space while maintaining sound bounds at every iteration. Through our experiments over multiple state-of-the-art LLMs, we demonstrate that BEAVER identifies more risky instances than ad-hoc evaluation with a fraction of the budget, establishing that deterministic verification of LLM behavior is both feasible and practical for realworld deployment.

<ref:2512.05439#pg8>.

Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.

Improvements for AI systems

  1. Sound probability bounds for safety properties: BEAVER computes deterministic, sound probability bounds on LLM satisfaction of safety properties by exploring output space using a Token trie and Frontier data structures, providing anytime guarantees.

  2. Early risk detection: The framework allows for aggressive pruning because for common safety properties on LLM generation of the form G ϕ, violations can be detected early, which lets the system prune generation space as soon as violations are found.

  3. Efficient tail risk characterization: BEAVER identifies 2.5 − 3× more risky instances compared to baselines while taking 1/10 of the compute budget, surfacing tail risks that loose bounds and ad-hoc evaluation misses.

  4. Distributional safety certification: The per-prompt guarantees can be composed with standard statistical techniques to yield conclusions at the distribution level, allowing for generalization guarantees that no existing evaluation can provide over large input distributions.

  5. Correctness verification capability: BEAVER extends beyond safety properties to correctness verification by computing bounds on model ranking questions, such as determining which model is most likely to produce a correct output, and with what probability.

Abstract

As large language models (LLMs) transition from research prototypes to production systems, practitioners need reliable ways to verify model outputs before they are deployed. While sampling-based estimates provide an ad-hoc intuition of model behavior, they offer no sound guarantees. We present BEAVER, the first practical framework for computing deterministic, sound bounds on the probability that an LLM's response to a prompt satisfies a property. Given a prompt and an oracle, BEAVER systematically explores the model's output distribution using a *token trie* and a *frontier*, maintaining provably sound bounds at every iteration. We formalize the LLM verification problem, prove that BEAVER's bounds are sound and that its selection strategy Max- μ is optimal for verification upto any tolerance. On 3 important safety tasks across 5 popular LLMs, BEAVER certifies up to 7.6 times more prompts as risky than a sampling-based verifier while using fewer forward passes, and its per-prompt bounds extend to statistical certificates over distributions of prompts.

Sources

Related papers