Export schema 2.0
One JSONL record represents one page
The V2 LayoutLM export is exports/layoutlm.jsonl. It writes one record per page, not one record per document. Each record includes document_id, page_number, image_path, image_rendition, split, tokens, bboxes, and labels. The export schema version is 2.0.
Boxes are normalized to the 0–1000 LayoutLM convention. Labels are O for unlabelled words and B-… values for semantic labels supplied by the annotation. The tokens, boxes, and labels arrays have matching lengths.
Short example
Generate a page-level export
Run commands from the folder described in platform setup, and use a new output folder for each example.
Windows PowerShell
& '.\_internal\DocumentGenerator_v2.0_cli.exe' generate --type invoice letter --count 2 --seed 42 --output output/layoutlm-small --export layoutlm --validateLinux AppImage
./DocumentGenerator_v2.0.0_Linux-x86_64.AppImage --cli generate --type invoice letter --count 2 --seed 42 --output output/layoutlm-small --export layoutlm --validateLinux Flatpak
flatpak run com.docsetgenerator.DocSetGenerator --cli generate --type invoice letter --count 2 --seed 42 --output output/layoutlm-small --export layoutlm --validateA line in the resulting JSONL has this shape:
{
"export_schema_version": "2.0",
"id": "<document-id>-p001",
"document_id": "<document-id>",
"page_number": 1,
"image_path": "images/<document-id>/page-001.png",
"image_rendition": "source",
"split": "train",
"tokens": ["Invoice", "INV-123"],
"bboxes": [[80, 70, 180, 110], [210, 70, 360, 110]],
"labels": ["O", "B-INVOICE_NUMBER"]
}
The values in this snippet illustrate the record shape; use the generated file as the source of truth for IDs, paths, tokens, and coordinates.
Rendition choice
Train on the page your consumer will see
When a run has a delivered rendition—such as a scan transform—COCO and LayoutLM use delivered pages and their matching word geometry. The record's image_rendition says whether the image is delivered or source. The canonical pages record remains the pristine semantic reference; do not pair a delivered image with source boxes by accident.
--export-rendition selects the Label Studio rendition. It does not change LayoutLM's delivered-page behavior. Label Studio uses delivered PDF pages by default and automatically selects pristine previews for native formats, recording each task's actual rendition. Request --export-rendition pristine to review pristine pages for every document.
Consumer migration
Update loaders that assumed document records
Old assumption
A single JSON object represented one entire document, with a document-level image or a concatenated token sequence.
V2 behavior
A page record carries the document ID and page number. Group by document_id only when your model or report needs document context.
Order pages by page_number and preserve the export’s split assignment. Related source documents, delivery variants and packet pages belong together; reshuffling their pages can mix related content across training and test sets.
Limits
A valid LayoutLM file does not validate model quality
--validatechecks the manifest, annotations, and export consistency. It does not train a model or report token-classification accuracy.- Delivered geometry describes the selected generated condition. Scan damage, visible corruption, and hidden text have different semantics; use the delivery guide before mixing them in a corpus.
- Generated labels come from the document model and available semantic annotations. They are not a universal entity taxonomy or a guarantee that every visual region has a meaningful class.
- The evaluator's supported parser inputs are narrower than the generator's 33-type catalog. Use evaluation for the supported scoring boundary.
Related formats
Compare the pixel-space COCO export, semantic FUNSD-shaped records, and conservative DocVQA export. Start with OCR training data when you need a complete dataset recipe.