Abstract
Donut (Document Understanding Transformer) is a novel, end-to-end Visual Document Understanding (VDU) model that eliminates the need for traditional Optical Character Recognition (OCR). By mapping document images directly to structured JSON outputs using a Transformer-based encoder-decoder architecture, it achieves state-of-the-art performance while being significantly faster and more flexible across different languages and domains. This paper presents the architecture, pre-training strategy using synthetic data (SynthDoG), and comprehensive evaluation across multiple benchmarks.
Introduction
Extracting information from document images—such as invoices, receipts, or business cards—has traditionally relied on a two-stage "sandwich" process. First, an off-the-shelf OCR engine detects and recognizes text. Second, a language model (e.g., BERT or LayoutLM) processes these text strings to extract semantic meaning.
This conventional approach suffers from high computational costs, inflexibility across languages, and error propagation where OCR inaccuracies compromise downstream performance. Donut proposes a paradigm shift: an OCR-free system that moves directly from pixels to structured data.
Methodology
Donut utilizes a clean, OCR-free architecture consisting of a visual encoder and a textual decoder.
Architecture
- Encoder (Swin Transformer): The encoder treats the document as a visual scene rather than a collection of characters, extracting high-level features from the raw image.
- Decoder (BART): A textual decoder translates these visual features into a sequence of subword tokens.
- Structured Output: Donut is specifically trained to generate tokens representing a structured JSON format (e.g.,
{"total_price": "50.00"}), effectively performing parsing and extraction in a single pass.
Pre-training and SynthDoG
To enable the model to "read" without explicit OCR, it is pre-trained on a massive dataset to predict the next word in a document image. To overcome the scarcity of high-quality, multi-lingual document data, the authors developed SynthDoG (Synthetic Document Generator). SynthDoG creates realistic documents by layering Wikipedia text onto diverse background images, simulating various textures and layouts across multiple languages.
Experimental Setup
The model was evaluated on several key benchmarks:
- Public Datasets: CORD (receipts), Ticket (Chinese train tickets), RVL-CDIP (classification), and DocVQA (visual question answering).
- In-Service Data: Private datasets for Japanese Business Cards and Korean Receipts.
- Data Scale: Pre-training involved 11 million scanned English documents and 0.5 million synthetic samples per language (English, Chinese, Japanese, Korean) via SynthDoG.
Key Insights and Results
Donut demonstrates that explicit character recognition is not a prerequisite for deep document understanding.
Performance and Efficiency
- State-of-the-Art Accuracy: Donut achieved a 95.3% accuracy on the RVL-CDIP classification task and outperformed LayoutLMv2 on receipt parsing (CORD).
- Speed and Memory: By skipping expensive text detection and recognition steps, Donut is approximately 2x faster than LayoutLMv2 and maintains a smaller memory footprint.
- Robustness: The model is highly data-efficient, achieving higher accuracy on the CORD dataset with only 10% of the training data compared to traditional OCR-based models. It also handles handwritten text more gracefully due to its purely vision-based nature.
Implicit Localization
While Donut is not explicitly trained with bounding boxes, visualizations of its cross-attention maps reveal that the decoder naturally "looks" at the relevant image regions when generating specific fields, indicating an emergent ability to localize information.
Conclusion and Future Work
Donut represents a significant advancement in VDU by proving the viability of OCR-free, end-to-end architectures. While highly effective, the model faces challenges with extremely small text in high-resolution documents due to Transformer scaling costs. Future research will focus on scaling the model to larger datasets and exploring advanced pre-training objectives to further enhance zero-shot capabilities.
Summary updated