Back to paper library
Paper notesarXiv 2026

DeepSeek-OCR 2

Where the Eye Goes Next

Original paper

DeepSeek-OCR 2: Visual Causal Flow

Paper authors

Haoran Wei · Yaofeng Sun · Yukun Li

Publication
Publication venue not yet verified
First submitted to arXiv
arXiv:2601.20552
Cite this paper · BibTeX

The citation identifies the linked source version. It cites the original paper and its authors.

@misc{deepseekdeepseekocr22026,
  title = {{DeepSeek-OCR 2: Visual Causal Flow}},
  author = {Haoran Wei and Yaofeng Sun and Yukun Li},
  year = {2026},
  eprint = {2601.20552},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2601.20552}
}
On this page

How does a person read a three-column newspaper?

We don't sweep from the top-left corner straight down to the bottom-right. We read the headline first, then follow the first column down; at the bottom we jump back up to the top of the second column; when we see “continued on page 5,” our eyes jump there. Where we look next depends on what we just read.

VLMs don't read that way. The image is cut into a grid of patches, laid out in one row in a fixed “left to right, top to bottom” order, given positional encodings, and handed to the language model. For ordinary photos that works fine; for documents with complex layouts, this order often differs from the logical order of the content.

DeepSeek-OCR 2 wants the encoder to decide for itself where to look first and where to look next. It is a technical report that DeepSeek-AI uploaded on January 28, 2026, with the code and weights open-sourced at the same time.

Defining the Problem

The authors note that human eye movements are causal, with each next fixation depending on what came before; yet today's VLM encoders flatten a 2D image into a 1D sequence in a fixed order that has nothing to do with the content.

Language models are trained on one-dimensional, ordered text. So the authors wanted to know whether two stages of “one-dimensional, causally ordered” reasoning, chained together, could handle a two-dimensional image.

  • The first stage is in the encoder: rearrange the vision tokens into a reading order based on the image content.
  • The second stage is in the decoder: output text autoregressively in that order.

They use document reading as the testing ground, because documents have multi-column layouts, formulas, and tables, and their reading order carries a logic of its own.

Solving the Problem

Swapping CLIP for a Language Model

Left: DeepEncoder, an 80M Tokenizer followed by CLIP ViT 300M; right: DeepEncoder V2, the same Tokenizer followed by a language model based on Qwen2 500M, with a set of learnable queries appended after the vision tokens; only the outputs of the queries are passed on
Figure 1 from the paper, excerpted from page 1 of the v1 PDF, CC BY 4.0. The previous DeepEncoder is on the left, DeepEncoder V2 on the right.

The upper halves of both sides are the same, each a Tokenizer of about 80 million parameters that reuses the previous generation's SAM-base plus two convolutional layers to compress the token count to one sixteenth.

The difference is in the lower half. The previous generation used a 300-million-parameter CLIP for global attention; V2 replaces it with a language-model architecture initialized from Qwen2-0.5B and appends a set of learnable queries after the vision tokens (the authors call them causal flow tokens).

There are as many queries as vision tokens. In the end, only the query half of the output goes to the decoder; the vision tokens themselves are not passed on.

The authors also tried another arrangement, putting the vision tokens in a separate encoder and letting the queries read them through cross-attention, an encoder–decoder structure like mBART's. Training failed to converge. Their guess is that, isolated in another encoder, the vision tokens didn't interact enough with the queries; only after the vision tokens became a prefix in the same sequence, where every layer can exchange information, did training work.

The Mask Decides Who Sees Whom

Attention mask illustration: a ViT-style bidirectional mask and an LM-style causal mask combine into the DeepEncoder V2 mask; in the first three rows, the vision tokens see one another, and in the last three rows, the queries can see all the vision tokens and the queries before them
Figure 5 from the paper, excerpted from page 7 of the v1 PDF, CC BY 4.0. Green means attention is allowed, pink means it is blocked, and white circles mark the token itself.

