Guide · FUNSD export

Use FUNSD-shaped records for form experiments

Export generated form annotations as JSONL with word roles, normalized boxes and key-value links. Use them to test form loaders and classification workflows; the records are synthetic and separate from the original FUNSD benchmark.

A format-shaped export

--export funsd writes exports/funsd.jsonl. Each line contains a document ID, split, and a form array. A form item carries a word ID, text, a normalized box, a role such as question, answer, header, or other, linking references, and the underlying semantic label. The export records semantics_origin: document_model.

Roles and links come from the generated document's key/value pairs and title or heading blocks. The exporter uses the pristine pages geometry for this semantic format, even when a delivered image exists for another export. That keeps the form relationship tied to the source annotation rather than to a scan transform.

Short example

Generate a form-shaped JSONL file

Windows PowerShell

& '.\_internal\DocumentGenerator_v2.0_cli.exe' generate --type form --count 2 --seed 42 --output output/funsd-small --export funsd --validate

Linux AppImage

./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli generate --type form --count 2 --seed 42 --output output/funsd-small --export funsd --validate

Linux Flatpak

flatpak run com.docsetgenerator.DocSetGenerator --cli generate --type form --count 2 --seed 42 --output output/funsd-small --export funsd --validate

A line has this general shape:

{
  "id": "<document-id>",
  "split": "train",
  "form": [
    {"id": 0, "text": "Invoice", "box": [0.10, 0.08, 0.24, 0.11], "label": "header", "linking": [], "word_id": "word-001"},
    {"id": 1, "text": "Invoice number", "box": [0.10, 0.18, 0.28, 0.21], "label": "question", "linking": [[1, 2]], "word_id": "word-002"},
    {"id": 2, "text": "INV-123", "box": [0.31, 0.18, 0.42, 0.21], "label": "answer", "linking": [[1, 2]], "word_id": "word-003"}
  ],
  "semantics_origin": "document_model"
}

The words and IDs above are illustrative. Read the generated JSONL for the actual vocabulary, boxes, and links in your selected document.

FUNSD versus V2

Compatible structure does not mean the same dataset

Useful compatibility

The line-oriented record, form items, roles, normalized boxes, and links fit loaders designed around the FUNSD schema family.

Different provenance

V2 records are generated from its own document model and authored types. They are not the original FUNSD scans, annotations, task distribution, or benchmark results.

Use the export to test schema wiring, form-role classification, and link handling. If your research result depends on the original benchmark's image distribution or annotation decisions, include that benchmark separately and label the sources distinctly.

Geometry and evaluation

Keep semantic boxes separate from delivered pixel boxes

FUNSD and DocVQA preserve pristine source semantics and geometry. COCO and LayoutLM use delivered pages when a delivery condition creates them. That difference is intentional: a form link answers a semantic question about the source, while a detection model may need the exact pixels and geometry it receives.

--validate checks link indices and annotation consistency. It does not mean that the generated record is a full form-understanding benchmark or that a parser has achieved a score.

Limits

Know what the adapter leaves out

  • Roles are derived from available key/value and heading annotations. Documents without a grounded pair can legitimately contain mostly other words.
  • The export does not recreate an original benchmark's handwriting, scan population, labels, or train/test protocol.
  • Generated native formats may have preview artifacts, but parser evaluation's supported inputs remain narrower. Use the evaluation guide for scoring rules.
  • For pixel-space word detection, use COCO; for page-level token classification, use LayoutLM.

Read OCR training data for ground truth and split design, or degraded delivery before comparing source semantics with scan output.