An implementation of "M3DOCRAG: Multi-modal Retrieval is What You Need for Multi-page Multi-document Understanding" by Jaemin Cho, Debanjan Mahata, Ozan Irsoy, Yujie He, and Mohit Bansal (UNC Chapel Hill & Bloomberg).
Python
55
9 commits
updated Nov 13, 2024
An implementation of "M3DOCRAG: Multi-modal Retrieval is What You Need for Multi-page Multi-document Understanding" by Jaemin Cho, Debanjan Mahata, Ozan Irsoy, Yujie He, and Mohit Bansal (UNC Chapel Hill & Bloomberg).
Document visual question answering (DocVQA) pipelines that answer questions from documents have broad applications. Existing methods focus on handling single-page documents with multi-modal language models (MLMs), or rely on text-based retrieval-augmented generation (RAG) that uses text extraction tools such as optical character recognition (OCR). However, there are difficulties in applying these methods in real-world scenarios: (a) questions often require information across different pages or documents, where MLMs cannot handle many long documents; (b) documents often have important information in visual elements such as figures, but text extraction tools ignore them.
This implementation provides:
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
.\venv\Scripts\activate # Windows
pip install -r requirements.txt
# Ubuntu/Debian
sudo apt-get install poppler-utils
# macOS
brew install poppler
# Windows
# Download and install poppler from: http://blog.alivate.com.au/poppler-windows/
The system uses the following models:
vidore/colpaligemma-3b-mix-448-base with vidore/colpali adapterQwen/Qwen2-VL-7B-Instruct-GPTQ-Int4 (quantized for memory efficiency)python m3-doc-rag.py
(M3DOCRAG) init
(M3DOCRAG) add path/to/document.pdf
(M3DOCRAG) build
(M3DOCRAG) ask "What is the commercial franchising program?"
(M3DOCRAG) list
(M3DOCRAG) exit
The system is configured to use multiple GPUs efficiently:
Memory optimization features:
Document Processing
Retrieval System
Question Answering
If you use this code in your research, please cite:
@article{cho2024m3docrag,
title={M3DOCRAG: Multi-modal Retrieval is What You Need for Multi-page Multi-document Understanding},
author={Jaemin Cho and Debanjan Mahata and Ozan Irsoy and Yujie He and Mohit Bansal},
journal={arXiv preprint arXiv:2411.04952},
year={2024}
}
This is an unofficial implementation of the M3DOCRAG paper. The original paper was authored by researchers from UNC Chapel Hill and Bloomberg. This implementation uses:
31 followers · starred May 2025
An implementation of "M3DOCRAG: Multi-modal Retrieval is What You Need for Multi-page Multi-document Understanding" by Jaemin Cho, Debanjan Mahata, Ozan Irsoy, Yujie He, and Mohit Bansal (UNC Chapel Hill & Bloomberg).
Python
55
9 commits
updated Nov 13, 2024
An implementation of "M3DOCRAG: Multi-modal Retrieval is What You Need for Multi-page Multi-document Understanding" by Jaemin Cho, Debanjan Mahata, Ozan Irsoy, Yujie He, and Mohit Bansal (UNC Chapel Hill & Bloomberg).
Document visual question answering (DocVQA) pipelines that answer questions from documents have broad applications. Existing methods focus on handling single-page documents with multi-modal language models (MLMs), or rely on text-based retrieval-augmented generation (RAG) that uses text extraction tools such as optical character recognition (OCR). However, there are difficulties in applying these methods in real-world scenarios: (a) questions often require information across different pages or documents, where MLMs cannot handle many long documents; (b) documents often have important information in visual elements such as figures, but text extraction tools ignore them.
This implementation provides:
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
.\venv\Scripts\activate # Windows
pip install -r requirements.txt
# Ubuntu/Debian
sudo apt-get install poppler-utils
# macOS
brew install poppler
# Windows
# Download and install poppler from: http://blog.alivate.com.au/poppler-windows/
The system uses the following models:
vidore/colpaligemma-3b-mix-448-base with vidore/colpali adapterQwen/Qwen2-VL-7B-Instruct-GPTQ-Int4 (quantized for memory efficiency)python m3-doc-rag.py
(M3DOCRAG) init
(M3DOCRAG) add path/to/document.pdf
(M3DOCRAG) build
(M3DOCRAG) ask "What is the commercial franchising program?"
(M3DOCRAG) list
(M3DOCRAG) exit
The system is configured to use multiple GPUs efficiently:
Memory optimization features:
Document Processing
Retrieval System
Question Answering
If you use this code in your research, please cite:
@article{cho2024m3docrag,
title={M3DOCRAG: Multi-modal Retrieval is What You Need for Multi-page Multi-document Understanding},
author={Jaemin Cho and Debanjan Mahata and Ozan Irsoy and Yujie He and Mohit Bansal},
journal={arXiv preprint arXiv:2411.04952},
year={2024}
}
This is an unofficial implementation of the M3DOCRAG paper. The original paper was authored by researchers from UNC Chapel Hill and Bloomberg. This implementation uses:
31 followers · starred May 2025