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
Compute level
Resources
What the paper used
Prerequisites
Scope
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.”
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.
- 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.
- 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.
- 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.
- 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?
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.
- Ada-KV: Optimizing KV Cache Eviction by Adaptive Budget Allocation for Efficient LLM Inference · 2025 · 295 citations
- FastOCR: Dynamic Visual Fixation via KV Cache Pruning for Efficient Document Parsing · 2026 · 0 citations
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 WorksYouyang 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
- Foveated Spatial KV Compression and Sparse Attention for Interactive 720p Video GenerationFastFrames: Video Generation at Interactive Latency🔴Hard
- Prompt-Relevant Historical Memory Retrieval and Entropy-Calibrated Layer-Head KV CompressionMovieRoll: A Systematic Framework for Rolling Out Long-Form Videos🟡Fairly easy
- Dual-Axis KV Sharing: Integrating Joint-KV with Cross-Layer and Prefix-Shared AttentionMulti-Branch Transformer🟠Medium
- Graph-Compatible Dynamic Sparse Attention for End-to-End Prefix CaptureTideway: Phase-Aware Tiered Memory Management for MoE Inference on Consumer Devices🟡Fairly easy
- Hybrid Kernel Scheduling for Prefill OptimizationBitnet.cpp: Efficient Edge Inference for Ternary LLMs🟡Fairly easy