TL;DR
This paper introduces DocSLM, a compact vision-language model designed for efficient understanding of long documents on resource-constrained devices. By employing a novel hierarchical compression technique and a streaming inference mechanism, DocSLM achieves state-of-the-art performance with significantly reduced memory, parameters, and latency compared to existing large models.
What Problem Does This Paper Address?
Large Vision-Language Models (LVLMs) have shown impressive capabilities in understanding complex, multimodal documents like financial reports and scientific papers. However, their substantial memory footprint and computational demands make them impractical for deployment on edge devices such as smartphones or embedded systems. This is exacerbated by the need to process long documents, which can contain dense text, figures, and intricate layouts, leading to an explosion in the number of input tokens and, consequently, memory usage. Existing solutions like retrieval-augmented generation (RAG) can improve relevance but often introduce additional latency and complexity. The core challenge is to enable robust, long-document understanding on devices with limited memory and processing power.
Methods
DocSLM tackles this challenge with two key innovations:
- Hierarchical Multimodal Compressor: This module efficiently encodes visual, textual (from OCR), and layout information from each document page into a fixed-length sequence of 576 tokens. It operates in two stages:
- Local OCR Compression: Aligns visual regions with corresponding OCR text and layout using cross-attention, creating compact region-level features.
- Global Visual Compression: Aggregates these regional features into a fixed-length page representation, preserving both spatial alignment and overall document semantics. This approach significantly reduces the token count per page, regardless of the original OCR token volume.
- Streaming Abstention Mechanism: To handle arbitrarily long documents without accumulating memory, DocSLM processes documents in segments. Each segment is processed independently, producing an intermediate prediction and an uncertainty score. This segmentation strategy ensures a constant memory footprint, irrespective of document length. An uncertainty calibrator then aggregates these segment-level predictions to determine the final document-level answer, abstaining from low-confidence responses.
Datasets
The paper evaluates DocSLM on several long-document understanding benchmarks:
- MP-DocVQA: A dataset of approximately 46K QA pairs derived from 60K scanned industrial documents.
- DUDE Dataset: Covers multiple real-world domains (medical, legal, financial, technical reports) with 41K QA pairs.
- MMLongBench-Doc: Specifically designed for long documents, averaging 47.5 pages and reaching up to 120 pages per document.
- News VideoQA: A dataset focusing on text-rich broadcast videos, used to test the model's generalization capabilities to dynamic, text-heavy visual content.
Key Insights and Ideas
- Fixed-size page representation is crucial for memory efficiency: By compressing each page into a fixed number of tokens (576), DocSLM decouples memory usage from the complexity of individual pages, a significant improvement over methods that scale with page content.
- Streaming inference with uncertainty is key for arbitrary document lengths: Processing documents segment-by-segment and using uncertainty to guide aggregation allows the model to handle extremely long inputs without memory overflow, a critical step for edge deployment.
- OCR is essential for text-dense documents: The paper demonstrates that while vision-only models can struggle with text-heavy content, integrating OCR through DocSLM's compression module significantly boosts performance, highlighting the importance of accurate text perception.
- Cross-modal generalization is achievable with compact models: DocSLM's ability to generalize to video question answering, despite being primarily trained on documents, suggests that efficient, compact multimodal models can be versatile.
Key Results
DocSLM achieves impressive results across various benchmarks:
- Efficiency: Uses 82% fewer visual tokens, 75% fewer parameters, and 71% lower latency compared to state-of-the-art large LVLMs.
- Performance: Matches or surpasses existing large and retrieval-augmented models on MMLongDoc, MP-DocVQA, and DUDE benchmarks.
- Achieves 22.7% accuracy on MMLongDoc, outperforming DocOwl2-8B by +9.3%.
- Outperforms Docopilot-2B by +0.9% on MMLongDoc.
- Achieves 70.0 ANLS on MP-DocVQA.
- Achieves 47.6 ANLS on DUDE.
- Latency: Achieves a latency of 32.1 ms, significantly faster than models like InternVL2-RAG (113.4 ms).
- Memory: Maintains a constant peak GPU memory footprint of ~14 GB, even for documents up to 120 pages long, demonstrating its suitability for resource-constrained devices.
Limitations and Future Work
- Limitations:
- While DocSLM shows generalization to video, it was trained on limited video data.
- The paper notes that finer-grained OCR assignments (more crops) did not necessarily improve performance and could even degrade it, suggesting a trade-off between local detail and global structure.
- Future Work:
- Extend DocSLM to incorporate additional modalities like audio.
- Pursue balanced document-video training to develop an omnimodal foundation model for edge deployment.
- Further explore the impact of OCR granularity and confidence thresholds on performance.
Summary updated