AI Wiki中文/EN

RL evaluation: does the conclusion survive a new set of seeds?

强化学习实验评测

Identify training and evaluation units, recompute normalization, IQM, profiles and stratified bootstrap, and retain ranking reversals and intervals crossing zero.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

What evidence would justify replacing the current policy?

A new algorithm has a higher mean score, mostly from one task where scores can become very large. Another is steadier on ordinary tasks. Would the ranking survive four new training seeds? RL evaluation concerns performance and uncertainty under an explicit protocol, not the most attractive training curve.

A real project should fix its comparison set first: random policy, simple rule-based controller, current version and candidate algorithm, under the same environment version, observation/action interface and comparable budgets. Record environment steps, gradient updates, wall-clock time, hardware and tuning costs, and specify checkpoint selection. Different resource measures answer different questions; higher scores do not automatically imply lower cost.

This article supplies original synthetic evaluation data, without training any real RL algorithm. A is relatively uniform across six tasks; B scores particularly highly on the last task. Each algorithm has four independent synthetic training outcomes per task, each followed by ten evaluation episodes. We compute normalization, robust metrics, profiles and bootstrap intervals to expose how averages change conclusions. Evaluation with few runs

Mean and IQM rank the same synthetic scores differently. All eight interval estimates are retained; episodes do not replace independent training runs.
Mean and IQM rank the same synthetic scores differently. All eight interval estimates are retained; episodes do not replace independent training runs.

Identify the random unit before selecting a metric

Training seeds change the learned policy. Evaluation episodes for one fixed policy reflect environment and execution randomness. Let m index tasks, n training runs and e evaluation episodes. First average episode returns for each training outcome:

xm,n=1E∑e=1ERm,n,e,m=1,…,M,n=1,…,N.x_{m,n}=\frac1E\sum_{e=1}^{E}R_{m,n,e}, \qquad m=1,\ldots,M,\quad n=1,\ldots,N.

Ten episodes share the same trained policy; they are not ten independent training seeds. More episodes reduce measurement noise for that policy but do not replace retraining. A shared multitask model can also create cross-task correlations. Our example explicitly assumes independently trained outcomes for each task, so its resampling scheme is not automatically suitable for that design.

When reward scales differ across tasks, define meaningful references first. For higher-is-better scores, our example uses a random baseline and a reference score:

zm,n=xm,n−bmhm−bm,hm>bm.z_{m,n}=\frac{x_{m,n}-b_m}{h_m-b_m},\qquad h_m>b_m.

A zero denominator is undefined, and a reversed reference changes direction; the program rejects both. It does not silently clip scores above one or below zero. Negative scores can indicate performance below baseline, and values above one exceed the reference. Uncertainty in estimated reference scores would also need analysis; we treat them as known constants here.

For a fixed task set with equal run counts, common aggregates include the overall mean, the median of task means and the interquartile mean, IQM, pooling runs and tasks. Sort K=MN scores and let q be the floor of K/4:

zˉ=1MN∑m,nzm,n,MedTask⁡=median⁡m(1N∑nzm,n),IQM⁡=1K−2q∑j=q+1K−qz(j),q=⌊K/4⌋.\bar z=\frac1{MN}\sum_{m,n}z_{m,n},\quad \operatorname{MedTask}=\operatorname{median}_m\left(\frac1N\sum_nz_{m,n}\right),\quad \operatorname{IQM}=\frac1{K-2q}\sum_{j=q+1}^{K-q}z_{(j)},\quad q=\lfloor K/4\rfloor.

MedTask is not the median of all scores. IQM averages after removing approximately the bottom and top quarters, reducing outlier influence; it is not universally the best business metric. A rare critical task still needs individual inspection. Unequal run counts also require checking task weights rather than pooling every log entry indiscriminately. Metric definitions and implementation

Two other questions are how far performance falls short of a target and how often A beats B on the same task. Below the gap uses target τ and improvement probability assigns half credit to ties:

Gτ=1MN∑m,nmax⁡(τ−zm,n,0),PA>B=1M∑m1NANB∑i,j[1{zm,iA>zm,jB}+121{zm,iA=zm,jB}].G_\tau=\frac1{MN}\sum_{m,n}\max(\tau-z_{m,n},0),\qquad P_{A>B}=\frac1M\sum_m\frac1{N_A N_B}\sum_{i,j} \left[\mathbf1\{z^A_{m,i}>z^B_{m,j}\}+\tfrac12\mathbf1\{z^A_{m,i}=z^B_{m,j}\}\right].

The gap prevents performance far above target from canceling shortfalls elsewhere; the target needs a reason. Improvement probability ignores the magnitude of gains: frequent small wins can coexist with occasional large losses. The fixed library’s docstring abbreviates the quantity as P(A>B), while its Mann–Whitney implementation includes half-tie credit. We state the implemented definition explicitly. Metric implementation

A performance profile shows the fraction of runs exceeding each threshold rather than reducing everything to one aggregate:

F^(τ)=1M∑m=1M1N∑n=1N1{zm,n>τ}.\widehat F(\tau)=\frac1M\sum_{m=1}^{M}\frac1N\sum_{n=1}^{N}\mathbf1\{z_{m,n}>\tau\}.

The inequality is strict. One extreme run changes the value at any threshold by at most 1/(MN), unlike its unbounded influence on a mean. Crossing curves imply that preferences can depend on the threshold. The paper’s main equation on page seven averages tasks with 1/M; nearby prose has a 1/N typographical discrepancy. We use the task-average definition. Performance profiles

Fixed-task stratified bootstrap resamples training outcomes independently within each task. Recompute statistic T for each resample and take percentiles:

zm,n∗(b)=zm,Im,n(b),Im,n(b)∼Uniform⁡{1,…,N},CI0.95=[Q0.025(T∗),Q0.975(T∗)].z^{*(b)}_{m,n}=z_{m,I^{(b)}_{m,n}},\quad I^{(b)}_{m,n}\sim\operatorname{Uniform}\{1,\ldots,N\},\qquad \mathrm{CI}_{0.95}=[Q_{0.025}(T^*),Q_{0.975}(T^*)].

For two independent algorithms, we resample each and calculate the IQM difference, rather than replacing difference analysis with overlap of two separate intervals. A genuinely paired design should preserve the relevant association; using the same integer seed does not automatically establish valid pairing. Resampling tasks as well changes the estimand, from run uncertainty on fixed tasks toward sensitivity to the task collection. Stratification and estimands

A nominal 95% interval does not mean this realized interval has a 95% probability of containing a random true parameter. The frequentist interpretation concerns coverage over repeated experiments. Four training outcomes may poorly approximate the population, and bootstrap can miss unseen failure modes. More resamples reduce computational approximation noise, not uncertainty arising from too few independent runs. Small-sample coverage limits

Finally, choosing the highest-scoring checkpoint or best seed introduces selection bias. Even if each fixed candidate is estimated without bias, their maximum satisfies:

E[max⁡jJ^j]≥max⁡jE[J^j].\mathbb E[\max_j\widehat J_j]\ge\max_j\mathbb E[\widehat J_j].

This follows from convexity of the maximum and does not require independent candidates. Prespecify selection and separate selection data from final evaluation. Final training performance and the highest test score observed throughout training are not directly comparable ranking protocols.

See a ranking reversal in the same data

The code uses only the Python standard library. For each task and training run, it draws a latent performance, then ten evaluation episodes, retaining both raw and normalized scores. Training standard deviations are 0.15 for A and 0.25 for B; episode noise has standard deviation 0.1. B’s final-task population mean of five is a deliberate high-score component, not a real algorithm result.

Each seed uses one thousand fixed-task stratified bootstrap replications and retains all statistic draws. As a counterexample, another interval incorrectly treats A’s forty episodes per task as independent units: its mean point estimate stays the same while the interval narrows. This comparison uses the mean only, avoiding a simultaneous hidden change of estimand.

