how-many-questions
PyPI: pypi.org/project/how-many-questions · Project page & proof: zuhalsicimkaradavut.com/projects/how-many-questions · Paired benchmark: sql-under-compression · Author: Zuhal Karadavut (Zuhal Sicim · @zuhalsicim)
pip install how-many-questions
how-many-questions --from 59 26 1034 --questions 200
How many questions does an eval need before it can see that a new version of a model, a 4-bit copy for example, answers worse than the old one?
It depends on two numbers: the loss to be found, and the share of questions the two versions answer differently. With 85 of 1,034 questions answered differently (8.2 %) and a loss of 3.2 points, a run needs 668 questions to see the loss with a chance of 80 %. A run of 200 questions sees it with a chance of 26.9 %.
These are the numbers of a real comparison. In sql-under-compression, Qwen2.5-Coder-1.5B-Instruct at q4_k_m answered 85 of the 1,034 Spider questions differently from f16 and lost 3.2 points: 59 questions lost, 26 gained, p = 0.00045 in the exact sign test. My first run there had 200 questions and could not see the loss (9 lost, 5 gained, p = 0.424). Taking the full run's numbers as the truth, that was the likely outcome, not bad luck.
Use
Python 3.12 or newer, nothing to install: clone the repository and run it from its folder.
How many questions a loss needs, and the chance of a run of a given size. --from takes the counts
of a finished run, questions lost, questions gained and questions asked, so nothing is rounded:
$ python -m howmany --from 59 26 1034 --questions 200
Questions needed: 668
for a chance of 80.0 % to see a loss of 3.2 points (33 of 1,034 questions)
(sign test below 0.05, 85 of 1,034 questions answered differently).
At 200 questions the chance is 26.9 %.
Before a run there are no counts yet, so --differ and --loss take a share in percent and a loss
in points. Rounded to one decimal, the same run gives a slightly different plan:
$ python -m howmany --differ 8.2 --loss 3.2 --questions 200
Questions needed: 663
for a chance of 80.0 % to see a loss of 3.2 points
(sign test below 0.05, 8.2 % of questions answered differently).
At 200 questions the chance is 27.1 %.
The smallest loss a run of a given size sees with a chance of 80 %:
$ python -m howmany --differ 8.2 --questions 200
Smallest loss seen with a chance of 80.0 % at 200 questions: 5.8 points
(sign test below 0.05, 8.2 % of questions answered differently).
$ python -m howmany --differ 8.2 --questions 1034
Smallest loss seen with a chance of 80.0 % at 1,034 questions: 2.6 points
(sign test below 0.05, 8.2 % of questions answered differently).
The share of differing questions comes from a pilot run: count the questions the two versions answer differently and divide by the questions asked. In the first run above that was 14 of 200, 7 %:
$ python -m howmany --differ 7 --loss 3.2
Questions needed: 571
for a chance of 80.0 % to see a loss of 3.2 points
(sign test below 0.05, 7 % of questions answered differently).
--level sets the level the sign test must land below (default 0.05), --power the wanted chance
(default 0.8). The same functions are in howmany/power.py: power, questions_needed,
detectable_loss, sign_test and lost_needed.
How it works
Both versions answer the same questions, so only the questions they answer differently tell them apart. "Lost" went from right to wrong, "gained" from wrong to right. The exact sign test asks how likely a split at least this uneven would be if each differing question were a fair coin toss. It is the test that release-gate, my tool for deciding whether a model version may replace the current release, and sql-under-compression use; for right-or-wrong answers it is the exact McNemar test.
For a plan, the number of differing questions in a run of n is binomial with n and the differ rate, and each differing question is lost with chance (differ rate + loss) / (2 x differ rate). The power is the chance that the test lands below the level with more lost than gained questions. The code sums it over every number of differing questions, leaving out only terms that add up to less than 1e-18; for each number, the fewest lost questions that reach the level are counted with exact integers. The search for a sample size doubles the run until the power reaches the target, then bisects.
The tests check the power against a sum over every possible outcome for runs of up to 47 questions (within 1e-12), the counts against a direct scan with the sign test, the thresholds and p-values against the ones sql-under-compression publishes, and the power against the table in my article on that run. Every example in this README is a test: it is run and its output compared with the lines shown here.
Limits
- The two inputs are assumptions. Using the loss that a run has just measured to explain that same run's p-value is circular. Plan with the smallest loss that would matter, for example the largest one a release may lose.
- The differ rate of a pilot is itself uncertain. A higher differ rate needs more questions for the same loss, so the safe choice is the upper end of the pilot's interval.
- Questions are taken as independent. Spider's questions share 20 databases, and questions on the same database tend to fail together. Then the real noise is larger than the sign test assumes and a plan from this tool is too small. Evan Miller's Adding Error Bars to Evals shows how to account for such clusters.
- Only a loss counts. The test is two-sided, as in release-gate, but the power counts only the runs that show more lost than gained questions.
- From 80 % of questions differing, the power can drop a little with one more question. Then the number of differing questions is almost fixed. The size found reaches the target and one question fewer does not, but a smaller run may reach it too: with 95 % of questions differing and a loss of 73 points it reports 15, while 13 already reaches 80 %. Below 80 % no such case was found.
- Runs go up to 100,000 questions. A plan that needs more is reported as "more than 100,000". The slowest plan measured took 14 s.
- The smallest loss is printed rounded up to one decimal, so the printed loss is seen with at least the wanted chance.
Run the checks
pip install -r requirements-dev.txt
ruff check . && ruff format --check .
mypy
vulture howmany tests --min-confidence 80
pytest
The reasons behind each choice are in DECISIONS.md.
Files
howmany/power.py: the sign test, its power, the sample size and the smallest loss a run seeshowmany/__main__.py: the command line (--differand--loss, or--fromwith a run's counts)tests/: the checks aboveCITATION.cff: how to cite the tool ("Cite this repository" on GitHub; Zenodo reads it for a DOI)
Metadata
Release files for how-many-questions 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| how_many_questions-1.0.1.tar.gz | 14.2 kB | With provenance | Details for how_many_questions-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| how_many_questions-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for how_many_questions-1.0.1-py3-none-any.whl |
Total release size: 26.1 kB
Release files / how_many_questions-1.0.1.tar.gz
| Download URL | how_many_questions-1.0.1.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
791d03d157e2ce7a2ccdc09b03b66e9d3f9d3a0443b5454837c24a545fc0b930
|
|
BLAKE2b-256 checksum How to use checksums |
df2adaaa6697ff1a2b5d27d88226d59e32fef21d770a1e2696043dca5346ef65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logRelease files / how_many_questions-1.0.1-py3-none-any.whl
| Download URL | how_many_questions-1.0.1-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba75f06d379b03096e18a148cb4d2ca63b5c4aeb9898397d7b0243ad3d84deb0
|
|
BLAKE2b-256 checksum How to use checksums |
1be149b5806f72dd2388f98bea27a946a6537f64cb966a6485c5b5f7c6923be5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logSecurity for how-many-questions 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for how_many_questions-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 3, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.