Deepseek.ai is an independent website and is not affiliated with, sponsored by, or endorsed by Hangzhou DeepSeek Artificial Intelligence Co., Ltd.

    DeepSeek-OCR: AI-powered document understanding with context compression technology
    AI Technology

    12 min read

    DeepSeek-OCR: Revolutionary Context Compression Through Optical 2D Mapping

    AI TechnologyBy DeepSeek AI Research Team

    Abstract: A New Paradigm for Context Compression

    DeepSeek AI has unveiled DeepSeek-OCR, a groundbreaking approach to compressing long contexts via optical 2D mapping. This innovative system demonstrates that vision-based compression can achieve remarkable efficiency in handling text-heavy documents, potentially revolutionizing how large language models (LLMs) process extensive textual information.

    The DeepSeek-OCR system consists of two primary components: DeepEncoder and DeepSeek3B-MoE-A570M as the decoder. Together, they achieve an impressive 97% OCR precision when compressing text at a ratio of less than 10× (meaning 10 text tokens compressed into 1 vision token). Even at an aggressive 20× compression ratio, the system maintains approximately 60% accuracy.

    What Makes DeepSeek-OCR Revolutionary?

    1. Exceptional Compression Ratios with High Accuracy

    The core innovation of DeepSeek-OCR lies in its ability to compress textual information dramatically while maintaining high accuracy:

    • 96%+ OCR precision at 9-10× compression ratio
    • ~90% accuracy at 10-12× compression ratio
    • ~60% accuracy at 20× compression ratio

    These results demonstrate that compact language models can effectively decode compressed visual representations, suggesting that larger LLMs could readily acquire similar capabilities through appropriate pretraining design.

    2. DeepEncoder: 250M Parameters, Maximum Efficiency

    DeepEncoder is a lightweight yet powerful vision encoder with only 250 million parameters. It achieves an impressive 32× compression ratio while maintaining lossless performance. Key features include:

    • Serial connection of window attention and global attention encoder components
    • 16× convolutional compressor that reduces vision tokens before entering dense global attention
    • Multi-Head Latent Attention (MLA) mechanism for efficient cross-modal alignment
    • Ability to handle large images without GPU memory overflow
    • Effective memory and token compression for optimal performance

    3. State-of-the-Art Performance with Minimal Tokens

    On the OmniDocBench benchmark, DeepSeek-OCR achieves remarkable efficiency:

    • Surpasses GOT-OCR2.0 (which uses 256 tokens/page) using only 100 vision tokens
    • Outperforms MinerU2.0 (which averages 6000+ tokens per page) while utilizing fewer than 800 vision tokens
    • Achieves state-of-the-art performance among end-to-end models while using the fewest vision tokens

    4. Massive Production Scalability

    DeepSeek-OCR demonstrates exceptional real-world performance, capable of generating training data for LLMs and VLMs at an unprecedented scale:

    • 200,000+ pages per day with a single A100-40G GPU
    • 33 million pages per day using 20 nodes (160 A100-40G GPUs)
    • Practical deployment for large-scale document processing tasks

    The Technical Architecture Behind DeepSeek-OCR

    Vision Encoder Comparison

    Current open-source vision-language models (VLMs) employ three main types of vision encoders, each with distinct advantages and limitations:

    • Dual-tower architecture (e.g., Vary): Offers controllable parameters but requires complex dual image preprocessing
    • Tile-based methods (e.g., InternVL2.0): Reduces activation memory but can result in excessive fragmentation and numerous vision tokens
    • Adaptive resolution encoding (e.g., Qwen2-VL): Handles diverse resolutions flexibly but faces challenges with massive activation memory consumption

    DeepEncoder addresses these limitations by combining the best aspects of each approach while minimizing their drawbacks, achieving a balance between memory efficiency, token count, and processing capability.

    Multi-Resolution Support

    DeepEncoder is designed to support multiple resolutions efficiently, enabling it to process documents of varying sizes and complexities without sacrificing performance or requiring excessive computational resources.

    The MoE Decoder Architecture

    The decoder component utilizes DeepSeek3B-MoE-A570M, a mixture-of-experts architecture that provides efficient inference while maintaining high accuracy. This design enables the model to specialize in different aspects of OCR tasks while sharing knowledge across experts.

    Practical Applications and Use Cases

    Historical Document Compression

    DeepSeek-OCR shows considerable promise for research areas such as historical long-context compression, enabling efficient digitization and processing of archival materials without requiring massive storage or computational resources.

    Memory Mechanisms in LLMs

    The vision-text compression paradigm opens new possibilities for implementing memory forgetting mechanisms in LLMs, allowing models to efficiently store and retrieve historical context while managing computational constraints.

    Enhanced Document Parsing

    Beyond standard OCR, DeepSeek-OCR includes capabilities for parsing:

    • Charts and graphs with high accuracy
    • Chemical formulas and scientific notation
    • Simple geometric figures and diagrams
    • Natural images with embedded text
    • Multilingual documents across various languages

    Training Data Generation

    The model's ability to process 200,000+ pages daily on a single GPU makes it an ideal tool for generating high-quality training data for next-generation LLMs and VLMs at scale.

    A New Paradigm: "A Picture is Worth a Thousand Words"

    DeepSeek-OCR addresses a crucial research question that current models haven't adequately explored: "For a document containing 1000 words, how many vision tokens are at least needed for decoding?"

    The answer has profound implications for the fundamental principle that "a picture is worth a thousand words." DeepSeek-OCR demonstrates that a single image containing document text can represent rich information using substantially fewer tokens than the equivalent digital text, suggesting that optical compression through vision tokens can achieve much higher compression ratios than traditional text encoding.

    This paradigm shift reexamines vision-language models (VLMs) from an LLM-centric perspective, focusing on how vision encoders can enhance LLMs' efficiency in processing textual information rather than solely focusing on visual question answering (VQA) tasks.

    Data Engine and Training Pipeline

    Comprehensive Data Collection

    The DeepSeek-OCR data engine incorporates multiple data sources:

    • OCR 1.0 data: Traditional OCR datasets for baseline training
    • OCR 2.0 data: Advanced synthetic and real-world document data
    • General vision data: Diverse image datasets for broader visual understanding
    • Text-only data: Pure language data to enhance decoder capabilities

    Three-Stage Training Process

    The training pipeline follows a systematic three-stage approach:

    1. Pre-training DeepEncoder: First stage focuses on training the vision encoder to learn efficient visual representations and compression capabilities
    2. Pre-training Decoder: Second stage pre-trains the DeepSeek3B-MoE-A570M decoder to understand compressed visual tokens
    3. Supervised Fine-Tuning (SFT): Final stage fine-tunes the complete end-to-end system on high-quality OCR data for optimal document understanding

    Open Source Availability

    True to DeepSeek AI's commitment to open research, both the code and model weights for DeepSeek-OCR are publicly accessible at github.com/deepseek-ai/DeepSeek-OCR.

    This open-source release enables researchers and developers worldwide to:

    • Reproduce and validate the research findings
    • Build upon the DeepSeek-OCR architecture for custom applications
    • Contribute improvements and extensions to the community
    • Deploy the system for production use cases

    Conclusion: Toward More Efficient LLMs

    DeepSeek-OCR represents a significant step forward in addressing one of the most pressing challenges in modern AI: efficiently processing long textual contexts. By leveraging visual modality as a compression medium, the system demonstrates that substantial token reduction (7-20×) is achievable for different context stages while maintaining high accuracy.

    The quantitative analysis provided by DeepSeek-OCR offers empirical guidelines for optimizing VLM token allocation, while the DeepEncoder architecture showcases practical feasibility with real-world deployment capabilities. Although focused on OCR as a proof-of-concept, this paradigm opens new possibilities for rethinking how vision and language modalities can be synergistically combined to enhance computational efficiency in large-scale text processing and agent systems.

    As LLMs continue to grow in size and capability, innovations like DeepSeek-OCR will be crucial for making these powerful models more accessible, efficient, and practical for real-world applications. The future of AI may well depend on such creative approaches to the fundamental challenges of context management and computational efficiency.