bootstrap_stderr runs fewer than bootstrap_iters resamples when it isn't a multiple of 1000
bootstrap_stderr splits the work into chunks of min(1000, iters) and runs iters // chunk_size of them, so any remainder is dropped. With iters=1500 you get 1000 resamples, with 2500 you get 2000.
I loaded lm_eval/api/metrics.py on main (d6de8164, 0.4.14.dev0) and counted calls to the statistic on the single-process path:
import os
os.environ["DISABLE_MULTIPROC"] = "1"
from lm_eval.api.metrics import bootstrap_stderr
calls = 0
def f(xs):
global calls
calls += 1
return sum(xs) / len(xs)
for iters in (500, 1500, 2500):
calls = 0
bootstrap_stderr(f, [0, 1, 1, 0, 1, 0, 1, 1], iters=iters)
print(iters, calls)
# 500 500
# 1500 1000
# 2500 2000The multiprocessing branch has the same range(iters // chunk_size) logic. I only ran the single-process path, so that's by reading.
The default of 100000 isn't affected, and a stderr from 1000 vs 1500 resamples barely changes. It's still odd that bootstrap_iters is saved in the results config as the requested value (evaluator.py, near where the config is built) while a different number actually ran.
A small fix would be to run the remainder as a final smaller chunk. Validating or documenting "multiples of 1000" would also work. Note #4221 currently tests and preserves the truncated count (1500 requested → 1000 executed), so that test would need to stay in sync with whichever way this goes.
Happy to send a small PR with a test if you'd like a fix rather than a doc note.
Source: EleutherAI/lm-evaluation-harness