Suppose a pick-and-place policy trained with LeRobot or Isaac Lab succeeds 16 times in 20 real-robot trials. Is it fair to call that an 80% policy? This tutorial walks through reporting a success rate as a confidence interval when the number of hardware trials is small, and deciding whether two policies actually differ, with the formulas worked out and Python code you can run. By the end you will be able to choose a trial count before evaluating and report a result as “16/20, 95% CI 58–92%”.
Three things to lock down first: initial conditions, success criterion, run order
The best-practices paper by Kress-Gazit et al. (2024) argues that robot learning papers lean heavily on success rate while saying little about how many runs were performed and doing little or no statistical analysis. The authors recommend matching initial conditions across policies (with image overlays or scene markings), interleaving rollouts in the same session, and having the person who designed the behavior write the success criterion while someone else scores the trials. One of their examples is a sobering reminder of how fragile the number is: after a lab reorganization, re-running policy A on the same initial conditions dropped its success rate from 65% to 0%.
Write the protocol down in this order:
- List the initial conditions. Object positions (for example a 10-cell grid on the table), object orientation, lighting, and whether distractors are present. Mark each condition as in-distribution or deliberately out-of-distribution relative to the training demonstrations.
- Fix the trials per condition. Twenty trials can be 10 conditions × 2 runs. The energy-bar example in the same paper used exactly that: 20 evaluations per policy across 10 initial conditions with two runs each.
- Write the success criterion as a sentence. For example: “Within 60 seconds, the cup is released standing upright inside a 10 cm circle on the plate.” Include the time limit and tolerance. Do not edit it after seeing results.
- Interleave the runs. Alternate or randomize policies A and B within one session so that drift in lighting, battery level or wear does not land on one side.
- Log failure types. Grasp failure, place failure, collision, timeout. In the paper’s example, six of policy A’s seven failures were grasps while all six of policy B’s were placements. Equal success rates can still point to very different fixes.
A benchmark is simply this work done in advance. The LIBERO repository ships four suites (LIBERO-Spatial, LIBERO-Object, LIBERO-Goal and LIBERO-100) with 130 tasks, and for benchmarking it fixes a set of initial states that you load with get_task_init_states(task_id) and apply with env.set_init_state(). For your own hardware evaluation you have to build that fixed list yourself.
Working out the interval for 16/20 by hand
If trials are independent and share a single success probability , the number of successes is binomial. The sample rate is .
The normal-approximation (Wald) interval is what most textbooks show first, and it misbehaves at small :
That gives 62.5–97.5%, which is exactly what statsmodels proportion_confint returns with its default method='normal'. At 20/20 the standard error is zero and you get the meaningless interval [100%, 100%].
The Wilson score interval uses the following expression, with and :
For 16/20 the denominator is , the center is , and the half-width is . The 95% Wilson interval is therefore 58.4–91.9%, matching SciPy’s proportion_ci(method='wilson'). Note that the center is pulled from 0.80 toward 0.75, which the Wald interval never does.
The Clopper-Pearson (“exact”) interval is defined by beta-distribution quantiles:
For 16/20, and , so the interval is 56.3–94.3%. The statsmodels documentation notes that this method (method='beta') guarantees coverage of at least but is generally conservative, which is why it comes out a little wider than Wilson.
The all-success case is worth computing from the same Clopper-Pearson definition. For 20/20 the Clopper-Pearson lower bound is , and the one-sided 95% lower bound is . Twenty straight successes only let you claim “the true rate is at least about 86%.”
| Result k/n | Sample rate | Wald 95% | Wilson 95% | Clopper-Pearson 95% |
|---|---|---|---|---|
| 10/20 | 50% | 28.1–71.9% | 29.9–70.1% | 27.2–72.8% |
| 12/20 | 60% | 38.5–81.5% | 38.7–78.1% | 36.1–80.9% |
| 16/20 | 80% | 62.5–97.5% | 58.4–91.9% | 56.3–94.3% |
| 17/20 | 85% | 69.4–100% | 64.0–94.8% | 62.1–96.8% |
| 20/20 | 100% | 100–100% | 83.9–100% | 83.2–100% |
These values come from the code below run on statsmodels 0.15.0 (the Wald upper bound is clipped at 100%).
Interval width vs trial count: how many runs are enough
Here is how the same 80% rate reads at different sample sizes, with :
| Trials n | Successes k | Wilson 95% | Wilson width | Clopper-Pearson 95% | CP width |
|---|---|---|---|---|---|
| 10 | 8 | 49.0–94.3% | 45.3 pts | 44.4–97.5% | 53.1 pts |
| 20 | 16 | 58.4–91.9% | 33.5 pts | 56.3–94.3% | 37.9 pts |
| 30 | 24 | 62.7–90.5% | 27.8 pts | 61.4–92.3% | 30.9 pts |
| 50 | 40 | 67.0–88.8% | 21.8 pts | 66.3–90.0% | 23.7 pts |
| 100 | 80 | 71.1–86.7% | 15.5 pts | 70.8–87.3% | 16.5 pts |
| 200 | 160 | 73.9–85.0% | 11.0 pts | 73.8–85.3% | 11.5 pts |
Width falls roughly as : halving it takes four times the trials. To back out a trial budget, the normal approximation gives for a target half-width . With and that is trials; if you have no idea what the rate will be () it is about 96. Treat these as planning estimates from an approximation and still report the final result with Wilson or Clopper-Pearson.
For comparison, the TRI LBM paper ran blind, randomized trials with 50 rollouts per condition on hardware and 200 in simulation. Its evaluation design is covered in more depth in our Large Behavior Models explainer.
Computing intervals and tests with statsmodels and SciPy
Both libraries return the same numbers. SciPy’s proportion_ci accepts method values 'exact' (Clopper-Pearson, the default), 'wilson' and 'wilsoncc' (with continuity correction). The statsmodels proportion_confint default is method='normal', so always pass the method explicitly.
# pip install scipy statsmodels (checked with SciPy 1.18.1, statsmodels 0.15.0)
from statsmodels.stats.proportion import proportion_confint
from scipy.stats import binomtest, fisher_exact, barnard_exact
k, n = 16, 20
# 1) statsmodels: alpha=0.05 -> 95% interval
wilson = proportion_confint(k, n, alpha=0.05, method="wilson")
cp = proportion_confint(k, n, alpha=0.05, method="beta") # Clopper-Pearson
print(f"Wilson {wilson[0]:.3f}-{wilson[1]:.3f}") # 0.584-0.919
print(f"Clopper-Pearson {cp[0]:.3f}-{cp[1]:.3f}") # 0.563-0.943
# 2) SciPy: proportion_ci on the binomtest result object
res = binomtest(k, n)
print(res.proportion_ci(confidence_level=0.95, method="exact"))
print(res.proportion_ci(confidence_level=0.95, method="wilson"))
# 3) Comparing two policies: rows = policies, columns = [success, failure]
table = [[16, 4], # policy A: 16/20
[12, 8]] # policy B: 12/20
print(fisher_exact(table, alternative="two-sided")) # pvalue ~ 0.301
print(barnard_exact(table, alternative="two-sided")) # pvalue ~ 0.221
If you log every rollout to a CSV with columns policy, init_id, success and failure_type, you can aggregate k and n per policy and feed them straight into these functions. For the data collection and training side, follow the LeRobot SO-101 ACT training guide and use this log format during the rollout step.
Pitfalls when comparing two policies
Policy A at 16/20 and policy B at 12/20 differ by 20 points on paper. Yet the Fisher exact test in the code above returns p ≈ 0.30 and the Barnard exact test p ≈ 0.22. Their Wilson intervals (58.4–91.9% and 38.7–78.1%) overlap heavily. This data does not support “A is better.”
| Comparison | Gap | Fisher p | Barnard p | Reading |
|---|---|---|---|---|
| 16/20 vs 12/20 | 20 pts | 0.301 | 0.221 | Cannot tell apart |
| 16/20 vs 10/20 | 30 pts | 0.096 | 0.050 | Borderline; run more trials |
| 80/100 vs 60/100 | 20 pts | 0.003 | 0.002 | Difference detected |
The same 20-point gap pushes the Fisher and Barnard p-values to 0.003 or below once each policy has 100 trials. Points to check when comparing:
- Choice of test. The SciPy documentation describes Barnard’s test as more powerful than Fisher’s for 2×2 tables and says Fisher’s test should only be used when both sets of marginals are fixed. In a robot evaluation you fix the trials per policy (row totals) but not the total successes, so Barnard matches the design more closely. Its p-value can shift slightly in later decimals depending on the sampling-point parameter
n(default 32). - Two-proportion z-test. With expected counts this small, the normal approximation can be off; prefer an exact test at the 20-trial scale.
- Multiple comparisons. Five policies compared pairwise is ten tests. At 0.05 each, one spurious “significant” result is quite likely, so tighten the threshold, for example with a Bonferroni correction (0.05/10 = 0.005). The TRI LBM paper applied Bonferroni correction when comparing several policies.
- Paired initial conditions. If both policies ran on the same initial-condition list, you can pair results by condition, and a paired method such as McNemar’s test may fit better than an independent-samples test.
- A Bayesian framing. Kress-Gazit et al. place a uniform prior on each success probability and compute the posterior probability that one policy beats the other; for 15/18 vs 11/17 they report roughly an 11% chance that B is actually better than A. That statement is often easier for a decision-maker to act on than a p-value.
Five lines to put in every evaluation report
Once a round of evaluation is done, recording these five items makes the result comparable with future policies:
- The task and the success criterion, including time limit and tolerance.
- The initial-condition list, which conditions are in or out of distribution, and trials per condition.
k/nfor each policy with its 95% interval and the method used (Wilson or Clopper-Pearson).- For comparisons, the test, its p-value, and whether a multiple-comparison correction was applied.
- Failure counts by type, with a representative video or image for each.
When you plan the next round, start from the width table: pick the trial count that gives the precision you need, divide it by the number of initial conditions, and build the run schedule from there.