Back to paper library
Paper notesarXiv 2024Findings of EMNLP 2024

DocOwl 1.5

The Owl Learns Layout

Original paper

mPLUG-DocOwl 1.5: Unified Structure Learning for OCR-free Document Understanding

Paper authors

Anwen Hu · Haiyang Xu · Jiabo Ye …

Show all 11 authors

Anwen Hu · Haiyang Xu · Jiabo Ye · Ming Yan · Liang Zhang · Bo Zhang · Chen Li · Ji Zhang · Qin Jin · Fei Huang · Jingren Zhou

Publication
Findings of EMNLP 2024Conference
First submitted to arXiv
arXiv:2403.12895
Cite this paper · BibTeX

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

@misc{documentunderstandingdocowl152024,
  title = {{mPLUG-DocOwl 1.5: Unified Structure Learning for OCR-free Document Understanding}},
  author = {Anwen Hu and Haiyang Xu and Jiabo Ye and Ming Yan and Liang Zhang and Bo Zhang and Chen Li and Ji Zhang and Qin Jin and Fei Huang and Jingren Zhou},
  year = {2024},
  eprint = {2403.12895},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.12895}
}
On this page

On the form below, the value filled in after “Response Code Assigned” is W24. To answer “What is the assigned response code?”, a model first has to find this field name and then read the value on the underline to its right.

Original Figure 2: six examples that need structural information to answer. (a) A response code request confirmation form, zoomed in on the “Response Code Assigned: W24” field; (b) a comparison table of Windows Server editions, asking which edition has unlimited Remote Desktop Services and virtualization rights, answer Datacenter; (c) a screenshot of a paper's web page, asking for the title of the paper on the page; (d) an infographic on teens' internet use, asking what share of 12- to 17-year-olds didn't use the internet, answer 5%; (e) a bar chart, asking for the forecast of customs duty revenue in 2030, answer 100; (f) a pie chart, asking for the share of Iraqi dependents, answer 0.19.
Original Figure 2, Hu et al., from PDF page 2, arXiv license, scholarly quotation.

The other examples work the same way. In a table, you find a value where a row and a column cross; in the bar chart, you match the rightmost bar back to the y-axis; in the pie chart, you pair the “Dependents” slice with the percentage beside it. Reading out the words on the page isn't enough; the answer lies in how the words are arranged relative to one another.

The paper comes from Alibaba's mPLUG team, which earlier built the general multimodal models mPLUG-Owl and mPLUG-Owl2 as well as the document-reading mPLUG-DocOwl and UReader. The Owl in the name is just that, an owl, and the one answering questions in the paper's figures is a little owl hugging a book. What version 1.5 sets out to do is teach this owl to read layout.

Defining the Problem

