TL;DR
DocDjinn is a novel synthetic document generation framework that combines the structural and textual intelligence of Vision-Language Models (VLMs) with the visual realism of latent diffusion models. It automatically generates diverse, high-quality document images complete with multi-task ground truth annotations directly from unlabeled seed images. When used to augment low-resource settings with just 100 real samples, DocDjinn recovers 87% of the performance of a full real-world dataset, drastically lowering annotation costs.
What Problem Does This Paper Address?
Modern document intelligence systems—which handle tasks like layout analysis, key information extraction (KIE), and visual question answering (VQA)—rely heavily on massive, manually annotated datasets. Procuring this data is incredibly expensive, labor-intensive, and frequently bottlenecked by strict data privacy regulations.
While synthetic data generation is a promising alternative, existing methods suffer from major drawbacks: they either lack textual coherence, focus only on isolated components (like standalone tables or layouts), or generate document images without the corresponding task-specific ground truth (GT) annotations required for supervised learning. DocDjinn bridges this gap by providing an end-to-end, unsupervised pipeline that transforms unlabeled document seeds into fully annotated, visually realistic synthetic datasets.
Methods
The DocDjinn framework operates via a decoupled semantic-visual generation pipeline divided into four main stages:
- Intelligent Seed Sample Selection: To capture the true distribution of a target dataset, DocDjinn extracts multimodal embeddings combining layout structure (LayoutLMv3), visual appearance (CLIP), and textual semantics (Sentence Transformers). It then uses HDBSCAN and k-NN clustering to select a representative, diverse set of "seed" document images.
- VLM-Based Document and GT Synthesis: Using the selected seed images as few-shot guidance, a frontier VLM (Claude Sonnet 4.5) generates structured HTML/CSS code to synthesize document variants. Simultaneously, the VLM generates task-specific ground truth annotations at either the document level (Macro JSON for VQA) or element level (Micro class groupings for layout analysis).
- Visual Realism Enhancement: To make the documents look authentic, DocDjinn injects realistic, variable-style handwriting and signatures using a latent diffusion model trained on the IAM dataset. Handwritten words are stitched together using a novel percentile-based baseline alignment algorithm. Contextual visual elements like logos, stamps, and figures are also dynamically rendered and inserted.
- Bounding Box Extraction and GT Verification: Finally, text bounding boxes are extracted via OCR or PDF rendering. The VLM-generated ground truth undergoes strict, task-specific programmatic verification (e.g., ensuring VQA answers match the text via Levenshtein distance) to filter out rendering failures or anomalous layouts.
Datasets
The authors rigorously evaluated DocDjinn across eleven popular benchmarks spanning four core document intelligence tasks:
- VQA: DocVQA, WTQ
- Key Information Extraction (KIE): Kleister Charity (KLC), SROIE, CORD, FUNSD
- Document Classification (CLS): Tobacco3482, RVL-CDIP, DocLayNet-CLS
- Document Layout Analysis (DLA): PubLayNet, ICDAR2019, DocLayNet-DLA
Newly Introduced Benchmarks: The authors introduced and released DocVQA-HW, a 103-sample handwriting-focused subset of the DocVQA test split designed to evaluate handwriting synthesis quality. They have also publicly released their complete codebase and a massive dataset of 140k+ synthetic document samples.
Key Insights and Ideas
- Intra-Cluster Sampling is Crucial: A major finding was that sampling seeds from within a single document cluster (intra-cluster) consistently outperforms sampling across different clusters (cross-cluster). Preserving the structural coherence of specific document styles during generation is far more critical than maximizing broad diversity.
- VLMs as Zero-Shot Annotators: DocDjinn demonstrates that frontier VLMs can reliably generate complex spatial and semantic annotations (like bounding boxes and entity pairs) entirely from unlabeled seed images, without ever seeing real human-annotated training labels.
- Multimodal Decoupling: Rather than forcing a single model to generate text, layout, and graphics simultaneously, decoupling the tasks—using a VLM for HTML/CSS structure and text, and specialized diffusion models for handwriting—yields vastly superior visual fidelity.
Key Results
- Pure Synthetic Training: Models trained exclusively on DocDjinn's synthetic data achieve an average of 70.8% of the performance of models trained on full real-world data. On some datasets, like KLC, the gap was as small as 2.41 points.
- Low-Resource Augmentation: In data-scarce environments with only 100 real training samples, augmenting the dataset with DocDjinn synthetic data yields a massive +12.38 point average improvement, effectively reaching 87% of the performance of the full real-world dataset.
- High Distributional Similarity: Generated documents achieved exceptionally low Layout-FID scores (predominantly below 10), proving that the synthetic layouts closely mirror the underlying real-world data distributions.
Limitations and Future Work
Despite its success, DocDjinn generates "pristine" digital documents, creating a visual domain gap when evaluated against real-world datasets that contain scanning artifacts, camera distortions, background noise, or selective blur (e.g., CORD and FUNSD). This clean nature caused vision-heavy models like LayoutLMv3 to degrade slightly in certain full-shot setups. Additionally, the VLM exhibited a natural bias toward over-generating common document types (like memos) while undersampling highly specialized classes.
The authors note that future work should focus on integrating post-generation document degradation techniques (artificial aging, folding, camera blur) directly into the pipeline and implementing constrained sampling strategies to correct class imbalances.
Summary updated