Skip to content
AI-generated research idea🔴Hard🔬Significant ResearchRelated work found

Learned Dynamic Prefill Chunk Fetching for Unbounded Multi-Page Document Parsing

Replace static full-document visual prefill caching with learned chunked KV retrieval so document parsers handle arbitrarily long books under fixed memory.

Time

a couple of months

Compute level

Multiple GPUs

Resources

Multi-GPU node (e.g., 4-8x A800 or A100 GPUs) consistent with fine-tuning the released 3B-A0.5B checkpoint, plus SGLang/Transformers KV cache extensions and multi-page PDF datasets.

What the paper used

8x16 (128) A800 GPUs for 4,000 training steps with a global batch size of 256, 32K maximum sequence length, and approximately 2 million document OCR samples.

Prerequisites

Transformer KV cache management, custom SGLang/FlashAttention inference kernels, and vision-language model fine-tuning.

Scope

Modify existing released codebase and inference engine to support dynamic chunked KV swapping and train a chunk-transition policy.

The Gap

The decoder uses Reference Sliding Window Attention to bound output KV cache growth to a fixed window of 128 tokens, while all visual and prompt reference tokens must still be prefilled and retained statically in GPU memory throughout decoding within the 32K maximum sequence limit.

“Our model cannot achieve truly unlimited parsing under a finite context length (e.g., 32K), as it is also constrained by the prefill length.”
From the paper, Section 7, page 11. Matched against the PDF text.

Limitation

Because visual prefix tokens accumulate linearly with page count (256 tokens per page in Base mode), the model remains constrained by the finite 32K context window and cannot parse arbitrarily long documents such as full-length books.

Proposed Solution

Implement a CPU- or disk-offloaded prefill KV pool storing encoded page chunks (256 tokens per page), paired with a lightweight learned router or page-transition predictor in the decoder. When the sliding output window emits page separators or exhibits shifting attention over the active page chunk, dynamically prefetch the next visual page KV chunk(s) and evict completed page chunks so both active prefix memory and decode memory remain strictly bounded regardless of total page count.

The paper’s authors list this direction as future work, so they may already be pursuing it.

Why This Matters

Decoupling maximum parsable document length from GPU VRAM and training context limits could enable true book-scale one-shot transcription on modest hardware.

How to Get Started

How to test it: Test the hypothesis that maintaining a sliding active buffer of 2 to 3 visual page KV chunks with learned prefetch triggers matches full-prefill Edit Distance on 40+ page books while capping peak VRAM constant. Compare against the released 32K full-prefill Unlimited OCR baseline on 10- to 200-page PDFs using Edit Distance, Distinct-35, and peak GPU memory, stopping if Edit Distance degrades by more than 0.02 due to missed page transitions.

  1. Clone the released Unlimited-OCR repository and benchmark SGLang inference throughput and peak VRAM across 10, 20, 40, and 100+ page documents to locate the exact context-limit and OOM failure points.
  2. Instrument attention weights in the released checkpoint during multi-page decoding to measure how strongly generated tokens attend to prior versus upcoming page visual tokens around <page> separators.
  3. Prototype a rule-based page-chunk sliding buffer in the Transformers or SGLang KV cache manager that retains a local window of page visual tokens and swaps chunks upon <page> emission.
  4. Evaluate the rule-based chunk buffer against full-prefill Unlimited OCR on a 40+ page book test set and fine-tune the decoder with lookahead page-prefetch signals if boundary errors occur.

Suggested by AI. Adapt it to your setup.

Has This Been Done?

Related work found

Works like FastOCR: Dynamic Visual Fixation via KV Cache Pruning for Efficient Document Parsing and Ada-KV: Optimizing KV Cache Eviction by Adaptive Budget Allocation explore KV cache management and visual token pruning for documents. However, they do not specifically target a learned prefill chunk fetching and eviction strategy for unbounded multi-page document parsing.

We searched OpenAlex and arXiv for “dynamic KV cache eviction retrieval long document VLM” and “Learned Dynamic Prefill Chunk Fetching for Unbounded Multi-Page Document Parsing” and an AI compared the idea with the top 10 results. A small search can miss relevant work.

Source Paper

Unlimited OCR Works

Youyang Yin, Huanhuan Liu, YY +14 more · 2026

Unlimited OCR addresses the memory and latency bottlenecks of long-horizon end-to-end document parsing, where standard LLM decoders accumulate linearly growing KV caches across dozens of pages. The authors introduce Reference Sliding Window Attention (R-SWA), enabling one-shot multi-page transcription with constant decode-side KV cache memory and generation speed while achieving state-of-the-art accuracy on OmniDocBench.

Related Ideas

Is this a good idea?

Share onXLinkedIn