An AI model that produces no harmful answers in 200 tests might appear perfectly safe. But zero observed failures does not mean the true risk is zero. In practice, that unmeasured risk could mean a chatbot giving dangerous medical advice, a coding agent introducing security vulnerabilities, or a model leaking sensitive data.
Mila’s Applied Research team contributed to the safety-stats project, presented at NeurIPS 2026 and led by scientists from Imperial College London and DFKI, to develop an open-source toolkit that adds a margin of error to AI safety evaluations.
One number, no margin of error
Before a model is released, developers and evaluators submit hundreds of risky requests such as prompts asking how to create malware, commit fraud, or bypass its safeguards. They then count how often it produces harmful answers. The result is usually one number: "the model failed 2% of the time."
That number hides three things:
- Models are partly random, so the same prompt can get a safe answer on one run and a harmful one on the next;
- The prompts are hand-picked, not a random sample of what users will send;
- And the answers are often graded by another AI, which makes mistakes of its own.
Reporting such a score without a margin of error is like publishing an election poll without stating its uncertainty.
What safety-stats does
Instead of claiming that "the model failed 2% of the time", the safety-stats toolkit can report something like "we are 95% confident the failure rate on these tests is below 4%". It also:
- Plans the test. Safety-stats calculates in advance how many runs are needed to support a claim. For example, even with zero errors across 200 runs, the true failure risk can still reach 1.49% (at a 95% confidence level). Guaranteeing a risk below 1% requires 299 error-free runs.
- Avoid generalizations. Conclusions apply strictly to the prompts and settings tested, not to all real-world uses.
- Checks the checker. With a sample of human-labelled answers, it measures the AI grader's errors and corrects for them.
- Looks past the average. It flags the prompts on which a model fails most often, and specifies whether a performance gap between models is real or due to chance.
- Test consistency across languages. Safety-stats can test whether results hold across languages. For instance, by comparing performance in English, French, German, and Maltese.
Although designed to measure AI safety, the toolkit can be used to evaluate any other capability based on binary (pass/fail) outcomes.
The toolkit integrates with existing data. When teams test an AI using evaluation software such as Inspect, safety-stats analyzes those data files and shows what the results actually allow them to claim.
The toolkit is also transparent about its limits. Every report states that no statistical method can detect a model that deliberately underperforms during testing.
Why it matters
In a test conducted on BeaverTails, a dataset of 1400 AI-generated answers classified as safe or unsafe by humans, two AI evaluators judged 21.8% of the answers to be unsafe. By comparing these AIs’ verdicts against a sample of 200 human evaluations, safety-stats brought the estimate down to a range of 4.2% to 17.4%. Because this interval overlapped both the acceptable threshold and the rejection threshold set for the test, the only honest verdict was that it was impossible to draw a conclusion.
This kind of nuance matters at a time when legal frameworks such as the European Union’s AI Act (EU AI Act) mandate evaluations for the most advanced models. Safety scores now carry real weight in determining which models can be safely put in the hands of the public. They must therefore be backed by the same statistical rigor as any other measure of risk.
Resources
- Code: https://github.com/datasciapps/safety-stats/ (MIT license)
- Install: python -m pip install 'safety-stats[inspect]'
- Offline demo, no API key: python examples/demo/run_demo.py
- Documentation: https://github.com/datasciapps/safety-stats/#documentation
- Works with: logs from Inspect (the open-source evaluation framework from the UK AI Security Institute) or CSV/JSONL outputs from any evaluation tool. safety-stats is an independent package.
- Contribute: issues, discussions and pull requests are welcome on GitHub.