Ground Truth.
AI, checked against the source.

News · 2026-07-26

Baidu's OCR Model Reads Dozens of Pages in One Pass Without Its Memory Growing

Baidu has released an OCR model that transcribes dozens of pages in a single forward pass without its memory footprint growing as it goes. Unlimited OCR replaces every attention layer in its decoder with a mechanism the authors call Reference Sliding Window Attention, which holds the key-value cache at a constant size throughout decoding. The model is 3 billion parameters, MIT licensed, and currently among the most downloaded models on Hugging Face.

Key facts

The problem Baidu set out to fix is one anyone who has run a document through a modern OCR system will recognise. Recent OCR models use a language model as the decoder, which helps enormously with accuracy because the model can use its sense of how language works to resolve smudged characters. But it inherits the language model's central inefficiency. As Baidu's technical report puts it: "as the output sequence lengthens, the accumulated KV cache drives up memory consumption and progressively slows down generation. This stands in stark contrast to humans, who exhibit no such decline in efficiency during long-horizon copying tasks."

That comparison is the whole design philosophy in one sentence. A person copying a fifty-page document does not get slower at page forty because they are still holding pages one through thirty-nine in their head. They hold the current line, a little context around it, and the source. Standard attention does the opposite: every new token consults everything generated so far, so the KV cache grows linearly and the work per token grows with it.

Reference Sliding Window Attention gives the decoder a fixed working memory instead. Rather than attending across the entire growing transcription, each step attends within a bounded window plus a reference to the source, which is what makes the cache constant. Combined with the high compression rate of the visual encoder inherited from DeepSeek OCR, the practical outcome is that a whole stack of pages fits inside a normal output budget rather than choking partway through. Baidu frames its own release plainly: the project aims "to push Deepseek-OCR one step further."

The generality claim is the part experts should care about most. The authors write that "R-SWA is a general-purpose parsing attention mechanism - beyond OCR, it is equally applicable to tasks such as ASR, translation, etc." That is a reasonable extrapolation. Speech recognition and translation share OCR's essential shape: a long input that must be converted, in order, into a long output, where the model needs the source in front of it far more than it needs its own earlier output. If the mechanism holds up in those domains, it is a broader contribution than a document-parsing improvement. It also sits in a family of ideas - linear attention, bounded-state designs, sparse attention - that several labs have converged on this year for the same reason.

Adoption is the strongest signal in the release, and it is unusually concrete. Rather than a spike of downloads and silence, the model card documents a steady stream of integrations: vLLM inference support contributed by the community in late June, a Hugging Face Spaces demo, availability on ModelScope, a Baidu Cloud deployment path in early July, and training support through the ms-swift framework on July 21. Those are people building on it, which is a better indicator than a download counter - as this week's broken abliterated Gemma release demonstrated, download totals measure distribution and nothing else.

The honest caveats are the ordinary ones. The evaluation is Baidu's own, comparing against a baseline Baidu selected, and no independent replication has been published. Constant-cache designs typically trade something for their efficiency - the question with any bounded-memory mechanism is what happens when a document genuinely requires long-range reference, such as a table whose header appeared thirty pages earlier, and the report's evidence on that is the authors' own. And a 3-billion-parameter model doing this well on documents does not imply that the same mechanism scales to general reasoning, which is a different workload with different memory demands.

For anyone with a pile of PDFs and a GPU, though, this is the most immediately usable thing in this week's open-weight releases: small, permissively licensed, already wired into the serving stacks people actually run, and solving a problem that shows up the moment a document exceeds a few pages.


Primary source, verified: read the paper → (arXiv 2606.23050)

Key questions

What problem does Unlimited OCR solve?

It fixes the slowdown that hits language-model-based OCR on long documents: as the transcription gets longer, the accumulated key-value cache grows, eating memory and progressively slowing generation.

How does it keep memory constant?

Baidu replaced every attention layer in the decoder with what it calls Reference Sliding Window Attention, which maintains a fixed-size cache throughout decoding rather than one that grows with each token produced.

Is the technique only useful for OCR?

No. The authors argue the mechanism is general-purpose for parsing tasks and say it applies equally to speech recognition and translation, which are also long, order-preserving transcription problems.
Cite this

APA

Ground Truth. (2026, July 26). Baidu's OCR Model Reads Dozens of Pages in One Pass Without Its Memory Growing. Ground Truth. https://groundtruth.day/news/baidus-ocr-model-keeps-its-memory-flat-across-dozens-of-pages.html

BibTeX

@misc{groundtruth:baidus-ocr-model-keeps-its-memory-flat-across-dozens-of-pages,
  title  = {Baidu's OCR Model Reads Dozens of Pages in One Pass Without Its Memory Growing},
  author = {{Ground Truth}},
  year   = {2026},
  month  = {jul},
  url    = {https://groundtruth.day/news/baidus-ocr-model-keeps-its-memory-flat-across-dozens-of-pages.html}
}

Topics: open-weights · ocr · document-ai · baidu · efficiency · attention

Comments are replies to this story on Bluesky — reply with any Bluesky account to join in.