Skip to content

Is 16/20 an 80% Robot Policy? Computing Success-Rate Confidence Intervals and Comparing Two Policies

A pick-and-place policy succeeded 16 of 20 times. Compute Wilson and Clopper-Pearson intervals by hand, see width vs trial count, and compare two policies in Python.

Contents

Key takeaways

  1. 16 successes in 20 trials gives a 95% Wilson interval of about 58.4–91.9% and a Clopper-Pearson interval of about 56.3–94.3%: a band 33–38 points wide.
  2. Near an 80% success rate, the Wilson interval shrinks to roughly ±11 points at 50 trials and roughly ±8 points at 100 trials.
  3. 16/20 vs 12/20 is a 20-point gap, yet Fisher’s exact test gives p ≈ 0.30 and Barnard’s test p ≈ 0.22, so the data cannot separate the two policies.
  4. Fix the initial-condition list, trial count and success criterion before running anything, and interleave both policies in the same session.
  5. In Python, statsmodels proportion_confint (method=‘wilson’ or ‘beta’) and SciPy binomtest(...).proportion_ci() return the same numbers.

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:

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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 p p , the number of successes k k is binomial. The sample rate is p^=k/n=16/20=0.8 \hat{p} = k/n = 16/20 = 0.8 .

The normal-approximation (Wald) interval is what most textbooks show first, and it misbehaves at small n n :

p^±zp^(1−p^)n=0.8±1.960.8×0.220=0.8±0.175 \hat{p} \pm z\sqrt{\frac{\hat{p}(1-\hat{p})}{n}} = 0.8 \pm 1.96\sqrt{\frac{0.8 \times 0.2}{20}} = 0.8 \pm 0.175

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 z=1.96 z = 1.96 and z2=3.8416 z^2 = 3.8416 :

p^+z22n1+z2n±z1+z2np^(1−p^)n+z24n2 \frac{\hat{p} + \frac{z^2}{2n}}{1 + \frac{z^2}{n}} \pm \frac{z}{1 + \frac{z^2}{n}} \sqrt{\frac{\hat{p}(1-\hat{p})}{n} + \frac{z^2}{4n^2}}

For 16/20 the denominator is 1+3.8416/20=1.1921 1 + 3.8416/20 = 1.1921 , the center is (0.8+0.0960)/1.1921=0.7517 (0.8 + 0.0960)/1.1921 = 0.7517 , and the half-width is (1.96/1.1921)0.008+0.0024=1.6442×0.1020=0.1677 (1.96/1.1921)\sqrt{0.008 + 0.0024} = 1.6442 \times 0.1020 = 0.1677 . 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:

pL=B(α2; k, n−k+1),pU=B(1−α2; k+1, n−k) p_L = B\left(\tfrac{\alpha}{2};\ k,\ n-k+1\right), \quad p_U = B\left(1-\tfrac{\alpha}{2};\ k+1,\ n-k\right)

For 16/20, B(0.025;16,5)≈0.563 B(0.025; 16, 5) \approx 0.563 and B(0.975;17,4)≈0.943 B(0.975; 17, 4) \approx 0.943 , so the interval is 56.3–94.3%. The statsmodels documentation notes that this method (method='beta') guarantees coverage of at least 1−α 1-\alpha 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 0.0251/20≈0.832 0.025^{1/20} \approx 0.832 , and the one-sided 95% lower bound is 0.051/20≈0.861 0.05^{1/20} \approx 0.861 . Twenty straight successes only let you claim “the true rate is at least about 86%.”

Result k/nSample rateWald 95%Wilson 95%Clopper-Pearson 95%
10/2050%28.1–71.9%29.9–70.1%27.2–72.8%
12/2060%38.5–81.5%38.7–78.1%36.1–80.9%
16/2080%62.5–97.5%58.4–91.9%56.3–94.3%
17/2085%69.4–100%64.0–94.8%62.1–96.8%
20/20100%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 k=0.8n k = 0.8n :

