Skip to content

About

Reproducible benchmark of EN 16931 / XRechnung e-invoice validators: accuracy, latency, error messages. By W System.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

einvoice-validator-benchmark

A public, reproducible benchmark of EN 16931 / XRechnung e-invoice validators: accuracy (expected vs reported rule ids), latency and error-message quality. Published by W System. One command re-runs everything on your machine:

git clone https://github.com/wsystemdev/einvoice-validator-benchmark && cd einvoice-validator-benchmark
make bench          # needs docker, curl, python3 (set DOCKER="sudo docker" if needed); about 2 hours with 3 repetitions
make quick          # 30 files, 1 repetition, a few minutes

Every number below comes from results/2026-11-26-run3/ (raw outputs in raw.tar.gz, per-file results in cases.csv). The earlier run in results/2026-11-26-run1/ is the 0.1.0-beta.2 image; results/2026-11-26-run2-prerelease/ is a pre-release check and is not released behaviour. We are a vendor of two of the compared tools, so we publish where we lose too, and we publish the exact method so you can check it.

Run 3 in short (2026-11-26, W System free image 0.1.1): the W System image is correct on 279/279 files. On the 278 files that KoSIT validator 1.6.3 can read, it gives the same valid/invalid verdict as KoSIT on every file (0 verdict differences). The reported rule ids differ on 16 files, all of them schema or well-formedness failures: on 12 files that fail the XML Schema the W System image reports the Schematron rule ids in addition to XSD, and on 4 files that are empty, plain text or not well-formed XML, KoSIT reports a generic error while the W System image reports an input error without a rule id. The one file KoSIT cannot read is a PDF with no embedded XML. Source: results/2026-11-26-run3/cases.csv.

What is compared

Tool Version (pinned) How it runs
KoSIT validator + XRechnung configuration validator 1.6.3, configuration 3.0.2 release 2026-08-31 (Apache-2.0), SHA-256 pinned in harness/fetch.sh Docker (Temurin 21 JRE), CLI, one process per file; plus its daemon mode for warm latency
Mustang CLI 2.26.0 (Apache-2.0), SHA-256 pinned Docker (Temurin 21 JRE), --action validate
W System free validator image ghcr.io/wsystemdev/einvoice-validator:0.1.1, pulled by digest sha256:5c3ef39b…c523 (public) Docker, wsv validate, --network none
W System API free tier POST https://api.wsystem.dev/einvoice/validate, anonymous, no key HTTPS from the test machine; limited to the 20 free calls per IP and day, so only a 15-file subset (harness/api_subset.txt)

All local tools run with --network none. Other validators were considered; only tools that are free to run locally are included. Pull requests adding more are welcome.

Important context for reading the results. The KoSIT configuration, the W System image/API and Mustang all execute the same official rule sources (CEN EN 16931 Schematron and the KoSIT XRechnung Schematron), so most verdicts agree. The differences come from scenario handling, the schema layer, supported profiles, speed and messages. KoSIT with its configuration is the official XRechnung reference; where its published severity policy differs from a tool, we follow KoSIT's policy (see docs/LABEL_REVIEW.md).

Corpus

279 files: 86 official KoSIT XRechnung test instances, 27 official CEN EN 16931 examples, 3 Mustang test files, and 163 synthetic files (valid, known-invalid with expected rule ids, schema/format failures, 12 ZUGFeRD/Factur-X PDFs). UBL and CII, XRechnung and generic EN 16931. Licences: official files keep Apache-2.0 (KoSIT, Mustang) or EUPL-1.2 (CEN, distributed under EUPL-1.2 as published); synthetic files and code are Apache-2.0. Synthetic invoices are fictional (reserved .example parties). Official files are copied unchanged from their upstream test suites and are published samples that may name real organisations. None of the files is W System customer data. The 12 ZUGFeRD/Factur-X PDFs are our synthetic CII embedded with Mustang 2.26.0 into Mustang's sample PDF/A-3 carrier; the visible page is that carrier invoice, not the embedded XML, so they test PDF extraction, not a visually consistent Factur-X document. Details: docs/CORPUS.md, corpus/LICENSES/, corpus/manifest.json.

Official sources contain almost no full-document negative test files, so the known-invalid files are synthetic: one deliberate rule violation each, rendered to UBL and CII by tools/synth.py. How expected results were set, and what we corrected after a first run: docs/LABEL_REVIEW.md.

Results (run of 2026-11-26)

Accuracy

A file is correct when the verdict matches and, for known-invalid files, every expected rule id is reported. XML-Schema failures count as the id XSD. The "exact" column also penalises extra rule ids; it is informational, because rules that legitimately fire together with the expected one are not exhaustively labelled.

Tool Files Correct (verdict + expected rule ids) False positives (valid file rejected) False negatives (invalid file accepted) Expected rule id found Exact (no unexpected extra rule ids) No result / crash
KoSIT 278 100.0% (278/278) 0.0% (0/158) 0.0% (0/120) 100.0% (113/113) 92.8% (258/278) 0
Mustang 279 95.0% (265/279) 5.7% (9/158) 0.0% (0/121) 95.6% (108/113) 84.2% (235/279) 0
W System image 279 100.0% (279/279) 0.0% (0/158) 0.0% (0/121) 100.0% (113/113) 93.2% (260/279) 0