This figure is the heart of the design. Let's walk through it with three vision tokens v0,v1,v2v_0,v_1,v_2 and three queries q0,q1,q2q_0,q_1,q_2. Rows are “who is looking,” columns are “what is being looked at,” and 1 means attention is allowed:

text
       v0 v1 v2 | q0 q1 q2
v0      1  1  1 |  0  0  0
v1      1  1  1 |  0  0  0
v2      1  1  1 |  0  0  0
----------------+---------
q0      1  1  1 |  1  0  0
q1      1  1  1 |  1  1  0
q2      1  1  1 |  1  1  1
  • Top left: the vision tokens all see one another. This is bidirectional attention, as in ViT, and it keeps CLIP's whole-image view.
  • Top right: the vision tokens can't see the queries, so the image features aren't affected by the order of the queries.
  • Bottom left: every query can see all the vision tokens.
  • Bottom right: among the queries, the mask is lower-triangular; q1q_1 sees only q0q_0 and itself, the same causal attention as in a decoder-only language model.

The paper writes the mask as:

M=[1m×m0m×n1n×mLowerTri(n)],n=mM=\begin{bmatrix}\mathbf{1}_{m\times m} & \mathbf{0}_{m\times n}\\ \mathbf{1}_{n\times m} & \mathrm{LowerTri}(n)\end{bmatrix},\quad n=m

The lower triangle in the bottom right is where the “order” comes from. q0q_0 decides first what to take from the image; q1q_1, knowing what q0q_0 took, decides what comes next; and so on. Lined up in a row, the outputs of the queries are themselves a reading order.

The authors write the whole process as:

O=D(πQ(TL(E(I)⊕Q0;M)))\mathbf{O}=\mathcal{D}\big(\pi_Q(\mathcal{T}^L(\mathcal{E}(\mathbf{I})\oplus\mathbf{Q}_0;\mathbf{M}))\big)

E\mathcal{E} is the Tokenizer, ⊕\oplus concatenates the vision tokens and the queries, TL\mathcal{T}^L is an LL-layer masked Transformer, πQ\pi_Q keeps only the last nn outputs, that is, the outputs of the queries, and D\mathcal{D} is the decoder.

How Many Tokens Does a Page Take?

To avoid preparing a separate set of queries for every resolution, the authors fix two views:

  • Global view at 1024×1024: 1024/16 = 64, and 64×64 = 4,096 patches; compressed sixteenfold, that is 256 tokens, paired with 256 queries.
  • Local crops at 768×768: 768/16 = 48, and 48×48 = 2,304 patches; after compression, 144 tokens, with every crop sharing the same set of 144 queries.

The number of crops kk ranges from 0 to 6, and there is no cropping when both sides are smaller than 768. So the decoder receives 144k+256144k+256 tokens, at least 256 and at most 6×144+256=1,1206\times144+256=1{,}120.

The authors specifically compare the upper limit with the previous generation's Gundam mode, which goes up to 1,156, and with Gemini 3 Pro, whose vision-token cap is also 1,120.

The decoder is unchanged: it is still the previous generation's 3B MoE, activating about 500 million parameters.

Training

The data sources are the same as for the previous generation, with OCR data making up 80%; only two small adjustments were made. OCR 1.0 data is split by content into text, formulas, and tables and sampled at 3:1:1; and in the layout annotations, semantically similar categories are merged, such as figure captions and figure titles.

Training has three stages:

  1. Encoder pretraining: the Tokenizer is carried over from the previous generation, and the LM-style encoder is initialized from Qwen2-0.5B-base and paired with a small decoder for next-token prediction. 160 A100s, about 100 million image-text pairs.
  2. Query enhancement: the Tokenizer is frozen, and the encoder and the DeepSeek decoder are trained together to strengthen the queries' ability to reorder.
  3. Decoder specialization: the whole encoder is frozen and only the decoder is trained. At the same batch size, training runs more than twice as fast.

Discussion

OmniDocBench v1.5

The main evaluation is OmniDocBench v1.5: 1,355 pages across 9 document types, in both Chinese and English.