"""Original synthetic benchmark audit. No real RL algorithm is trained here."""
import json
import math
import random
import statistics

RANDOM_SCORES = [-5., 0., 10., 20., 100., 1000.]
REFERENCE_SCORES = [5., 20., 30., 60., 200., 1100.]
MEANS = {'A': [.9, 1., 1.1, .8, .95, 1.05], 'B': [.6, .8, .85, .65, .9, 5.]}


def validate(rows):
    if not rows or not rows[0] or any(len(row) != len(rows[0]) for row in rows):
        raise ValueError('A nonempty rectangular run-by-task matrix is required')
    if any(not math.isfinite(x) for row in rows for x in row):
        raise ValueError('Scores must be finite; do not silently drop failed runs')


def normalize(raw, low=RANDOM_SCORES, high=REFERENCE_SCORES):
    validate(raw)
    if len(low) != len(high) or len(low) != len(raw[0]) or any(not math.isfinite(a+b) or b<=a for a,b in zip(low,high)):
        raise ValueError('Each higher-is-better reference must exceed its baseline')
    return [[(x-a)/(b-a) for x,a,b in zip(row,low,high)] for row in raw]


def flatten(rows):
    validate(rows)
    return [x for row in rows for x in row]


def mean(rows):return statistics.mean(flatten(rows))


def iqm(rows):
    scores=sorted(flatten(rows));trim=len(scores)//4
    return statistics.mean(scores[trim:len(scores)-trim])


def metrics(rows):
    scores=flatten(rows);tasks=len(rows[0]);runs=len(rows)
    return dict(mean=statistics.mean(scores),iqm=iqm(rows),
                median_task_means=statistics.median([sum(row[t] for row in rows)/runs for t in range(tasks)]),
                gap=sum(max(1-x,0) for x in scores)/len(scores))


def improvement(a,b):
    validate(a);validate(b)
    if len(a[0])!=len(b[0]):raise ValueError('Task identities must align')
    return sum((x[t]>y[t])+.5*(x[t]==y[t]) for t in range(len(a[0])) for x in a for y in b)/(len(a)*len(b)*len(a[0]))


def profile(rows,thresholds):
    scores=flatten(rows)
    return [sum(x>t for x in scores)/len(scores) for t in thresholds]


def resample(rows,rng):
    validate(rows);n,m=len(rows),len(rows[0])
    # Fixed tasks, independently trained runs within each task; not whole-row pairing.
    return [[rows[rng.randrange(n)][t] for t in range(m)] for _ in range(n)]


def quantile(values,q):
    if not values or not 0<=q<=1:raise ValueError('Nonempty values and quantile in [0,1] required')
    values=sorted(values);index=(len(values)-1)*q;i=int(index);fraction=index-i
    return values[i]*(1-fraction)+values[min(i+1,len(values)-1)]*fraction


def interval(values):return [quantile(values,.025),quantile(values,.975)]


def synthetic(seed):
    """Four synthetic training outcomes per task, ten evaluation episodes each."""
    raw,episodes={},{}
    for index,(name,centers) in enumerate(MEANS.items()):
        rng=random.Random(seed*1000+100+index);raw[name]=[];episodes[name]=[]
        for _ in range(4):
            row,episode_row=[],[]
            for task,center in enumerate(centers):
                latent=rng.gauss(center,.15 if name=='A' else .25)
                values=[rng.gauss(latent,.1) for _ in range(10)]
                episode_row.append(values)
                score=statistics.mean(values)
                row.append(RANDOM_SCORES[task]+score*(REFERENCE_SCORES[task]-RANDOM_SCORES[task]))
            raw[name].append(row);episodes[name].append(episode_row)
    return raw,episodes