Same table on the 15 files that the API free tier could run (daily anonymous quota)

Tool Files Correct (verdict + expected rule ids) False positives (valid file rejected) False negatives (invalid file accepted) Expected rule id found Exact (no unexpected extra rule ids) No result / crash
KoSIT 15 100.0% (15/15) 0.0% (0/5) 0.0% (0/10) 100.0% (9/9) 93.3% (14/15) 0
Mustang 15 100.0% (15/15) 0.0% (0/5) 0.0% (0/10) 100.0% (9/9) 80.0% (12/15) 0
W System image 15 100.0% (15/15) 0.0% (0/5) 0.0% (0/10) 100.0% (9/9) 93.3% (14/15) 0
W System API 15 100.0% (15/15) 0.0% (0/5) 0.0% (0/10) 100.0% (9/9) 93.3% (14/15) 0

By corpus group (correct / files run):

Group (files) KoSIT Mustang W System image W System API
KoSIT test suite (valid) (86) 86/86 82/86 86/86 2/2
CEN EN 16931 examples (valid) (27) 27/27 24/27 27/27 1/1
Mustang test files (3) 3/3 3/3 3/3 1/1
Synthetic valid (36) 36/36 36/36 36/36 2/2
Synthetic valid-by-policy, warning expected (4) 4/4 2/4 4/4 n/a
Synthetic invalid (expected rule ids) (100) 100/100 95/100 100/100 6/6
Format / schema failures (11) 11/11 11/11 11/11 2/2
ZUGFeRD / Factur-X PDFs (12) 11/11 12/12 12/12 1/1

Latency

Cold: one process per file, measured inside the container (JVM / Python start-up included, container start excluded).

Tool n median ms p95 ms mean ms
KoSIT 834 3766 4246 3792
Mustang 837 1629 2137 1666
W System image 837 1567 1761 1569

Warm: long-running process or batch, start-up excluded.

Mode n median ms p95 ms mean ms how measured
KoSIT daemon (HTTP, localhost) 556 6.8 19.0 8.4 client wall time per POST, passes 2-3 (pass 1 is warm-up)
W System image, one process for the whole corpus 816 4.0 18.0 6.9 per-file ms reported by the tool (first file of each pass excluded)
W System image, same, wall time per file 3 14.8 21.0 16.8 total container wall time / files (includes container start)
W System API free tier (from this machine) 14 370 726 419 client wall time per request incl. network; one request per file (quota)
W System API free tier, server-side 14 82.0 263 136 Server-Timing: app;dur header

Mustang has no daemon or batch mode in its CLI, so it only appears in the cold table.

Message quality

For the rule that is actually broken (the expected rule ids), share of reported messages that have each property. The properties and the detectors were fixed before the run (harness/report.py, harness/parsers.py): a "fix hint" is the presence of a fix / explain.fix field (only the W System JSON has one, so KoSIT and Mustang score 0% here); a "line number" is a parsed line field; "English" means the text does not match a short German-function-word regex. Read the table as a documented feature checklist, not as a ranked quality score. Fix hints and line numbers are features the W System output is designed to provide.

Property of the message for the broken rule KoSIT (n=120) Mustang (n=115) W System image (n=120) W System API (n=12)
official rule id 100.0% 100.0% 100.0% 100.0%
message text (>= 20 chars) 100.0% 100.0% 100.0% 100.0%
location (XPath or line) 91.7% 91.3% 100.0% 100.0%
line number in the source file 0.0% 0.0% 86.7% 0.0%
business term / group reference (BT-x, BG-x) 82.5% 86.1% 90.8% 100.0%
explicit fix hint 0.0% 0.0% 100.0% 100.0%
message in English 73.3% 72.2% 73.3% 58.3%

Where W System loses or is not the best

  • The four-file gap in 0.1.0-beta.2 is fixed in 0.1.1. Official XRechnung CVD samples (BR-CL-13) and standard-XRechnung files with a non-listed unit code (BR-CL-23) are now accepted as KoSIT does (warning, not error). Mustang still rejects those four files. The pre-release run in results/2026-11-26-run2-prerelease/ showed the same fix before the tag; it is not released behaviour.
  • Accuracy overall: KoSIT is the official XRechnung reference and scores 278/278 (it cannot read the one PDF that has no embedded XML, so 278 files). The W System image scores 279/279 on the full corpus, including that PDF. The corpus was labelled against KoSIT's published policy, so KoSIT's score is partly by construction.
  • Cold start vs warm: per file, a fresh process takes about 1.6 s for the W System image, 1.6 s for Mustang and 3.8 s for KoSIT (JVM start plus rule loading). The 0.1.1 image is slower on this cold path than 0.1.0-beta.2 was in run 1 (about 0.7 s), because each check now starts a separate rule-engine worker. Warm, KoSIT's daemon (about 7 ms median) and the W System batch mode (about 4 ms median, as reported by the tool) are the same order of magnitude; the two warm figures are measured differently (client wall time vs tool-reported time), so do not rank them against each other.
  • The API free tier is limited to 20 calls a day per IP, so it is evaluated on 15 files only; its latency includes the network round trip from the test machine.
  • Mustang covers more ZUGFeRD/Factur-X profiles and PDF/A checks than any other tool here; those are out of scope of this corpus and therefore not credited.

