Inspiration
Nuijten and colleagues checked about 258,000 p-values in eight psychology journals. About half of the papers that used significance tests had at least one p-value that did not match its own test statistic, and about one paper in eight had an error big enough to change a conclusion (Behavior Research Methods, 2016, https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5101263/).
statcheck, an R package from the same group, finds these errors when a result is written in one fixed APA form in plain text, such as t(28) = 2.10, p = .045. A result with an effect size between the statistic and p, a result in a table, or a PDF whose text lost its spaces is skipped. I wanted to read those too.
What it does
You open a paper or report. Recount lists every test result and every mean with a sample size, recomputes them, and marks the ones that do not agree with their own numbers. Each flagged row shows where it is in the text, the reported p, the recomputed p with the range allowed by rounding, a small scale that shows whether the two sit on different sides of .05, and who read it: the APA rules or the language model.
A real example. In a PLOS ONE paper (Lee and Kim, 2024, CC BY 4.0, doi:10.1371/journal.pone.0291979) the text says F(1,69)=16.96,η 2=0.20,p<.0001, with the effect size in the middle and no spaces left after PDF extraction. The APA rules read none of the 16 results in that paper. The model copied this one as {"test":"F","stat":"16.96","df1":"1","df2":"69","p":"< .0001"}, and scipy gives p = .000104, which is not below .0001. It is a small error and it does not change the conclusion, but it is one the rules could not see.
How we built it
The rule is: the model copies, code does the arithmetic.
- Code splits each page into sentences and table rows. A table row keeps its caption and column headers.
- APA rules read every result written in the standard form.
- A language model (Qwen2.5-3B-Instruct, open weights, run locally with llama.cpp, temperature 0) reads only what the rules did not, and copies the numbers into JSON. It is told not to compute anything.
- Code checks that every number the model returned is really in that snippet, as a whole token, and that the named test is printed there. Anything else is dropped as "not trusted".
- Code recomputes each p-value with scipy and runs the GRIM test on means of whole-number scores.
Stack: Python, scipy, pdfplumber, llama.cpp, Qwen2.5-3B-Instruct (Q4_K_M), a standard-library web server, plain HTML, CSS and JavaScript.
Where AI is used (model, role, input and output)
Model: Qwen2.5-3B-Instruct. Role: read wordings and table rows the rules cannot, and copy the numbers out as JSON.
Input snippet (synthetic test report):
The interaction was reliable (r = .36, df = 48, p = .010); a simple-effects test at the high level gave a t statistic of 2.58 on 38 degrees of freedom (p = .006)
Model output:
{"items": [{"kind":"test","test":"r","stat":".36","df1":"48","p":"= .010"}, {"kind":"test","test":"t","stat":"2.58","df1":"38","p":"= .006"}]}
Code then finds that t(38) = 2.58 gives a two-sided p of .0139, so the reported .006 is flagged.
Testing
Every set was committed before its one scored run. Numbers below are from those runs; changes made afterwards are listed separately as post-hoc.
Real papers, second set (6 open-access CC BY papers, 152 results printed with statistic, df and p, 16 real inconsistencies). I typed the answer key from the papers and committed it (git tag real2-freeze) before any system saw these papers, then ran each system once:
| System | Results read and checked | Real errors flagged | False alarms |
|---|---|---|---|
| Recount (APA rules first, model for the rest) | 79/152 | 5/16 | 32 |
| APA rules alone (statcheck-like regex, same checker) | 50/152 | 3/16 | 28 |
| Same model asked to find the errors itself | n/a | 0/16 | 8 |
Recount read more and flagged more real errors than the rules alone. It also raised more false alarms, and that is the main weakness: 15 came from p-values in scientific notation (p = 2.87e-9) that both systems cut short, and 13 from one-sided tests that the papers did not label.
Synthetic sets (invented reports with planted errors and an answer key). These were scored before the APA rules were put in front of the model, so the Recount column is the model reading alone.
| Set, scored once | Recount: caught / false alarms | APA rules alone | Model finding errors itself |
|---|---|---|---|
| Holdout (8 reports, 14 planted errors) | 12/14, 1 | 3/14, 0 | 4/14, 7 |
| Second holdout, two-column pages and wording from real papers (13 errors) | 9/13, 6 | 2/13, 1 | 0/13, 15 |
On the development set used while building, Recount caught 20 of 20 with no false alarms.
Real papers, first set (8 CC BY papers, 77 results, 1 real inconsistency), scored once before the rules were added in front: Recount read 47/77, missed the one real error and raised 9 false alarms; the rules alone read 44/77 and caught it with none. That run is what led to the changes below.
Post-hoc: current code, same saved model output scored again. These fixes were made after I had seen the errors above, so they are not a fresh test: the Unicode minus sign, sentences that run around a table, copied numbers must match whole tokens, coefficient and correlation table rows are not tested, GRIM only for whole-number scores, p in scientific notation, df below 1 left unchecked.
| Set | Recount now | APA rules alone now |
|---|---|---|
| Real papers, second set: read, real errors flagged, false alarms | 94/152, 10/16, 17 | 65/152, 8/16, 14 |
| Real papers, first set | 68/77, 1/1, 1 | 44/77, 1/1, 0 |
| Second holdout: caught, false alarms | 12/13, 2 | 4/13, 1 |
| Holdout: caught, false alarms | 10/14, 0 | 3/14, 0 |
The holdout went down from 12/14 to 10/14: three planted impossible means sit in tables that never say the scores are whole numbers, so GRIM is no longer run on them. I kept the rule because on real papers GRIM on non-integer scores gave only false alarms.
Recount was not compared with statcheck itself (it needs R). The "APA rules alone" rows use my own regex for the standard form, fed into the same checker.
All numbers come from the results files in the repository (results.json, results_real2.json, and separate results_posthoc_* and results_real2_posthoc_* files marked post-hoc). 52 automated tests cover the checker, the extractor, the web server and the match between each results .json and .md file.
Failure cases
- The model copied
F(1,69)=11.42, p=.001asp < .001, so a correct result was flagged (real paper S05). The page shows "Model copied it as F(1, 69) = 11.42, p < .001" under the quote so a reader can catch it. - p in scientific notation was cut to
p = 2.87, which turned correct results into false decision errors (real paper S02, 15 false alarms in the scored run). Fixed after scoring. - One-sided tests that the paper does not label are flagged as wrong (13 false alarms on the second real set). Not fixed.
- PLOS PDFs come out of pdfplumber without spaces, so sentences cannot be cut; the model then gets a whole page as one snippet and sometimes copies an effect size as df. One such copy gave p = NaN and broke the hosted demo page for S05; it is now left unchecked.
- On the synthetic holdout, the model copied
r(28) = .37as a t test, and in another table row skipped a mean, so an impossible mean was not checked.
Limits
No OCR, so scanned PDFs are refused with a message. Only t, F, chi-square, z and r with two-sided p-values. On new real papers Recount read about half of the printed results in its scored run (6 in 10 with the post-hoc fixes) and still raises false alarms, mostly from one-sided tests and from numbers the model borrows from a neighbouring result. Decimal df (Welch) are cut to whole numbers. Recount checks that numbers agree with each other; it cannot tell whether the study design or the choice of test is right.
What's next
In order of what the tests showed: read "one-tailed" and "one-sided" in the sentence and check those tests one-sided; put spaces back into PLOS text before cutting sentences; then a third set of real papers with its key frozen first, to test the post-hoc fixes on papers I have not seen.
Built during the event / prior work
All code was written during the AI OpenBuild build window (first commit November 2026). Existing components: scipy, pdfplumber, PyMuPDF (only to draw the synthetic PDFs), llama.cpp, Qwen2.5-3B-Instruct weights, IBM Plex fonts and Noto Serif (SIL OFL). The 14 real test papers belong to their authors and are redistributed under CC BY with attribution (DOIs in data/real/SOURCES.md and data/real2/SOURCES.md).
Licences of the parts that are not mine: Qwen2.5-3B-Instruct is released under the Qwen Research License (non-commercial, research and evaluation only; checked on its Hugging Face model card, 2026-11-24). The weights are not included in this repository; you download them yourself. "Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) Alibaba Cloud. All Rights Reserved." The demo video narration uses Kokoro-82M (Apache-2.0) through kokoro-onnx (MIT).
AI assistance disclosure
Claude (Anthropic) was used as a coding assistant to draft code, tests and text, and to help type the real-paper answer keys (each entry carries its excerpt, so it can be checked against the PDF). I chose the problem and the design (the model copies, code computes), set up the evaluation and the rule that each set is committed before its one scored run, and checked the results. The narration in the demo video is synthetic speech (Kokoro TTS). The language model inside the product is Qwen2.5-3B-Instruct.
Team
Solo.
Try it
Code (MIT): https://github.com/StuartYo/recount
Hosted demo (https://recount-demo.vercel.app): every sample and all 14 real papers open with the saved model output, so no model or key is needed. Click a row to see the model's output for that snippet and the recomputation.
Locally, with your own PDF:
pip install -r requirements.txt
python app.py # http://127.0.0.1:8765
Without a model, only results in the standard APA form are read, and the page says so. To let the model read the rest:
llama-server -m qwen2.5-3b-instruct-q4_k_m.gguf --port 8091 -ngl 99
set RECOUNT_LLM_URL=http://127.0.0.1:8091/v1/chat/completions (Windows; export on macOS/Linux)
python app.py
Built With
- css3
- html5
- javascript
- llama.cpp
- pdfplumber
- python
- qwen
- scipy
- vercel