DEV Community

Breach Protocol
Breach Protocol

Posted on • Originally published at groundtruth.day

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

  • Transcribes dozens of document pages in one forward pass within a standard 32,000-token output limit.
  • 3 billion parameters, released under the MIT license with code and weights public.
  • Released June 22, 2026; the paper followed on June 23.
  • Primary source: the Unlimited-OCR model card and GitHub repository.

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.


Originally published on Ground Truth, where every claim is checked against the primary source.

Top comments (0)