Multimodal large language models (MLLMs) of the time had a standard structure: a vision encoder (usually CLIP's ViT-L/14), a module that moves visual features into the language space, and then a large language model. The authors call the module in the middle the vision-to-text module, or V2T.

The trouble is that the first two components were trained on natural images and captions and were never asked to understand the text and structure of a document page.

Take V2T first. The mainstream splits into two camps, each with its own problems:

  • Direct projection, such as the MLP in LLaVA. Every visual feature goes into the language model as is, so all the spatial information is kept, but the sequence is too long. Encoding a 1344×13441344 \times 1344 image with ViT-L/14 yields 96×96=9,21696 \times 96 = 9{,}216 visual tokens.
  • Learnable queries, such as BLIP-2's Q-Former, Flamingo's Perceiver Resampler, or mPLUG-Owl's Abstractor. A fixed number of query vectors attend to all the visual features, which shortens the sequence at once, but where each feature originally sat on the page may get lost in the fusion.

Next, the training tasks. An OCR-free document model has to learn to read text first. Donut pretrains by writing out the text in reading order, which flattens the structure entirely; Pix2Struct turns web page screenshots back into an HTML DOM tree, which captures structure, but only web pages come with HTML source. Several later MLLMs added text-reading tasks too, which likewise read only the text and ignore structure, or cover only one or two image types, such as web pages or documents.

What the authors want is structure learning that works across all image types, plus a V2T module that shortens the sequence without scrambling spatial relationships.

Solving the Problem

Original Figure 3: (a) two-stage training. Stage one, Unified Structure Learning, covers document parsing, table parsing, chart parsing, natural image parsing, and multi-grained text localization, with the LLM frozen and the H-Reducer and ViT trainable; stage two, Multi-task Tuning, covers VQA, information extraction, image captioning, and natural language inference, with the LLM and H-Reducer trainable and the ViT frozen. (b) The overall architecture. An infographic is cut by the Shape-Adaptive Cropping Module into six sub-images I1 to I6, plus a downscaled global image I0; each image passes through the Visual Encoder to give V0 to V6 and then through the H-Reducer to give V̂0 to V̂6. The global image is preceded by a global-img marker and the sub-images by position markers T1 to T6, from row1-col1 to row2-col3; together with the question X, they go into the large language model with MAM, which answers that Twitter has more active users than Pinterest. On the right, a close-up of the H-Reducer: a 1×4 convolution merges four adjacent cells in the same row of Vi's feature grid into one, giving V̄i, which is flattened and passed through an FC layer to give V̂i.
Original Figure 3, Hu et al., from PDF page 5, arXiv license, scholarly quotation.

The top half is the training procedure and the bottom half the model. Start with the bottom half and follow one image through it.

Cropping

Documents are often big and long, and shrinking one straight down to 448×448448 \times 448 turns it into a blur. DocOwl 1.5 reuses UReader's Shape-adaptive Cropping Module: based on the image's aspect ratio, it picks one of a set of predefined grids and cuts the image into at most 9 sub-images of 448×448448 \times 448. The whole image is also downscaled into one global image to keep the overall layout.

The example in the figure is an infographic cut into 2 rows and 3 columns, 6 pieces in all, which with the global image makes 7 images. With the maximum of 9 sub-images, the whole image comes to roughly 1344×13441344 \times 1344 resolution.

Each sub-image goes through ViT-L/14 separately. Since 448/14=32448 / 14 = 32, each image yields 32×32=1,02432 \times 32 = 1{,}024 visual features. Nine sub-images plus one global image make 10,240.

H-Reducer: Merge Horizontally

10,240 tokens is too long for a 7B language model. The H-Reducer's answer is one convolution layer plus one fully connected layer.

Both the kernel and the stride are 1×41 \times 4, meaning that within the same row, 4 horizontally adjacent features are merged into 1, with as many output channels as input channels, DD. As an equation:

vˉi j=f(vi4j−3, vi4j−2, vi4j−1, vi4j)j=1,…,L/4\begin{aligned} \bar{v}_i^{\,j} &= f\big(v_i^{4j-3},\ v_i^{4j-2},\ v_i^{4j-1},\ v_i^{4j}\big) \\ j &= 1, \dots, L/4 \end{aligned}

vikv_i^{k} is the kk-th visual feature of image ii, ff is the convolution kernel's weighted sum over all channels, and LL is the original number of features. After merging, a fully connected layer projects the result into the language model's embedding space.

Work it out for one sub-image:

  • ViT output: 32×32=1,02432 \times 32 = 1{,}024 features.
  • 1×41 \times 4 convolution: each row's 32 become 8, giving 32×8=25632 \times 8 = 256.
  • All 10 images: 10×256=2,56010 \times 256 = 2{,}560 visual tokens.

Why horizontal? The authors' reasoning is that text in documents mostly runs left to right, so horizontally adjacent features on the same line are usually semantically continuous. On a 448-pixel-wide sub-image, 4 patches form a strip 56 pixels wide and 14 pixels tall, roughly a few letters of a line of text; merging them amounts to compressing a short stretch of text into one token.

Compared with learnable queries, the convolution looks only locally, and the jj-th output always corresponds to a fixed position in the same row of the original image, so spatial relationships stay intact. Compared with an MLP, the sequence is four times shorter.

Sub-Image Positions Written as Text

After cropping, the language model needs to know where each piece sits in the original image. UReader adds a learnable position embedding to each piece; DocOwl 1.5 instead inserts a text token directly in front of each piece's visual features, such as <row1_col2>, and <global_img> for the global image.

This adds no parameters at all, and the language model already understands text like this. In the ablations, this change does slightly better than the learnable embedding.

On the language model side, it reuses mPLUG-Owl2's Modality-adaptive Module (MAM). In self-attention, visual features and text each get their own set of key/value projections, so the language model can tell which is image and which is text. The whole model is initialized from mPLUG-Owl2 and has 8.1 billion parameters.

Five Image Types, Two Kinds of Tasks

With the model in place, next comes the main course of this paper, Unified Structure Learning, which applies structure learning tasks uniformly to five image types: documents, web pages, tables, charts, and natural images.

Original Figure 4: the Unified Structure Learning tasks arranged around the DocOwl 1.5 model. Document parsing takes a screenshot of a university web page and outputs doc-tagged text split into lines by newline characters; natural image parsing takes a photo of soccer players celebrating and outputs a description followed by QATAR AIRWAYS in ocr tags; table parsing outputs a Markdown table in md tags, with COLSPAN=2 in the header; chart parsing turns a horizontal bar chart into a Markdown data table; text recognition takes bbox coordinates and outputs the text in that region; text grounding takes a piece of text and outputs its bbox coordinates.
Original Figure 4, Hu et al., from PDF page 6, arXiv license, scholarly quotation.

The first kind is structure-aware parsing, with its own way of writing structure for each image type:

  • Documents and web pages: write out the text in reading order, with newlines marking line breaks and spaces marking horizontal distance; the farther apart, the more spaces, up to 4 in a row. Data with PDFs is generated directly with pdfplumber; for data without PDFs, newlines and spaces are inserted by comparing the horizontal and vertical distances between text boxes.
  • Tables: written in Markdown, with rows separated by newlines and columns by vertical bars. Markdown itself can't express merged cells, so the authors put special tokens such as <COLSPAN=x> or <ROWSPAN=y> in front of the value. HTML can express any table, but its paired <tr> and <td> tags make it too long. The data comes from Wikipedia's TURL and PubTabNet.
  • Charts: a chart is just a data table drawn as a picture, so it is parsed back into a Markdown data table, and the model has to map each bar back to its category and value on the axes. Values are always kept to 4 significant digits so the model doesn't guess at decimals that can't be seen on the chart.
  • Natural images: a one-sentence description followed by the text in the image, for example “emotional players celebrate at the final whistle…” followed by <ocr> QATAR AIRWAYS </ocr>.

The second kind is multi-grained text localization, split into two tasks running in opposite directions. Text grounding gives a piece of text and asks the model for its box; text recognition gives a box and asks the model to read the text in it. Text comes at four granularities: word, phrase, line, and block. Box coordinates are normalized and then discretized into position tokens from 0 to 999. Text that is too small, or that appears more than once in the same image, is excluded so that the answer is unique.

All the data for these tasks comes from public datasets; the authors regenerated the target sequences and compiled them into DocStruct4M.

Learn to See, Then Learn to Answer

Training has two stages (top half of Figure 3):

  1. Structure learning: train the ViT, H-Reducer, and MAM on DocStruct4M with the language model frozen. The authors' judgment is that LLMs can already read structured text, and the bottleneck is on the vision side. 12,000 iterations with a batch size of 1,024, about 128 A100-days.
  2. Multi-task fine-tuning: fine-tune jointly on the training sets of ten downstream tasks, including DocVQA, InfoVQA, ChartQA, and TextVQA, this time freezing the ViT and training everything else. About 24 A100-days.

There is also a Chat version. The authors put questions from DocVQA and other datasets to GPT-3.5 and GPT-4V, asked them for detailed explanations, and then used GPT-3.5 to check whether the answers agreed with the human labels, keeping 25,877 examples, called DocReason25K. Fine-tuning on this data together with the downstream data gives DocOwl 1.5-Chat, which can answer briefly or explain at length.

Discussion

Ten Benchmarks

The main results compare across ten benchmarks covering documents (DocVQA, InfoVQA, DeepForm, KLC), tables (WTQ, TabFact), charts (ChartQA), natural images (TextVQA, TextCaps), and web pages (VisualMRC). The baselines are of two kinds: specialized models with a few hundred million parameters, fine-tuned separately for each task, and MLLMs of 7B and up.

Here are three of the benchmarks (Table 3 of the paper):

ModelParamsDocVQAInfoVQAChartQA
Donut<1B67.511.641.8
Pix2Struct-large1.3B76.640.058.6
Qwen-VL9.6B65.135.465.7
UReader7.1B65.442.259.3
CogAgent17.3B81.644.568.4
DocOwl 1.58.1B81.650.470.5

The two table benchmarks are listed separately:

ModelWTQTabFact
Donut18.854.6
UReader29.467.6
DocOwl 1.539.880.4

A few things can be read from the tables:

  1. MLLMs of the time still couldn't beat small models. Qwen-VL and UReader have five to seven times the parameters of Pix2Struct-large, yet score more than ten points lower on DocVQA. The authors take this as evidence that document understanding is still a weak spot for MLLMs.
  2. DocOwl 1.5 leads across the board at its size. Against the team's own earlier UReader, DocVQA goes from 65.4 to 81.6, TabFact from 67.6 to 80.4, and WTQ gains ten points.
  3. Against CogAgent, twice its size, it ties on DocVQA (81.6) and leads on InfoVQA and ChartQA; on TextVQA, for natural images, it's 68.8 versus 76.1, a 7.3-point loss. The authors attribute this to CogAgent's 98 million scene text recognition samples, while DocStruct4M has only about 1 million natural images.

One more thing to note: Donut and Pix2Struct fine-tune a separate model for each task, whereas DocOwl 1.5 is a single model doing all ten tasks, and the training sets of all ten tasks went into the second-stage fine-tuning.

Ablations: What Each Step Adds

The ablations are run on three validation sets, DocVQA, TabFact, and ChartQA (Table 4 of the paper). Reading them in order:

  1. Stronger initialization (mPLUG-Owl swapped for Owl2): DocVQA 65.4 → 66.3.
  2. Unfreezing the ViT during fine-tuning: 66.3 → 71.4, 5 points more. The authors treat this as evidence that “the visual representation is the bottleneck,” and it is the motivation for designing structure learning.
  3. Cutting sub-images from 20 to 9: the Abstractor drops to 68.0; switching to H-Reducer(1×4) instead rises to 72.8. With fewer sub-images and lower total resolution, the H-Reducer still beats the Abstractor.
  4. Merge shape: 1×4 gives DocVQA 72.8, TabFact 72.9, ChartQA 65.0; 2×2 gives 71.8, 72.1, 65.2. 1×4 is better for documents and tables, while the square edges ahead on charts. The authors' explanation is that bars, lines, and pie slices aren't laid out left to right. Stretching further to 1×8 or 2×8 shortens the sequence more, and the scores drop with it.
  5. Adding structure learning (language model frozen): DocVQA 72.8 → 77.7, TabFact 72.9 → 76.5, ChartQA 65.0 → 67.5. On DocVQA alone, step 2's ViT unfreezing gains slightly more, 5.1 points; summed over the three benchmarks, this step is the biggest in the whole table.
  6. Unfreezing the LLM in stage two: 77.7 → 78.9, only 1.2 points more; the authors say language knowledge isn't the main obstacle.
  7. Text tokens for sub-image positions: 78.9 → 79.8.
  8. Adding multi-grained text localization: 79.8 → 81.6, and TabFact 77.7 → 80.4.

The authors also compared one-stage and two-stage training. With the LLM frozen and DocStruct4M mixed directly into the downstream data, DocVQA rises with more structure data from 72.8 to 78.6 (at 1 million samples) and then barely moves: using all 4 million gives 78.9 and costs 180 A100-days. Two-stage training with the same 4 million reaches 79.9 on DocVQA at only 144.8 A100-days.

The authors also measured directly whether the H-Reducer preserves position. They built DocLocal4K, a text localization test set of 4,250 samples; with the same 1,800 training iterations, the overall text grounding score (IoU 0.5) is 37.69 for the Abstractor, 43.94 for H-Reducer(2×2), and 48.28 for H-Reducer(1×4).

“Another Correct Answer”

Among the paper's qualitative results is a question on the Windows Server comparison table from Figure 2(b) at the start: which edition has both unlimited Remote Desktop Services and virtualization rights. The ground truth is Datacenter; DocOwl 1.5 answers Standard. The paper says that “although inconsistent with the ground truth, DocOwl 1.5 gives another correct answer with the help of stronger structure understanding on tables.”

Here is that table again:

Original Figure 2(b): a specification comparison table of Windows Server editions, with columns Foundation, Essentials, Standard, and Datacenter. In the Remote Desktop Services limits row, both Standard and Datacenter are Unlimited; in the next row, Virtualization rights, Standard has 2 VMs and Datacenter is Unlimited. Below are the question and the answer, Datacenter.
Original Figure 2 (b), Hu et al., from PDF page 2, arXiv license, scholarly quotation.

In the Remote Desktop Services row, Standard is indeed Unlimited; but in the next row, virtualization rights, Standard has only 2 VMs. The question asks for both to be unlimited, and only Datacenter qualifies (another correct answer, half right). The model answered after looking at a single row, which is exactly the structure understanding problem this paper sets out to solve.

Convincingly Made Up

For the Chat version's long explanations, the authors honestly include a failure case too.

Original Figure 8(c): the cover of HYPE, a South African hip-hop magazine, with two areas zoomed in. The masthead reads South Africa's No.1 Hip Hop Magazine; below it, a headline reads RAP ECONOMIX, with the subhead South African rappers are lazy. They're all lazy. All of them. P24. The user asks which nationality of rappers is lazy and requests a detailed explanation. DocOwl 1.5-Chat answers South African rappers; the first half correctly quotes the cover text and the magazine's name, while the second half, in red, is hallucinated, saying the article discusses how they rely on Kool & the Gang's Stayin' Alive instead of creating their own music, and that this view is changing.
Original Figure 8 (c), Hu et al., from PDF page 15, arXiv license, scholarly quotation.

The cover has only a headline and a one-line quote, yet the model invented a complete argument and ending for the article; everything in red is hallucinated. The longer and more fluent the explanation, the harder it is for readers to tell which sentences were actually read from the image. The authors leave hallucination to future work.

After Releasing Everything

This team is generous with open source. Nine days after the paper went up, DocStruct4M, the downstream data, DocReason25K, and four model checkpoints were all on Hugging Face and ModelScope; a little over a month later, the training code was released too. And because the data is available, its problems are visible.

  • Labels in the wrong order: in April 2024, a user reported that text order at inference was often reversed, and tracing it back found that DocStruct4M's text localization data had many labels in the wrong order in its TextVQA and ChartQA subsets. The first author replied in agreement: the text had been sorted by box coordinates rather than reading order, and with text in natural images running in so many directions, it is hard to fix.
  • Duplicated data: in the training file of the downstream data DocDownstream-1.0, every DocVQA sample appears three times, and DeepForm, InfoVQA, and others twice. Someone asked in August 2024 whether this was intentional and got no reply.
  • Worse at reading long text than stage one: someone used the Chat version to transcribe a whole section of a paper, and the output stopped halfway. The authors replied that DocOwl 1.5 and Chat were fine-tuned mainly on QA data, so they read text less well than the stage-one model; for transcription, use the stage1 or Omni version.

Also, the model only knows English. Non-English PDFs were thrown out when the data was built, and asking it about a Chinese document gets repeated fragments back. In early April 2024 a maintainer said the Chinese version was “scheduled for release within this month”; at the end of the month the maintainer backtracked, citing tight resources and pushing it to mid-May (May 2024, that is). What the team later published in the same repo was DocOwl2, for multi-page documents; the README has no news of a Chinese version.

Conclusion

DocOwl 1.5 does two things. One is unifying structure learning across five image types: spaces and newlines for documents, Markdown with merge markers for tables, charts parsed back into data tables, plus text localization at four granularities from word to block. The other is the H-Reducer, a single 1×41 \times 4 convolution that compresses each sub-image's 1,024 visual features to 256 while keeping each feature's position on the page. In the ablations, structure learning alone adds nearly 5 points on DocVQA.

It also shows that an 8B general model, doing ten tasks at once as a single model, can match CogAgent at twice its size, with the data, weights, and training code all made public. The costs are English only, long explanations from the Chat version that make up stories, and some training labels in the wrong order.

At its core, the H-Reducer is just one convolution whose kernel and stride are both 1×41 \times 4, plus one fully connected layer. If you want to shorten the visual sequence in your own document model without losing position, this is the cheapest trick there is; for charts, though, it's worth trying a square in place of that 4.