TL;DR
Multimodal Retrieval-Augmented Generation (RAG) allows language models to answer questions using real-world document images, but feeding them dozens of retrieved pages triggers a "token explosion" that tanks inference speed. This paper introduces Doc-REFRAG, a framework that aggressively compresses visual tokens into coarse chunks and uses a lightweight reinforcement learning (RL) selector to dynamically decompress only the question-relevant regions. Paired with a massive new noisy retrieval dataset called DocLongRAG, this approach achieves state-of-the-art accuracy while drastically slashing latency.
What Problem Does This Paper Address?
Visually rich documents—like PDFs, slide decks, financial charts, and academic posters—are the lifeblood of enterprise knowledge. To answer questions about them, systems use Multimodal RAG to retrieve relevant pages and feed them into a Multimodal Large Language Model (MLLM). However, deploying these systems in production hits two major roadblocks:
- The Token Explosion: A single document image can easily consume hundreds or thousands of visual tokens. When a retriever pulls the top 20 or 50 pages to ensure high recall, the model is flooded with tens of thousands of tokens, causing massive Time-to-First-Token (TTFT) prefill delays and high compute costs.
- The RAG Distribution Shift: Most MLLMs are trained on clean, single, coherent documents. In real-world RAG, the retrieved context is a fragmented, redundant, and often contradictory pile of images from diverse sources. This noise severely degrades model reasoning.
Existing visual token compression methods don't solve this because they are question-agnostic—they prioritize visually dense areas (like text-heavy blocks or complex charts) even if those regions have absolutely nothing to do with the user's specific question.
Methods
Doc-REFRAG abandons static token pruning in favor of a dynamic "compress-and-expand" paradigm:
- Visual Chunking & Compression: The framework partitions the visual tokens of each retrieved image into small, non-overlapping spatial chunks (preserving the 2D layout). A two-layer MLP projector compresses each chunk into a single embedding, drastically shortening the initial sequence length fed to the language model.
- RL-Based Selector: To recover fine-grained details, a lightweight, query-conditioned RL selector (a tiny 2-layer Transformer under 1M parameters) analyzes the question alongside the compressed chunks. It dynamically decides which chunks are highly relevant and expands ("decompresses") them back to their original full-resolution tokens during decoding.
- Three-Stage Training Protocol:
- Single-Image Reconstruction: Aligns chunk embeddings with the decoder's space using text parsing and localization tasks.
- Multi-Image Continual Pretraining (CPT): Uses curriculum learning to scale the model from single images to clean multi-image documents, and finally to noisy retrieval contexts using pseudo-labels from ColQwen similarity scores.
- RL Selector Alignment: The selector is optimized using Group-Relative Policy Optimization (GRPO), where the reward signal is the actual final answer accuracy of the frozen decoder.
Datasets
The authors evaluate their approach on six standard Visual Document Understanding (VDU) benchmarks under realistic top-20 image retrieval settings: ChartQA, SlideVQA, InfoVQA, DUDE, Vidore-v2, and MMDocIR.
To train the model to handle the chaos of real-world retrieval, they introduced a massive new dataset:
- DocLongRAG: A large-scale dataset specifically engineered to mimic real-world RAG noise. It contains 343K QA pairs grounded in 3.3M document images spanning PDFs, slides, and posters. Crucially, each question is paired with an average of 37.4 images, explicitly interleaving true relevant pages with hard-negative distractors mined via a document retriever.
Key Insights and Ideas
- Visual Salience $\neq$ Semantic Relevance: Traditional compression algorithms assume text-dense regions are always important. Doc-REFRAG proves that conditioning compression on the question via a learned policy is far more effective for RAG tasks.
- Messy Training Breeds Robustness: Simply scaling up clean data doesn't fix RAG performance. Introducing explicit retrieval noise (hard negatives) during the curriculum learning phase is what unlocks true robustness against fragmented real-world inputs.
- Learned Decompression over Pruning: Instead of permanently throwing away tokens (which risks losing fine-grained text details), keeping a highly compressed global context and selectively "zooming in" via RL provides the best of both worlds: global context awareness with local high-resolution fidelity.
Key Results
- State-of-the-Art Trade-off: Doc-REFRAG outperforms 11 strong baselines (including Qwen3VL-8B and InternVL3.5) across all six benchmarks, achieving a top average accuracy of 57.5%.
- Massive Efficiency Gains: It achieves SOTA accuracy while using an average of only ~150 visual tokens per image. Compared to Docopilot (the most accurate document-aware baseline), Doc-REFRAG slashes Time-to-Inter-Token (TTIT) latency by 2.18 seconds, accelerating end-to-end generation.
- Fast Selection: The RL selector identifies relevant chunks in a single forward pass, taking just 3.7 seconds compared to 9.3 seconds for dense patch-matching alternatives like ColQwen.
Limitations and Future Work
- Fixed Granularity: The chunk size ($k=3$) is a fixed training hyperparameter. The model cannot dynamically adapt to different document densities at inference time without running multiple routing selectors, which adds latency.
- Coarse Reward Signal: The RL selector is trained purely on final answer accuracy, meaning it lacks fine-grained, chunk-level feedback on exactly which visual regions drove the correct answer.
- Language Constraints: DocLongRAG is currently limited to English documents. Adapting the pipeline to dense CJK (Chinese, Japanese, Korean) scripts might require smaller, more adaptive chunk sizes due to higher information density per patch.
Summary updated