Towards Natural Language-Based Document Image Retrieval: New Dataset and Benchmark

Hao Guo, Xugong Qin, Jun Jie Ou Yang, Peng Zhang, Gangyan Zeng, Yubo Li, Hailun Lin

Introduction

Traditional Document Image Retrieval (DIR) systems generally operate under two paradigms: "query-by-image," which relies on visual similarity to find related document categories, and "query-by-text," which depends on Optical Character Recognition (OCR) to match keywords. Both approaches have significant drawbacks. Image-based retrieval lacks semantic granularity, while OCR-based methods are prone to cascading errors from poor scans or handwriting and often ignore vital visual context like layouts and charts.

To address these limitations, this work introduces the task of Natural Language-based Document Image Retrieval (NL-DIR). This approach allows users to search for documents using fine-grained, semantic natural language queries, bridging the gap between human search intent and system capabilities.

Comparison of document retrieval paradigms: (a) Image Retrieval, (b) OCR-based Text Retrieval, and (c) the proposed Cross-Modal Retrieval.

The NL-DIR Dataset

A primary obstacle to advancing cross-modal document retrieval has been the lack of large-scale, high-quality datasets. This paper presents NL-DIR, the first benchmark specifically designed for this task. It comprises 41,795 real-world document images paired with approximately 205,000 fine-grained semantic queries. The images are sourced from the Industry Documents Library, ensuring a diverse representation of real-world business and legal documents.

The dataset was constructed using an "LLM-in-the-loop" pipeline. Layout-aware OCR text was processed by ChatGPT to generate diverse queries, which were then filtered through a multi-stage verification process involving Vision-Language Models (VLMs) like Qwen-VL-Plus and human review. The resulting dataset covers a wide range of document types, including letters, reports, memos, and forms.

Statistical distribution of the NL-DIR dataset, showing (a) document categories, (b) query lengths, and (c) word overlap with OCR text.

Proposed Methodology: A Two-Stage Pipeline

To achieve efficient and accurate retrieval, the authors propose a two-stage OCR-free pipeline designed to balance speed and precision:

  1. Recall Stage: A dual-encoder contrastive VLM (e.g., SigLIP) is used to rapidly compute embeddings for both the query and the document database. By pre-computing document embeddings, the system can perform real-time retrieval against massive databases using vector similarity, identifying the top 100 candidate documents.
  2. Re-ranking Stage: A cross-attention module performs deep interaction between the query text and the visual features of the top candidates. Models such as BLIP-ITM and Pix2Struct are employed to produce a refined ranking. This "early fusion" approach captures subtle semantic details and layout cues that dual-encoders might miss.

Key Insights and Results

The experimental results highlight several critical findings:

  • Contrastive vs. Generative: Contrastive VLMs significantly outperform generative models (like Donut or Nougat) in zero-shot retrieval tasks because they are optimized for aligned representation spaces rather than sequential text generation.
  • Performance Gains: Fine-tuning the visual module of SigLIP on the NL-DIR dataset improved Recall@10 from 61.18% to 89.72%. The full two-stage pipeline achieved a Recall@1 of 81.03%, vastly outperforming traditional OCR-based Information Retrieval (OCR-IR) systems, which reached only 52.72%.
  • Robustness: The OCR-free approach is particularly effective for "noisy" data, such as handwritten notes or queries referencing visual elements like "cartoon-strip ads," which typically baffle OCR-dependent systems.

Conclusion

The NL-DIR dataset and the proposed two-stage pipeline represent a significant step toward more natural and effective document retrieval. While challenges remain regarding the computational cost of large VLMs and the extension to multi-page documents, this work provides a robust foundation for future research in semantic-rich, cross-modal document understanding.

Summary updated

BibTeX
@inproceedings{guo2025towards,
  author = {Hao Guo and Xugong Qin and Jun Jie Ou Yang and Peng Zhang and Gangyan Zeng and Yubo Li and Hailun Lin},
  title = {{Towards Natural Language-Based Document Image Retrieval: New Dataset and Benchmark}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.02767},
}
Figure