Nougat · document AI

On this page 7

Nougat (Neural Optical Understanding for Academic Documents) is an open-source document AI model that converts images of scientific pages into structured Markdown, including mathematical formulas in LaTeX and tables. Released by Meta AI in 2023, it reads a rendered page directly and generates text token by token, which makes it a representative of OCR-free document understanding in the Document AI field.

Nougat was designed for a narrow but difficult task: recovering the semantic content of academic papers, especially equations, that classical OCR engines and PDF text extraction handle poorly. The name refers only to this model; it is not to be confused with the confection or with unrelated software projects of the same name.

How Nougat converts a page into Markdown

Nougat is an image-to-sequence transformer that maps a page image straight to markup. It follows the same encoder-decoder design as Donut: a Swin Transformer encoder turns the rasterized page into visual embeddings, and an mBART-style decoder generates the output text autoregressively, attending to those embeddings at each step.

The pipeline needs no text layer and no external OCR engine. Each PDF page is rendered at a fixed resolution, the model predicts a lightweight Markdown dialect with LaTeX for inline and display math, and a post-processing step assembles the pages into one document. Because the model reads pixels, it works on born-digital PDFs and on clean scans of printed papers.

The table below summarizes the main architectural parameters of the published model.

PropertyValue or approachEffect
EncoderSwin TransformerCaptures layout and fine glyph detail
DecodermBART-style transformerGenerates Markdown token by token
Input resolution896 by 672 pixels per pageEnough detail for subscripts and symbols
Model sizesAbout 250M and 350M parametersTrade-off between speed and accuracy
Output formatMarkdown with LaTeX math and tablesMachine-readable scientific text
Maximum sequenceAbout 3,584 to 4,096 tokensVery dense pages may be truncated
Key characteristics of the Nougat model

Training data and output quality

Nougat was trained on pairs of rendered PDF pages and their source markup, built mainly from arXiv papers whose LaTeX sources are public, supplemented with PubMed Central articles and pages from an industry documents archive. Aligning source text to individual pages required heuristic page splitting, which is one reason for occasional boundary errors.

On scientific papers the model achieves low edit distance on plain text and markedly better formula recovery than general OCR, because it predicts LaTeX rather than isolated characters. Tables are reproduced as LaTeX tabular markup, with lower accuracy than running text. Quality falls on documents that differ from the training distribution, such as handwriting, non-Latin scripts and complex magazine layouts.

Nougat occupies a specialized niche within document-to-Markdown conversion. Classical engines recognize characters and need separate layout and formula handling, while general vision-language models are broader but heavier. The following comparison places Nougat among its closest neighbors.

Tool or approachMethodBest fitMain limitation
NougatOCR-free image-to-markup modelScientific papers with mathNarrow domain, hallucination risk
TesseractClassical OCR engineGeneral printed textNo formula or structure recovery
DonutOCR-free image-to-JSON modelReceipts, forms, classificationNeeds task-specific fine-tuning
DoclingLayout pipeline with specialized modelsMixed business and technical PDFsSeveral components to maintain
PDF text extractionReads the embedded text layerBorn-digital PDFs, fast batch workBreaks formulas and reading order
Nougat and comparable approaches

In practice, Nougat is often combined with other tools: a fast text-layer extractor for simple pages and Nougat only for pages with dense mathematics, which balances throughput and quality.

Typical applications

Nougat is used mainly where mathematical content must remain machine-readable. Its output feeds language model pipelines, search indexes and accessibility tools that cannot work with raw PDF text.

  • Building training corpora of scientific text for language models, where equations must stay intact.
  • Retrieval-augmented generation over research libraries, using Markdown chunks with preserved headings.
  • Accessibility conversion of papers into formats that screen readers and math renderers can handle.
  • Digitizing older scanned papers that lack any usable text layer.
  • Mathematical expression recognition as a component in larger document processing systems.

Limitations and failure modes

Because Nougat generates text rather than recognizing it, its most serious weakness is fluent hallucination: the output can look plausible while differing from the page. A characteristic failure is the repetition loop, in which the decoder repeats a sentence until the token limit; the reference implementation detects this and may mark the page as failed or missing.

The table below lists the common symptoms, their causes and practical mitigations.

SymptomLikely causeMitigation
Repeated linesDecoder degenerationRepetition detection, retry, fallback extractor
Missing pagePage skipped after failureLog skipped pages and process them separately
Garbled foreign textMostly English training dataUse a multilingual OCR engine instead
Slow throughputAutoregressive decoding on large pagesGPU batching, route simple pages elsewhere
Wrong table structureLimited table supervisionValidate tables against a dedicated extractor
Common Nougat problems and mitigations

Processing speed is a real constraint: decoding is orders of magnitude slower than text-layer extraction and usually requires a GPU. Organizations should therefore validate output with character error rate checks on a sample before relying on it at scale.

Explained without jargon

Scientific papers are full of formulas. Ordinary text recognition sees them as strange symbols and scrambles them. Nougat looks at the page like a picture and writes it out again as clean text.

It is a bit like a skilled typist who copies a printed paper into a computer and types every equation in a form computers understand. The typist is fast and usually accurate. Sometimes, however, the typist gets tired and repeats a line or guesses a word, so important results still deserve a quick check.

A typical use case

A university library wants to make 12,000 physics papers from the 1990s searchable in an internal research assistant. Many files are scans with no text layer, and the rest contain equations that standard PDF extraction turns into unreadable fragments.

The library’s data team routes each page through a simple test. Pages with a clean text layer and no formulas go to a fast extractor, while math-heavy and scanned pages go to Nougat running on two GPUs. Pages flagged for repetition are retried and, if they fail again, sent to a classical OCR engine for manual review.

After four weeks, about 96 percent of pages are converted to Markdown with intact LaTeX formulas. Researchers can now search for specific equations and ask the assistant questions grounded in the converted text, while the remaining pages are reviewed by staff.