What is pass@k?
In Turkish: Pass@k · Topic: Data and evaluation
A metric for code-generating AI models: the probability that at least one of k generated solutions to a problem passes that problem’s unit tests.
How does it work?
The model produces several solutions for a programming problem, and each one is run against automated unit tests. Pass@k is the probability that at least one of k attempts passes all the tests. In practice more than k samples are generated per problem and the probability is computed with a statistical estimator, which reduces the effect of luck. Pass@1 reflects success on the first try. As k grows the score rises, because the model gets more chances. Results are then averaged across all problems.
Why does it matter?
Since code correctness can be checked automatically and exactly, this metric is common in coding evaluations. Pass@1 reflects a user who wants working code in one try, while higher k values reflect systems that generate many candidates and filter them with tests. A score reported without its k value can therefore be misleading.
Example
A coding assistant proposes five versions of a function and two of them pass the unit tests; that problem counts as solved under pass@5.
FAQ
What is the difference between pass@1 and pass@10?
Pass@1 is the chance of getting a correct solution in a single attempt; pass@10 is the chance that at least one of ten attempts is correct. Pass@10 is almost always higher.
Why is pass@k mostly used for code?
Because unit tests can verify code automatically and unambiguously. For free-form text it is much harder to define a single objectively correct answer.