Evaluation, diagnostics, benchmarks, and additional tests · Evaluation, diagnostics, benchmarks, and additional hypothesis tests · EVA037 · Metric
Pass@k for code generation
Estimates the chance that at least one of k independently sampled candidates passes a task’s tests.
In CodeSplash
No method yet, but the reference's example runs here as a notebook.
Do it in CodeSplash Open the reference's example as a Python or R notebook.
- Availability
- Runs as a notebook
- Code example
- Complete calculation
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Estimates the chance that at least one of k independently sampled candidates passes a task’s tests.
Question / hypotheses
How often can a fixed generation-and-test protocol produce a passing solution within k samples?
Architecture / computational structure
A fixed scoring/calibration pipeline applied to model outputs or supplied observations; the formula and usage sections identify its operations.
Assumptions
Sampling and test suites must be fixed. n generated candidates must be at least k; duplicate outputs, dependence, contamination, and incomplete tests affect interpretation.
Formula / computational definition
Parameters and notation
n is candidate count, c passing count, k sampling budget. Temperature, decoding, timeout, tool access, and test coverage are crucial protocol hyperparameters.
Fitting, fine-tuning, and adaptation
There is no model fine-tuning step for this evaluation procedure. Freeze the evaluated systems and evaluator before the final test. Select evaluation settings on development data; if a learned evaluator or calibration model is adapted, use separate fitting data, version it, and reassess its validity.
How to use and calibrate
Run generated code only in a suitable isolated evaluator, compute the estimator per problem, then average problems. Keep training and evaluation tasks disjoint and inspect failure modes.
Example application
Compare code models under the same sampling budget and hidden test suite.
Interpretation / pitfalls
Watch out
Passing tests is not proof of correctness outside the suite. Choosing among candidates with an oracle is distinct from a deployable selection rule; pass@k does not describe first-answer reliability.
Python and R code examples
Scope: Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.
Validation: Python — Executed successfully on synthetic inputs. R — reviewed but not executed in this environment. Python dependencies are explicit imports; R uses base R unless a package/bridge is explicitly named.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.
from math import comb
n,c,k=20,4,5
print(1-(comb(n-c,k)/comb(n,k) if n-c>=k else 0))
Complete calculation — Mathematical calculation on synthetic inputs; not a complete benchmark pipeline.
n <- 20; correct <- 4; k <- 5
print(1-if(n-correct>=k) choose(n-correct,k)/choose(n,k) else 0)
Sources
- Source 1arxiv.org
- Source 2github.com
From the CodeSplash reference, entry EVA037.