Guide · Invoice data

Generate invoice data with coherent facts

Invoice testing needs more than plausible-looking amounts. V2 keeps issuer, buyer, line items, tax, payment state, due terms, and grounded fields consistent so extraction tests can identify a real parser error.

Why invoices need a model

Test relationships, not isolated strings

A useful invoice fixture ties the issuer, buyer, invoice reference, date, terms, line items, tax, payment state, and balance together. V2's authored invoice routes render those facts into several invoice layouts and retain their provenance in annotations. Amounts use cent-rounded arithmetic, and progress billing charges completed quantities while leaving pending work outside posted totals.

Keep invoice and receipt tests separate. An invoice requests or records payment with due terms and a balance; a receipt acknowledges payment with a receipt reference, method, date/time, and amount received. The receipt renderer does not borrow invoice due-date or payment-demand language.

Short example

Generate a small coherent invoice set

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' generate --type invoice --count 3 --seed 42 --content-pack business-v2 --output output/invoices-business --export layoutlm docvqa --validate

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli generate --type invoice --count 3 --seed 42 --content-pack business-v2 --output output/invoices-business --export layoutlm docvqa --validate

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli generate --type invoice --count 3 --seed 42 --content-pack business-v2 --output output/invoices-business --export layoutlm docvqa --validate

This creates three invoice PDFs with authored business content and records their source facts, word geometry, and grounded fields. The export files are derived from those annotations. For specific states, industries, linked documents, or challenge controls, use a JSON SuiteSpec and inspect it with --preflight before generating.

A scalar field record is intended to look like a real document target: an invoice number, a printed total, a due date with a visible label, or an amount paid. A number that exists only in private model metadata is not exported as an extractive answer.

Targeted extraction challenges

Test missing fields, competing totals and ambiguous dates

ChallengeTargetWhat it tests
role_contrastinvoice_numberTwo role variants in one independent family.
absent_fieldOne of po_number, due_date, or buyer_contact is explicitly absent.Whether a parser distinguishes absence from an invented value.
multiple_totalsbalance_dueWhether labeled totals remain distinct and arithmetically consistent.
ambiguous_datesinvoice_dateWhether a parser uses an explicit date-order cue rather than guessing.
words_and_digitsamount_paidWhether words and a separately labeled numeric balance are kept distinct.
prompt_injectiontotalWhether visible or supported hidden instructions are kept out of the target.
prior_period_noiseCurrent invoice_number and totalWhether a parser ignores a labeled historical row.

Challenge admission depends on the selected state and document type. Preflight refuses combinations where a target is not guaranteed to be printed. Run your parser on the neutral bundle and score its predictions to measure performance on those challenges.

Fields versus DocVQA

Use the evaluator for scalar business extraction

The content pack publishes a field schema with names, types, descriptions, and formats without putting target values into the public parser bundle. A parser can use its own key names: add --field-map keys.json to the fields scoring command, where keys.json maps each parser key to a canonical field name. Exact, normalized, and typed matches remain separate, and absent-field decisions are explicit.

For coherent business content, the current DocVQA export supplies the document-type question, not scalar business-field questions. Other supported routes can supply grounded questions where answers are actually printed. Use the fields evaluation workflow when the task is scalar invoice extraction.

Limits

Plan your invoice coverage

  • Generated invoices are synthetic test material, not accounting records, shipment evidence, tax advice, or valid commercial documents.
  • The business pack provides reviewed English-language plans, states, industries, and linked case facts.
  • Changing names, amounts, or cosmetic layout does not by itself create a new business situation. Related invoice, letter, memo, and report projections can share one case and one split family.
  • The evaluator scores supported PDF inputs and single-value fields; native formats, table extraction, and unsupported situation revisions remain outside the scorer.

Start with the first run, learn suite planning, and use test documents for OCR for the neutral handoff. For export formats, see LayoutLM, FUNSD, and DocVQA.