Document generation has gained growing attention in the field of AI-driven content creation. In this work, we push its boundaries by introducing AnyDoc, a framework capable of handling multiple generation tasks across a wide spectrum of document categories, all represented in a unified HTML/CSS format. To overcome the limited coverage and scale of existing human-crafted document datasets, AnyDoc first establishes a scalable data synthesis pipeline to automatically generate documents in HTML/CSS form. This pipeline yields DocHTML, a large-scale dataset containing 265,206 document samples, while spanning 111 categories and 32 distinct styles. Additionally, all documents are equipped with comprehensive metadata, including design intentions, HTML/CSS source code, visual assets, and rendered screenshots. Building on the curated dataset, AnyDoc fine-tunes multi-modal large language models (MLLMs) to achieve three practical document generation tasks: intention-to-document, document derendering, and element-to-document. To address the content overflow issue observed during fine-tuning, AnyDoc further incorporates a height-aware reinforcement learning (HARL) post-training procedure. By defining a reward function based on the difference between predicted and target document heights, overflow is penalized and gradually mitigated during HARL, thereby enhancing overall performance. Qualitative and quantitative experiments demonstrate that AnyDoc outperforms both general-purpose MLLMs and task-specific baselines across all three tasks.
Figures & tables
Figure 2: Existing approaches generate documents as either (a) raster images or (b) flat element coordinate sequences. (c) In AnyDoc, we generate documents with a hierarchical and multi-layered HTML/CSS representation.
Figure 3: Overview of the HTML/CSS document synthesis pipeline. Starting from a human-crafted document and its accompanying metadata, we employ MLLMs to generate semantic annotations, i.e., the document’s intention and description. Based on the conditions, a code generation model and an image generation model are sequentially used to synthesize corresponding HTML/CSS code and image assets, which are finally rendered into the complete document screenshot.
Figure 4: The general multi-modal large language models (MLLMs) produce low-quality documents. Through supervised fine-tuning (SFT) on DocHTML, the model shows powerful document generation capabilities but still suffers from content overflow. Height-Aware Reinforcement Learning (HARL) is then adopted to overcome this issue while maintaining high visual quality.
Methods
Layout
Image
Typography
Content
Innovation
Ove
Ali
Height
Intention
Specialized Models
OpenCOLE
7.91
8.03
7.79
7.52
6.91
-
-
-
8.13
FLUX.1-dev
7.58
7.78
6.54
5.16
6.25
-
-
-
6.91
General MLLMs
InternVL3-78B
7.62
8.16
7.26
7.37
6.31
0.0286
0.0014
0.323
8.02
GPT-4o
8.59
8.75
8.32
8.41
7.27
0.2540
0.0020
0.047
8.96
Table 1: Quantitative results on the intention-to-document task.
Methods
Block
Text
Position
Color
CLIP
Ove
Ali
Height
Specialized Models
WebSight
0.838
0.902
0.755
0.797
0.796
0.0873
0.0019
0.438
Design2Code
0.909
0.989
0.732
0.651
0.758
0.3756
0.0010
0.652
General MLLMs
InternVL3-78B
0.910
0.952
0.788
0.757
0.792
0.0298
0.0012
0.134
GPT-4o
0.953
0.965
0.871
0.899
0.830
1.0009
0.0008
0.034
Table 2: Quantitative results on the document derendering task.
Figure 5: Qualitative results on the intention-to-document task. The corresponding input conditions (i.e., intention, category, and style) are displayed below each example. For reference, the ground truth (GT) documents are also visualized.
Methods
Layout
Image
Typography
Content
Innovation
Ove
Ali
Height
Specialized Models
LaDeCo
7.58
8.25
7.11
7.32
6.71
0.7150
0.0022
0
General MLLMs
InternVL3-78B
7.44
8.05
7.04
7.16
6.42
0.0124
0.0008
0.934
GPT-4o
8.09
8.38
7.90
7.79
6.87
0.2520
0.0017
0.212
Our Method
Table 3: Quantitative results on the element-to-document task.
Figure 6: Qualitative results on the document derendering task. D2C is Design2Code. Gradient images are used for image placeholders. AnyDoc produces highly accurate derendering results that closely resemble the input documents.
Format
Data
HARL
Layout
Image
Typography
Content
Innovation
Ove
Ali
Height
HTML/CSS
10K
✗
8.47
8.56
8.29
8.22
7.21
0.0542
0.0015
0.299
HTML/CSS
50K
✗
8.48
8.67
8.28
8.20
7.25
0.0822
0.0018
0.493
Flat
Full
✗
8.43
8.55
8.08
8.15
7.21
0.2627
0.0015
0
HTML/CSS
Full
✗
8.50
8.61
8.30
8.27
7.25
0.1091
0.0017
0.392
HTML/CSS
Full
✓
8.62
8.73
8.39
8.34
7.36
0.0494
0.0021
0.085
Table 4: Ablation studies results. We conduct these experiments on the E2D task. Flat denotes the flat coordinate representation in [ 22 ] .
Figure 7: Qualitative results on the element-to-document task. The elements in the ground truth documents serve as the model input. AnyDoc combines the input individual elements into a high-quality document output.
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 8: Distributions of document categories and styles in DocHTML.
Figure 9: Distributions of document element count and document aspect ratio in DocHTML.
Figure 10: More qualitative results on the intention-to-document task.
Figure 11: More qualitative results on the document derendering task.
Figure 12: More qualitative results on the element-to-document task.
Effective document intelligence models rely on large amounts of annotated training data. However, procuring sufficient and high-quality data poses significant challenges due to the labor-intensive and costly nature of data acquisition. Additionally, leveraging language models to annotate real documents raises concerns about data privacy. Synthetic document generation has emerged as a promising, privacy-preserving alternative. We propose DocDjinn, a novel framework for controllable synthetic document generation using Vision-Language Models (VLMs) that produces annotated documents from unlabeled seed samples. Our approach generates visually plausible and semantically consistent synthetic documents that follow the distribution of an existing source dataset through clustering-based seed selection with parametrized sampling. By enriching documents with realistic diffusion-based handwriting and contextual visual elements via semantic-visual decoupling, we generate diverse, high-quality annotated synthetic documents. We evaluate across eleven benchmarks spanning key information extraction, question answering, document classification, and document layout analysis. To our knowledge, this is the first work demonstrating that VLMs can generate faithful annotated document datasets at scale from unlabeled seeds that can effectively enrich or approximate real, manually annotated data for diverse document understanding tasks. We show that with only 100 real training samples, our framework achieves on average 87% of the performance of the full real-world dataset. We publicly release our code and 140k+ synthetic document samples.
RheinMain University of Applied Sciences, Wiesbaden, Germany · German Research Center for Artificial Intelligence, Kaiserslautern, Germany · DeepReader GmbH, Kaiserslautern, Germany +2
Document parsing has recently advanced with multimodal large language models (MLLMs) that directly map document images to structured outputs. Traditional cascaded pipelines depend on precise layout analysis and often fail under casually captured or non-standard conditions. Although end-to-end approaches mitigate this dependency, they still exhibit repetitive, hallucinated, and structurally inconsistent predictions - primarily due to the scarcity of large-scale, high-quality full-page (document-level) end-to-end parsing data and the lack of structure-aware training strategies. To address these challenges, we propose a data-training co-design framework for robust end-to-end document parsing. A Realistic Scene Synthesis strategy constructs large-scale, structurally diverse full-page end-to-end supervision by composing layout templates with rich document elements, while a Document-Aware Training Recipe introduces progressive learning and structure-token optimization to enhance structural fidelity and decoding stability. We further build Wild-OmniDocBench, a benchmark derived from real-world captured documents for robustness evaluation. Integrated into a 1B-parameter MLLM, our method achieves superior accuracy and robustness across both scanned/digital and real-world captured scenarios. All models, data synthesis pipelines, and benchmarks will be publicly released to advance future research in document understanding.
Gengluo Li, Pengyuan Lyu, Chengquan Zhang +7
Institute of Information Engineering, Chinese Academy of Sciences · University of Chinese Academy of Sciences · Tencent +2
Creating universal, high-quality representations of web documents in high-traffic industrial environments requires models that are both performant and economic. Existing approaches, however, often depend on large models, overlook the structural information inherent in HTML, or are constrained by short context windows, limiting their ability to process real-world web pages. We present HTML-LM, a compact foundation model with 154 million parameters that addresses these limitations through HTML-aware training and a ModernBERT-based architecture. It was trained on 100 million web documents using multiple objectives, including masked language modeling, bag-of-words prediction, and contrastive distillation from large language models. Consequently, HTML-LM sets a new state-of-the-art for classification and regression applications in the Czech Internet domain, surpassing both larger encoders and small-sized LLMs. The model is deployed in production, processing thousands of web documents per second, and released to the community under the CC BY-NC 4.0. https://huggingface.co/Seznam/html-lm.