def experiment(seed=0,repetitions=1000):
    if not isinstance(repetitions,int) or repetitions<2:raise ValueError('At least two bootstrap replications required')
    raw,episodes=synthetic(seed);a,b=[normalize(raw[name]) for name in ('A','B')]
    # Incorrect independence model: 40 episodes/task instead of four training units.
    naive=[[episodes['A'][i//10][t][i%10] for t in range(6)] for i in range(40)]
    rng=random.Random(seed+9000);naive_rng=random.Random(seed+12000)
    draws={'iqm_difference':[],'a_mean':[],'naive_a_mean':[]}
    for _ in range(repetitions):
        aa=resample(a,rng);bb=resample(b,rng)
        draws['iqm_difference'].append(iqm(aa)-iqm(bb));draws['a_mean'].append(mean(aa))
        draws['naive_a_mean'].append(mean(resample(naive,naive_rng)))
    intervals={key:interval(values) for key,values in draws.items()}
    thresholds=[0.,.5,1.,2.,4.]
    return dict(seed=seed,synthetic=True,training_runs_per_task=4,tasks=6,episodes_per_run=10,
                episode_returns=episodes,raw_scores=raw,normalized={'A':a,'B':b},
                metrics={'A':metrics(a),'B':metrics(b)},improvement_a_over_b=improvement(a,b),
                thresholds=thresholds,profiles={'A':profile(a,thresholds),'B':profile(b,thresholds)},
                iqm_difference=iqm(a)-iqm(b),intervals=intervals,
                theoretical_a_mean=statistics.mean(MEANS['A']),
                bootstrap_repetitions=repetitions,bootstrap_draws=draws,
                mean_point_matches_naive=abs(mean(a)-mean(naive))<1e-12,
                optimality_gap_threshold=1.)


if __name__=='__main__':
    result=experiment()
    print(json.dumps({k:v for k,v in result.items() if k not in ('episode_returns','bootstrap_draws','raw_scores')},indent=2))
Inspect the recorded summary
{
  "seed": 0,
  "synthetic": true,
  "training_runs_per_task": 4,
  "tasks": 6,
  "episodes_per_run": 10,
  "normalized": {
    "A": [
      [
        1.0134730297178278,
        1.1020973657205828,
        1.1902085651150613,
        0.5942474635576808,
        0.7258667075740928,
        1.0160196795310845
      ],
      [
        0.83236697427805,
        1.0847222501740528,
        1.1106772272902679,
        1.069636226243818,
        0.7720388058635029,
        1.198310593328631
      ],
      [
        0.820476301847729,
        0.8270628840461521,
        1.3331255012088872,
        1.0391507049002544,
        0.8325445385301561,
        1.1708435188027193
      ],
      [
        0.8828042898094595,
        1.2568033597269626,
        1.0487629267358727,
        0.7999548078093663,
        0.7817072878573407,
        1.191868088472579
      ]
    ],
    "B": [
      [
        0.4849293913340914,
        1.4846382080778326,
        0.6553913599355312,
        0.8953555534759614,
        0.9090340049331865,
        5.474448382023325
      ],
      [
        0.458119441228375,
        0.7247123946215168,
        1.4280546756966934,
        0.5797946304340492,
        0.659038881474022,
        5.125051092069671
      ],
      [
        0.4843285898071478,
        0.515192477322438,
        0.6561680686186999,
        0.013845964128635835,
        1.0197934190053146,
        5.224891967960753
      ],
      [
        0.4771311390927918,
        0.9252487262231114,
        1.2383545524124464,
        0.9355067525004523,
        1.0548656172383932,
        4.914584158137709
      ]
    ]
  },
  "metrics": {
    "A": {
      "mean": 0.9872820457559222,
      "iqm": 0.9882765080814648,
      "median_task_means": 0.9774758069151022,
      "gap": 0.08878874745110292
    },
    "B": {
      "mean": 1.5141033103230062,
      "iqm": 0.8544386634060571,
      "median_task_means": 0.911565466111977,
      "gap": 0.2344251093695829
    }
  },
  "improvement_a_over_b": 0.5416666666666666,
  "thresholds": [
    0.0,
    0.5,
    1.0,
    2.0,
    4.0
  ],
  "profiles": {
    "A": [
      1.0,
      1.0,
      0.5833333333333334,
      0.0,
      0.0
    ],
    "B": [
      1.0,
      0.7916666666666666,
      0.375,
      0.16666666666666666,
      0.16666666666666666
    ]
  },
  "iqm_difference": 0.1338378446754077,
  "intervals": {
    "iqm_difference": [
      -0.04031063164559965,
      0.294050974248971
    ],
    "a_mean": [
      0.938383766205737,
      1.0316464380738386
    ],
    "naive_a_mean": [
      0.9675586144677587,
      1.0069734980375082
    ]
  },
  "theoretical_a_mean": 0.9666666666666667,
  "bootstrap_repetitions": 1000,
  "mean_point_matches_naive": true,
  "optimality_gap_threshold": 1.0
}

At seed zero, means are A=0.98728 and B=1.51410, while IQMs are A=0.98828 and B=0.85444. A’s half-tie improvement probability over B is about 0.541667; this does not establish that A is unambiguously better overall. The IQM-difference interval crosses zero.

SeedIQM difference A−BNominal 95% lower boundNominal 95% upper bound
00.13384−0.040310.29405
10.203040.099140.30227
20.11682−0.015720.21615
30.07481−0.048270.20748
40.252860.120650.38836
50.208450.086170.34298
60.06764−0.041390.17609
70.185900.042210.33372

At seed zero, the appropriate-unit A-mean interval is approximately [0.93838,1.03165], versus [0.96756,1.00697] under false episode independence. The narrower interval is not stronger evidence; its independence model is wrong. The synthetic A population mean is known to be 0.966667. Even the training-unit intervals miss it for seeds two, three and six. Eight experiments do not estimate actual coverage reliably, but they demonstrate why a nominal small-sample interval is not a guarantee.

Each algorithm has twenty-four synthetic training units and 240 evaluation episodes; together there are forty-eight units and 480 episodes, with no actual RL training. One IQM sort costs O(K log K), giving approximately O(BK log K) for B bootstrap replications. The program additionally resamples for the false-independence example and retains all draws, using O(B) statistic storage. Larger datasets can use streaming summaries while preserving inputs, protocol and seeds.

An interval cannot choose the business objective

If one task is the business priority, uniformly averaging six tasks may answer the wrong question. If outcomes share training across tasks, independent column resampling destroys correlation. Specify task weights, budgets and the estimand before discussing interval algorithms.

Nearly equal normalization references amplify noise. Environment versions, termination rules and time limits also affect returns. Define failed-run handling in advance rather than silently discarding NaNs or training crashes and treating survivors as the algorithm’s full behavior. Our example rejects nonfinite scores; real reporting should also describe failure frequency and causes.

Profiles can have per-threshold intervals, but pointwise 95% bands are not simultaneous 95% coverage of the entire curve. This program computes profile points at the listed thresholds without full confidence bands. Statistical uncertainty, distribution changes, tuning selection and implementation errors are distinct issues.

These tasks are synthetic and cannot evaluate actual algorithms or announce leaderboard changes. The fixed rliable version’s random-state interface differs from its internal global random calls. We use independent Random instances for this program’s declared seed scope, without claiming to have executed upstream code.

Which experiment are you repeating?

  1. What happens if four training seeds with ten evaluation episodes each are treated as forty independent training runs?

    Answer: Correlation from sharing a trained policy is underestimated, potentially producing overly narrow intervals. There are still four independent training outcomes. More episodes measure those four policies more precisely, rather than creating another thirty-six policies.

  2. Across six tasks, A always scores one, while B scores 0.7 on the first five and five on the last. Which has the higher mean and IQM? Assume four repetitions per task.

    Answer: B’s mean is (5×0.7+5)/6≈1.416667, exceeding A’s one. Removing six scores from each end of the twenty-four pooled scores leaves B with only 0.7s, so its IQM is 0.7 versus A’s one. The ranking differs because the metrics treat an exceptional task differently.

  3. All scores of two algorithms are identical. What is their half-tie improvement probability, and does it represent a half-sized performance gain?

    Answer: It is 0.5, reflecting symmetric credit for ties, not a gain magnitude. Improvement probability does not measure how large a score difference is.

  4. Can increasing bootstrap replications from one thousand to one hundred thousand make four original seeds as informative as one hundred thousand training runs?

    Answer: No. It more precisely approximates resampling from the same four outcomes. Unseen failures or behavioral modes may remain absent. More independent training, or stronger defensible modeling assumptions, is still needed.

Attach the conclusion to its protocol

The statistical-precipice paper shows how few runs, aggregates and selection protocols affect inference. Its particular Atari rankings and run requirements depend on those tasks and protocols, not a universal threshold. Paper scope rliable provides metric and stratified-resampling references; inspect matrix axes, task weighting, ties, random streams and interval interpretation when reading it. Fixed implementation

A useful report includes every task and seed, environment and budget, checkpoint selection, normalization references, aggregates and uncertainty methods. Letting readers recompute results and change reasonable assumptions is more useful than a highest score without context.

Make a prediction, then check

Four training seeds each have ten evaluation episodes. How many independent training units are there?

Choose one answer

Learning objectives

  • Design comparisons with matched budgets/protocols and distinguish training seeds, tasks and evaluation episodes.
  • Compute robust metrics and fixed-task stratified intervals, explaining selection bias, estimands and small-sample limits.

Prerequisites & connections

Explore related knowledge →

References

  1. Deep Reinforcement Learning at the Edge of the Statistical Precipice — scoped NeurIPS paper
    Rishabh Agarwal; Max Schwarzer; Pablo Samuel Castro; Aaron Courville; Marc G. Bellemare · 2021
  2. rliable — fixed metrics and stratified bootstrap implementation reading
    Rishabh Agarwal; rliable contributors · 2024

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Codex · 2026-09-24 · Single AI author. Scoped reading: Read5–8 and1450 identity characters of the17-page conference PDF; viewed7. Protocols, stratified bootstrap, small-sample coverage, profiles, IQM and gap. Visually checked prose1/N versus Equation1’s1/M; task averaging follows1/M. No full appendix or benchmark reproduction; pointwise bands are not simultaneous coverage. Fixed2024-08-12 commit. Read all95 metric lines, library70–122/171–206/211–300, README14–42; only first14 license lines for Apache identity. Floor trimming, half-tie improvement, strict profiles and independent within-task resampling; global np.random behavior is not certified by a parameter description. No copying/execution. Seven paired equations and four explained exercises. Synthetic six-task data, four training units and ten episodes per unit clearly separated. Floor-trim IQM, task-mean median, half-ties and strict profiles checked independently. All8 seed intervals retained; fixed-task independent-column bootstrap does not establish population or small-sample coverage. No upstream execution or actual RL training.

  • Synthetic six-task data, four training units and ten episodes per unit clearly separated. Floor-trim IQM, task-mean median, half-ties and strict profiles checked independently. All8 seed intervals retained; fixed-task independent-column bootstrap does not establish population or small-sample coverage. No upstream execution or actual RL training.
  • Four computed SVG variants per topic;10 numeric/geometry tests and18 current responsive cases passed. All nine selected current captures directly viewed; no figure failure or post-capture asset edit in this group. Actual assets and manuscripts are SHA bound. Full article acceptance recorded separately.

Source locations checked:

  • Deep Reinforcement Learning at the Edge of the Statistical Precipice — scoped NeurIPS paper · Read5–8 and1450 identity characters of the17-page conference PDF; viewed7. Protocols, stratified bootstrap, small-sample coverage, profiles, IQM and gap. Visually checked prose1/N versus Equation1’s1/M; task averaging follows1/M. No full appendix or benchmark reproduction; pointwise bands are not simultaneous coverage.
  • rliable — fixed metrics and stratified bootstrap implementation reading · Fixed2024-08-12 commit. Read all95 metric lines, library70–122/171–206/211–300, README14–42; only first14 license lines for Apache identity. Floor trimming, half-tie improvement, strict profiles and independent within-task resampling; global np.random behavior is not certified by a parameter description. No copying/execution.

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.