Table: Excerpted from Table 1 of the paper. ED is edit distance, where lower is better; for Overall, higher is better.
ModelVision-token capOverallText EDReading-order ED
DeepSeek-OCR (9 crops)1,15687.360.0730.085
DeepSeek-OCR 21,12091.090.0480.057

With similar data sources, the overall score rises by 3.73, and the reading-order edit distance falls from 0.085 to 0.057. In Table 2, the authors also compare overall edit distance with Gemini 3 Pro under the same 1,120-token cap, where DeepSeek-OCR 2 scores 0.100 and Gemini 3 Pro 0.115.

The same Table 1 also includes two other rivals. PaddleOCR-VL scores 92.86 and MinerU2.5 90.67; both do layout analysis first and then recognize cropped regions, and the paper puts them in the Pipeline category. In other words, on this benchmark, the end-to-end DeepSeek-OCR 2 has come very close to the two-stage systems but hasn't yet passed the best of them.

The Nine Document Types, One by One

Table 3 breaks down both generations' results across the nine document types. Reading-order edit distance improves in all nine categories; for example, colorful textbooks go from 0.125 to 0.066, and notes from 0.089 to 0.035.

Text edit distance is less consistent. Most categories improve, but books go from 0.022 to 0.033 and newspapers from 0.131 to 0.139. The authors trace the newspaper regression to the lower vision-token cap, which isn't enough for extremely text-heavy newspaper pages and which more crops could address in the future, and to having only 250,000 newspaper training samples, too few for the new encoder.

What to Watch in Production

This section is short, but it is the most practical part of the whole paper.

Inside the company, DeepSeek-OCR reads the images and documents that users upload for DeepSeek's language models, and batch-processes PDFs to produce pretraining data. Production has no ground truth to compare against, so the authors use the repetition rate as the primary observable quality metric:

Table: Table 4 of the paper; a lower repetition rate is better.
ModelOnline user imagesPretraining PDFs
DeepSeek-OCR6.25%3.69%
DeepSeek-OCR 24.17%2.88%

Repetition, where the same passage keeps coming out, is the most easily observed failure of generative OCR; a program catches it at once.

The flip side is that without ground truth, errors of the “fluent but wrong” kind are invisible to the repetition rate. If OCR output is used to make decisions, production monitoring needs separate methods that can see such errors, such as comparing against the text layer, checking field formats, or sampling outputs for human review.

The Authors' Vision and Later Results

In the discussion section, the authors think bigger, suggesting that a causal encoder that reorders what it sees, followed by a causal decoder that does the task reasoning, might turn two stages of one-dimensional reasoning into “genuine 2D reasoning.” They also envision the same LM-style encoder handling images, audio, and text just by swapping in a different set of queries. For now, these are only prospects; the paper validates the design only on document reading.

OmniDocBench was later revised to v1.6, adding 296 harder samples. On the official leaderboard, DeepSeek-OCR 2 scores 90.25; the top five are a group of specialized models of around one billion parameters, the best of them scoring about 97. OmniDocBench README

Conclusion

DeepSeek-OCR 2 makes one focused change, replacing only the back half of the encoder so that a set of learnable queries reads the image in sequence and rearranges the vision tokens into reading order.

  1. The mask design is the key. The vision tokens see one another bidirectionally, the queries attend causally among themselves, and only the outputs of the queries are passed on.
  2. Reading order improves across the board. On OmniDocBench v1.5, reading-order edit distance falls from 0.085 to 0.057, and all nine document types improve.
  3. Text recognition doesn't improve in every category. Text edit distance for books and newspapers actually rises slightly; newspapers are held back by the token cap and the training data.
  4. The production metric sees only repetition. The repetition rate falls from 6.25% to 4.17%, but this metric can't see fluent misreadings.

Handing reading order to a set of queries that look at the image in sequence is a very intuitive idea. It makes the model read documents more the way a person does; whether the characters it reads were seen clearly or filled in from context still has to be checked separately.