File size: 5,568 Bytes
7cef6d9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | ---
license: cc-by-4.0
pretty_name: PDF-Integrity-Bench
language:
- en
tags:
- pdf
- document-forensics
- tamper-detection
- prompt-injection
- redaction
- synthetic
size_categories:
- 1K<n<10K
---
# PDF-Integrity-Bench
3,790 synthetic PDF files for testing tools that look for signs of editing in a PDF: 1,250 files altered
in one of four ways, 2,500 untouched files that a careless checker flags, and 40 files altered in ways
that leave nothing in the file to find. Every file is made by a program from invented content. No file is, or
is derived from, a real document, and no real person or company appears in one.
It is the public benchmark pack behind Milliframe's `doc-forensics` PDF tamper and prompt-injection benchmark.
## What is in it
| | Files | |
|---|---|---|
| `fake_redaction` | 375 | A box, a picture, a form or an annotation covers text that is still in the file. |
| `hidden_prompt_injection` | 425 | An instruction to an AI reader that a person does not see: invisible text mode, white and near-white, under 2 points, off the page, characters that take no space, under a cover or a picture. |
| `xref_tamper` | 350 | A later save changes what a page says: an amount, a line of text, an overlay, one after a signature. |
| `font_subset_swap` | 100 | A few characters of a line come from a second copy of the font, as when a value is typed over. |
| `benign_pristine` | 550 | The clean parents of the altered files. |
| `benign_resave` | 1,650 | The same documents saved again by ordinary means: rewritten, linearized, compressed, incrementally updated, signed. |
| `benign_hard_negative` | 300 | Untouched files that look altered: true redactions, white headings on a dark bar, small print, a scan's text layer, a cropped margin, a stamp, a logo, a highlight. |
| `evasion_audit` | 40 | An edit flattened by a full rewrite; a document made again with another figure. Counted apart: nothing in such a file says it was changed. |
Five layouts (invoice, paystub, résumé, memo, purchase order), one or two pages each.
- `files/<sha256>.pdf`: a file is named by the SHA-256 of its bytes.
- `truth.jsonl`: one line a file: `key` (its SHA-256), `label` (`attack` or `benign`), `slice`, `attack_class`,
`variant` (how exactly it was made), `writer` and `writer_version` (the library that wrote the bytes),
`doc_type`, `pages`, `cluster_id` (files that share an issuer) and `parent_key` (the file it was made from).
It says what a file is and how it was made, never what a checker should answer about a person.
- `dataset.json`: the counts, every writer with its version, the seed (`0`), and `trial_index_sha256`,
the SHA-256 of `truth.jsonl` (`sha256:5f6d738c0f083befe6f06448a0ed2338679bd4bdecbaef3e9f7a87ae3846077b`).
- `answers/`: what each system of the published benchmark answered for every file.
- `rivals/`: the two plain baseline scripts of the benchmark, each with its own lock file.
- `score.py`: scores any answers file against `truth.jsonl`.
## Score a tool
Write one JSON line a file, `{"key": "<sha256>", "flagged": true}`, then:
```bash
python3 score.py my-tool.jsonl
```
To check the published figures, score the recorded answers:
```bash
python3 score.py answers/milliframe-doc-forensics.jsonl
```
To run a baseline yourself (needs [uv](https://docs.astral.sh/uv/)):
```bash
ls -d "$PWD"/files/*.pdf > files.txt
uv run --frozen --project rivals/pypdf-naive python rivals/pypdf-naive/detect.py --files-from files.txt --out pypdf-naive.jsonl
python3 score.py pypdf-naive.jsonl
```
The published benchmark also states recall at a fixed 1% false-alarm rate with 95% intervals over issuer
clusters; `score.py` gives the plain shares those figures rest on.
## Read this before quoting a figure
- **The altered files come from one generator.** A tool that was written against the same techniques does well
here by construction. A score on this pack says a tool does what this pack tests. It does not say how the
tool fares on files altered in a way nobody has put into the pack.
- **Every document is synthetic.** A false-alarm rate here is a rate on these five layouts and these writers,
not on the PDFs of a real mailbox.
- **Writers.** pikepdf 10.18.2 (libqpdf 12.4.2); pypdf 7.1.1; pypdf 7.1.1, cryptography 50.0.2; pypdfium2 5.15.2 (PDFium 159.0.8149.0@sourcebuild-toolchained); reportlab 5.1.2; 70 files are written directly by hand. There is no file written by Acrobat, LibreOffice, Chrome, Typst or WeasyPrint, and no
PAdES signature (the signatures are detached PKCS#7 by a test identity).
- **Not in the pack:** text hidden on a switched-off layer or cut away by a clipping area, white-out and
retype, and anything flattened into pixels (a page that was printed and scanned).
- Some writers do not repeat byte for byte (their files carry a random identifier or a date), so this build of
the pack is the one `trial_index_sha256` names.
## Licence
The files, `truth.jsonl`, `dataset.json`, `answers/`, `score.py` and the scripts under `rivals/` are released under
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). Cite as: Milliframe, *PDF-Integrity-Bench*
(seed 0), 2026.
**Fonts and libraries.** Every PDF in this pack either names standard PDF Base-14 faces without embedding font
data or embeds subsets of Bitstream Vera under the permissive Bitstream Vera licence (which permits embedding and
redistribution). Zero proprietary operating-system fonts are embedded. The libraries the baseline scripts call
(`pikepdf`, `pypdf`) are not part of this dataset and keep their own licences.
|