Trials nSuccesses kWilson 95%Wilson widthClopper-Pearson 95%CP width
10849.0–94.3%45.3 pts44.4–97.5%53.1 pts
201658.4–91.9%33.5 pts56.3–94.3%37.9 pts
302462.7–90.5%27.8 pts61.4–92.3%30.9 pts
504067.0–88.8%21.8 pts66.3–90.0%23.7 pts
1008071.1–86.7%15.5 pts70.8–87.3%16.5 pts
20016073.9–85.0%11.0 pts73.8–85.3%11.5 pts

Width falls roughly as 1/n 1/\sqrt{n} : halving it takes four times the trials. To back out a trial budget, the normal approximation gives n≈z2p(1−p)/E2 n \approx z^2 p(1-p)/E^2 for a target half-width E E . With p=0.8 p = 0.8 and E=0.1 E = 0.1 that is 3.8416×0.16/0.01≈62 3.8416 \times 0.16 / 0.01 \approx 62 trials; if you have no idea what the rate will be (p=0.5 p = 0.5 ) 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.”

ComparisonGapFisher pBarnard pReading
16/20 vs 12/2020 pts0.3010.221Cannot tell apart
16/20 vs 10/2030 pts0.0960.050Borderline; run more trials
80/100 vs 60/10020 pts0.0030.002Difference 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:

  1. The task and the success criterion, including time limit and tolerance.
  2. The initial-condition list, which conditions are in or out of distribution, and trials per condition.
  3. k/n for each policy with its 95% interval and the method used (Wilson or Clopper-Pearson).
  4. For comparisons, the test, its p-value, and whether a multiple-comparison correction was applied.
  5. 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.

Common mistakes

  • Calling statsmodels proportion_confint without a method, which defaults to the normal (Wald) approximation and reports an upper bound of 97.5% for 16/20 and a zero-width interval for 20/20
  • Reporting ‘80%’ without the denominator or the range of initial conditions
  • Running policy A in the morning and policy B in the afternoon, so lighting and object placement differences get attributed to the policy
  • Reclassifying borderline trials as successes after seeing the results, or dropping failed trials as ‘setup issues’

Pre-flight checklist

  • Is there a written list of initial conditions (object pose, position, lighting) with a fixed number of trials per condition?
  • Is the success criterion written down, including the time limit and tolerance?
  • Are both policies run in the same session, interleaved, ideally with an evaluator who does not know which policy is running?
  • Does the report give k/n, the 95% interval, and which interval method was used?
  • Are failures logged by type (grasp, place, collision, timeout)?

Frequently asked questions

Can I report a 90% interval instead?
Yes. Pass alpha=0.10 to statsmodels or confidence_level=0.90 to SciPy and the interval narrows. State the confidence level in the report, and pick it before looking at the results rather than after.
How do I handle partial success, such as a grasp without a successful place?
The binomial intervals here only fit a binary outcome. Either report each stage (grasp rate, place rate) as its own binomial, or use a different method such as a bootstrap on the mean score.
How many episodes should I run in simulation?
Simulation is cheap enough to run far more trials. The TRI LBM paper used 50 rollouts per condition on hardware and 200 in simulation. As the width table shows, 200 trials near 80% bring the Wilson interval down to about 11 points wide.

Sources & verification

  1. Kress-Gazit et al., Robot Learning as an Empirical Science: Best Practices for Policy Evaluation (arXiv:2409.09491)
  2. TRI LBM Team, A Careful Examination of Large Behavior Models for Multitask Dexterous Manipulation (arXiv:2507.05331)
  3. statsmodels — statsmodels.stats.proportion.proportion_confint
  4. SciPy — BinomTestResult.proportion_ci
  5. SciPy — scipy.stats.fisher_exact
  6. SciPy — scipy.stats.barnard_exact
  7. LIBERO GitHub — Lifelong-Robot-Learning/LIBERO

Last verified: