← All models

image-to-text Β· document page β†’ Markdown+LaTeX Β· WASM Β· ~250 MB

Nougat β€” read a whole research page into Markdown

Nougat is OCR done the way a person reads a paper: a vision transformer looks at an entire scanned page and a text decoder writes the page back out as structured Markdown β€” headings, prose, tables, and the equations preserved as LaTeX β€” one token at a time, entirely on your device.

At a glance

ModelXenova/nougat-small (ONNX of facebook/nougat-small)
Task / pipelineimage-to-text
ArchitectureDonut-Swin image encoder (896Γ—672) β†’ mBART-style text decoder β€” a VisionEncoderDecoder with cross-attention (~250M params)
InputA whole document page image (a scanned/rendered research page works best)
OutputThe full page as Markdown, with math kept as inline \( … \) / display \[ … \] LaTeX
Quantizationq8 (8-bit) ONNX β€” separate encoder + decoder graphs
BackendWebAssembly (runs anywhere; no WebGPU needed)
Download~250 MB (77 MB encoder + 165 MB decoder), cached after first load
LicenseCC-BY-4.0 (facebook/nougat-small)
Web APIsWebAssembly, Web Workers, Canvas, FileReader β€” all Baseline widely available

Run it

Pick a page below or drop your own, then hit Transcribe page. Nougat reads the whole page at once (not a single line), so give it a full page image. Watch the Markdown form token by token, then flip between the rendered view and the raw Markdown+LaTeX.

Drop a page image here, or click to choose
A research page: title, abstract, and a numbered equation A page dense with display equations A results section with a data table
Selected document page

A full page is long β€” more tokens transcribe more of it, but take longer.

The transcribed page will appear here.

See inside β€” the token stream and the structure it builds

Nougat is autoregressive generation, not character matching. The encoder reads the page into patch embeddings once; then the decoder emits Markdown one token at a time, each conditioned on the image and everything written so far β€” which is how it knows to open a # heading, lay out a | table, or drop into \( … \) for math. The trace shows every token as it arrived, with elapsed time; the panel beside it counts the structure that emerged.

Transcribe a page to see the token-by-token trace.

Why it matters

The world's science is locked in fixed-layout PDFs. Plain OCR can pull the words out, but it destroys exactly what makes a paper a paper: the headings that give it structure, the tables that hold the results, and the mathematics β€” which OCR turns into a soup of stray symbols. Nougat keeps all of it, and running it locally means you can do that to a document you'd never upload.

Use cases

Basics

Transcribe a research page and see the Markdown structure it recovers.

Practical

Pull a results table off a page into a real Markdown/CSV table you can copy.

Wild

Feed it a wall of equations and watch the LaTeX come back, math intact.

Multi-model

Nougat β†’ summariser: transcribe a page, then summarise it, all on-device.

How the API works

The base call is two lines with Transformers.js:

import { pipeline } from "@huggingface/transformers";

const nougat = await pipeline(
  "image-to-text",
  "Xenova/nougat-small",
); // downloads + caches ~250 MB once

const out = await nougat(pageImageURL, { max_new_tokens: 300 });
// β†’ [{ generated_text: "# Title\n\n## 1 Introduction\n\n… \\( \\mathcal{L} = -\\sum … \\)" }]

The important bit is the input: Nougat expects a whole page, not a single line β€” its encoder is fixed at 896Γ—672 and it's trained on full research pages. This page passes a TextStreamer into the same call so "See inside" can render the Markdown as it forms and time each token, and it does all of this off the main thread in a Web Worker. The raw output is GitHub-flavoured Markdown with LaTeX math delimited by \( … \) and \[ … \] β€” this page renders the structure and keeps the LaTeX verbatim.

References