Reading the latency numbers

  • Cold: one process per file, timed inside the container with date +%s%N (JVM or Python start-up included; container start excluded). 3 repetitions per file; all repetitions pooled.
  • Warm: KoSIT daemon, HTTP on localhost, 3 passes, first pass dropped; W System image, one process validating the whole corpus, per-file time as reported by the tool (first file of each pass dropped); W System API, one request per file.
  • The API accuracy table is 15/15; the API latency row is n=14 because one file (format-FMT-wrong-root) returned HTTP 400, and only HTTP 200 responses are timed.
  • The test machine is shared and not isolated (load average at start/end is in the report). Absolute numbers are indicative; compare tools within one run.
  • The harness gives every file run a hard timeout (180 s by default, a timeout scores as no result). No file in the corpus is pathological (the heaviest synthetic file has 50 lines) and the slowest run in these published results took 4.8 s, so no timeout was hit. Inputs designed to stress a validator (for example very many lines) are deliberately not part of the timing set.

Reproduce run 3

Needs Docker, curl, git and Python 3 (standard library only). On Linux, set DOCKER="sudo docker" if your user is not in the docker group.

git clone https://github.com/wsystemdev/einvoice-validator-benchmark
cd einvoice-validator-benchmark
make verify                                            # 279 files checked, 0 mismatches
python3 harness/bench.py --reps 3 --out results/my-run  # same as `make bench`, with a named output folder

What the run does:

  1. harness/fetch.sh downloads KoSIT validator 1.6.3, the XRechnung 3.0.2 configuration (release 2026-08-31) and Mustang CLI 2.26.0 into vendor/ and checks each SHA-256.
  2. It builds two local images (harness/docker/Dockerfile.kosit, Dockerfile.mustang) and pulls the W System free image by digest: ghcr.io/wsystemdev/einvoice-validator@sha256:5c3ef39b27ab447d68a7ec03cdb48f7f11cc7fd77c0a3b1aa3b84474c248b523, which is the tag 0.1.1.
  3. It runs every corpus file through each local tool with --network none (3 repetitions for cold latency), then the warm modes, then the 15-file API subset.
  4. It writes REPORT.md, cases.csv, results.json, meta.json and the raw tool outputs (raw/) into the output folder.

Compare results/my-run/cases.csv with results/2026-11-26-run3/cases.csv: verdicts and rule ids should match; latencies depend on your machine. The API free tier allows 20 anonymous calls per IP and day; to skip it, add --tools kosit,mustang,wsv. To look at the published raw outputs, run tar xzf results/2026-11-26-run3/raw.tar.gz -C results/2026-11-26-run3 (the unpacked raw/ folders are git-ignored). meta.json of run 3 records harness commit 001f2ce; the image pin and tool label above were committed right after the run in cdaacd0, so run from cdaacd0 or later.

Hardware and environment of the published run

See results/2026-11-26-run3/REPORT.md (CPU, cores, RAM, kernel, Docker, Java, image ids, load average) and meta.json.

Repository layout

  • corpus/ the files, manifest.json (source, licence, expected verdict, expected rule ids per file), LICENSES/
  • harness/ bench.py (orchestrator, stdlib only), parsers.py, report.py, adapters/, docker/, fetch.sh
  • tools/ corpus generator (synth.py, cases.py, build_corpus.py), verify_corpus.py
  • docs/ CORPUS.md, LABEL_REVIEW.md
  • results/ published runs

make verify checks every corpus file against its SHA-256. make corpus rebuilds the corpus from the pinned upstream sources (the PDFs embed timestamps, so rebuilt PDFs are not byte-identical).

Limits

Only EN 16931 and XRechnung 3.0 rules are in scope. Peppol BIS Billing 3 rules, national CIUS other than XRechnung, PDF/A conformance, throughput under concurrency and paid products are not measured. The synthetic negatives test one rule at a time; real-world invoices fail in messier ways. If you find a wrong label or want a tool added, open an issue.

Licence

Apache-2.0 for the harness and synthetic files (LICENSE, NOTICE). Official corpus files keep their upstream licences: Apache-2.0 for the KoSIT XRechnung test suite and the Mustang files, EUPL-1.2 for the CEN EN 16931 examples. Licence texts and the Mustang NOTICE are in corpus/LICENSES/.

About

Reproducible benchmark of EN 16931 / XRechnung e-invoice validators: accuracy, latency, error messages. By W System.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages