TL;DR
DocSLM is a lightweight, 2B-parameter Vision-Language Model designed to process long, multi-page documents on resource-constrained edge devices. By combining hierarchical multimodal compression with a novel streaming abstention mechanism, it matches or exceeds the accuracy of models four times its size while slashing latency by 71% and maintaining a flat memory footprint.
What Problem Does This Paper Address?
Processing long, multi-page documents (like financial reports, legal briefs, or scientific papers) requires models to simultaneously parse complex visual layouts and dense text. Large Vision-Language Models (LVLMs) excel at this, but they are massive memory hogs—frequently exceeding 8B parameters and requiring thousands of tokens per page. This high computational overhead makes them impractical to deploy on edge hardware like mobile GPUs.
Existing workarounds fall short: Retrieval-Augmented Generation (RAG) frameworks introduce significant latency and fragment context, while smaller models either rely on dense visual encodings that quickly saturate memory or use aggressive compression that destroys text readability. DocSLM aims to bridge this gap by delivering high-accuracy document understanding within a strict token and memory budget.
Methods
DocSLM introduces two core architectural innovations to handle page-level and document-level efficiency bottlenecks:
- Hierarchical Multimodal Compression: Instead of feeding raw dense visual tokens and long OCR text strings directly into the language model, DocSLM uses a two-stage fusion process. First, Local OCR Compression uses cross-attention to map region-specific OCR text directly onto corresponding visual patches. Second, Global Visual Compression condenses these features into a fixed budget of just 576 tokens per page, regardless of how text-heavy the page actually is.
- Streaming Abstention: To handle arbitrarily long documents without running out of memory, DocSLM breaks the document into sequential segments. Crucially, it avoids passing massive Key-Value (KV) caches between segments. Instead, it processes each segment independently, computes a text prediction, and calculates an entropy-based uncertainty score. An Uncertainty Calibrator then reviews all segment predictions and selects the one with the highest confidence (lowest uncertainty). If a segment doesn't contain the answer, the model learns to output a "Not Answerable" token.
The model is trained using a multi-stage curriculum that progressively transitions from low-level image-OCR alignment to multi-document finetuning with negative-pair supervision to calibrate its uncertainty scores.
Datasets
The authors trained and evaluated DocSLM across several diverse benchmarks:
- Training & Finetuning: DocStruct4M, MP-DocStruct1M, DocDownstream 1.0 & 2.0, DocGenome12K, and MP-DocReason51K.
- Evaluation:
- MMLongDocBench: Features long documents averaging 47.5 pages (up to 120 pages) to test long-context capabilities.
- MP-DocVQA & DUDE: Standard multi-page document question-answering datasets spanning industrial, medical, legal, and financial domains.
- NewsVideoQA: A text-rich broadcast video dataset used to evaluate how well the model generalizes to temporally varying, text-centric visual content.
Key Insights and Ideas
-
The Constant Memory Plateau: Traditional transformers suffer from linear memory growth as document length increases. DocSLM's streaming mechanism completely flattens this curve, capping peak GPU memory usage at ~14 GB whether the document is 10 pages or 120 pages long. DocSLM flattens peak GPU memory usage to a constant plateau.
-
Ditching the KV Cache Safely: Retaining KV caches across long contexts is a major memory bottleneck. DocSLM proves that you can discard intermediate activations entirely between document segments, provided you have a well-calibrated uncertainty mechanism to pick the best answer post-hoc.
- Local Alignment Before Global Compression: Aggressive downsampling usually ruins text recognition. The "aha moment" here is that by aligning OCR text tokens to local visual patches before global compression, the model retains fine-grained semantic fidelity even with a 5.6× reduction in total tokens.
Key Results
- Efficiency & Speed: DocSLM operates with just 576 tokens per image and 2B parameters, yet it runs 3.5× faster than RAG-based alternatives (32.1 ms vs 113.4 ms latency).
-
Performance Gains: On the MMLongDoc benchmark, DocSLM achieves 22.7% accuracy, outperforming the 8B-parameter DocOwl2 by +9.3% and the similarly sized Docopilot-2B by +0.9%, despite Docopilot using a significantly larger token budget. DocSLM accuracy vs token efficiency on MMLongDoc.
-
Robustness to Length: On MP-DocVQA, while baseline models collapsed when documents exceeded 10 pages (dropping to 0.7 ANLS), DocSLM maintained a strong score of 61.2 ANLS.
- Cross-Modal Generalization: Despite being trained primarily on static documents, DocSLM achieved a state-of-the-art ANLS score of 66.2 on NewsVideoQA, outperforming much larger models like Idefics3 and LLaVA-Next.
Limitations and Future Work
The authors note that future work will focus on creating a more balanced training regime that unifies document and video understanding into a single foundation model for edge deployment. While not explicitly detailed as a failure mode, the segment-wise streaming approach inherently relies on the answer being localized within specific segments; synthesizing answers that require aggregating information spread across multiple distinct segments remains an open challenge for future exploration.
Summary updated