A unified benchmark for document-centric multimodal retrieval-augmented generation (MM-RAG). This project provides the first large-scale, realistic benchmark for MM-RAG built from 70k real-world PDF pages across eight domains, with tools for document tagging, dataset synthesis, baseline implementations, and evaluation frameworks.
UNIDOC-BENCH is designed to evaluate and benchmark multimodal document understanding systems across various domains including healthcare, finance, legal, education, and more. The benchmark extracts and links evidence from text, tables, and figures, then generates 1,600 multimodal QA pairs spanning factual retrieval, comparison, summarization, and logical reasoning queries. It supports apples-to-apples comparison across four paradigms: (1) text-only, (2) image-only, (3) multimodal text-image fusion, and (4) multimodal joint retrieval.
Based on the comprehensive evaluation in the UNIDOC-BENCH paper, several important insights emerge:
UNIDOC-BENCH/
βββ src/
β βββ vllm_tagging.py # Document tagging and classification
β βββ qa_synthesize/ # QA dataset synthesis pipeline
β βββ baselines/ # Baseline RAG implementations
β βββ evaluation/ # Evaluation metrics and tools
β βββ tagging_prompts/ # Prompts for document tagging
βββ data/
β βββ QA/filtered/ # Filtered QA datasets by domain
βββ docs/ # Documentation and examples
src/vllm_tagging.py)Automated document tagging and classification system that processes PDF documents and extracts:
Key Features:
src/qa_synthesize/)Complete pipeline for generating high-quality question-answer pairs from document collections:
Pipeline Steps:
1_kg_create.py) - Build knowledge graphs from documents2_qa_synthesize.py) - Generate QA pairs using RAGAS framework3_filter_qa.py) - Filter out low-quality pairs4_filter_similarities.py) - Remove duplicate/similar questions5_balance.py) - Balance question types and difficulty6_rewriting.py) - Improve question quality and diversitySupported Domains:
Dataset Statistics:
src/baselines/)Multiple RAG baseline implementations supporting four paradigms:
simple_rag.py) - Traditional text-based retrievalimage_rag.py) - Visual document retrievalimage_text_rag.py) - Combined text and image retrievalgemini_call.py) - Google Gemini model integrationimage_rag_voyage.py) - Voyage AI embeddingsSupported Models:
src/evaluation/)Comprehensive evaluation suite using RAGAS metrics:
correctness.py) - Answer accuracy assessmentretrieval_eval.py) - Retrieval quality metricsevaluation_ragas.py) - Full RAGAS evaluation pipelineanalysis.py) - Results analysis and visualizationEvaluation Metrics:
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
export OPENAI_API_KEY="your-openai-key"
export GOOGLE_API_KEY="your-google-key" # For Gemini
python src/vllm_tagging.py \
--input_path /path/to/documents \
--output_path /path/to/tagged_output \
--model_name "Qwen/Qwen-VL-Chat"
# Run the complete synthesis pipeline
bash src/qa_synthesize/scripts/create_dataset.sh
# Text RAG baseline
bash src/baselines/scripts/text_rag.sh
# Multimodal RAG baseline
bash src/baselines/scripts/img_text_rag.sh
# Run end-to-end evaluation
bash src/evaluation/scripts/eval_e2e.sh
conda create -n unidoc-bench python=3.9
conda activate unidoc-bench
pip install -r requirements.txt
export OPENAI_API_KEY="your-key"
export GOOGLE_API_KEY="your-key"
export VOYAGE_API_KEY="your-key" # Optional
β οΈ Note: The full dataset (70k PDF pages) is too large for GitHub. Please download it separately.
Download the Dataset:
π Hugging Face Dataset: Salesforce/UniDoc-Bench - Complete dataset with all PDFs and QA pairs
The dataset includes compressed PDF files for each domain that can be used for RAG database construction:
| Domain | File Size | PDF Count |
|---|---|---|
| π₯ Healthcare | 1.19 GB | 1,098 |
| π Education | 816.9 MB | 812 |
| ποΈ Construction | 844.2 MB | 736 |
| β‘ Energy | 708.4 MB | 766 |
| π₯ CRM | 704.7 MB | 776 |
| βοΈ Legal | 541.4 MB | 909 |
| π Commerce & Manufacturing | 504.9 MB | 719 |
| π° Finance | 360.8 MB | 621 |
data/
βββ final_database/
β βββ healthcare/ # PDFs (download separately)
β βββ ...
βββ QA/
βββ filtered/ # Processed QA datasets (included in repo)
# Create data directory structure
mkdir -p data/final_database
mkdir -p data/QA/filtered
# Download dataset from Hugging Face
from huggingface_hub import hf_hub_download
import tarfile
# Download and extract PDFs for each domain
domains = ["healthcare", "education", "construction", "crm", "energy", "finance", "commerce_manufacturing", "legal"]
for domain in domains:
# Download PDF archive
archive_path = hf_hub_download(
repo_id="Salesforce/UniDoc-Bench",
filename=f"{domain}_pdfs.tar.gz",
repo_type="dataset"
)
# Extract to data directory
with tarfile.open(archive_path, 'r:gz') as tar:
tar.extractall("data/final_database/")
# The QA datasets are already included in the repository
from src.vllm_tagging import process_documents
# Process a single PDF
results = process_documents(
input_path="document.pdf",
model_name="Qwen/Qwen-VL-Chat"
)
# Process a folder of documents
results = process_documents(
input_path="documents/",
model_name="Qwen/Qwen-VL-Chat",
batch_size=10
)
from src.qa_synthesize.kg_create import create_knowledge_graph
# Create knowledge graph
kg = create_knowledge_graph(
name_str="healthcare",
database_path="data/final_database/healthcare_database"
)
from src.evaluation.evaluation_ragas import evaluate_ragas
# Evaluate a RAG system
results = evaluate_ragas(
input_file="results.json",
output_file="evaluation.json",
testsize=500
)
We welcome contributions! Please see our Contributing Guide for details.
If you use UNIDOC-BENCH in your research, please cite:
@article{peng2025unidoc,
title={UNIDOC-BENCH: A Unified Benchmark for Document-Centric Multimodal RAG},
author={Peng, Xiangyu and Qin, Can and Chen, Zeyuan and Xu, Ran and Xiong, Caiming and Wu, Chien-Sheng},
journal={arXiv preprint arXiv:2510.03663},
year={2025}
}
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC-BY-NC 4.0) - see the LICENSE file for details.
π« This dataset was generated using GPT-4.1 and should not be used to develop models that compete with OpenAI.
For questions and support:
A unified benchmark for document-centric multimodal retrieval-augmented generation (MM-RAG). This project provides the first large-scale, realistic benchmark for MM-RAG built from 70k real-world PDF pages across eight domains, with tools for document tagging, dataset synthesis, baseline implementations, and evaluation frameworks.
UNIDOC-BENCH is designed to evaluate and benchmark multimodal document understanding systems across various domains including healthcare, finance, legal, education, and more. The benchmark extracts and links evidence from text, tables, and figures, then generates 1,600 multimodal QA pairs spanning factual retrieval, comparison, summarization, and logical reasoning queries. It supports apples-to-apples comparison across four paradigms: (1) text-only, (2) image-only, (3) multimodal text-image fusion, and (4) multimodal joint retrieval.
Based on the comprehensive evaluation in the UNIDOC-BENCH paper, several important insights emerge:
UNIDOC-BENCH/
βββ src/
β βββ vllm_tagging.py # Document tagging and classification
β βββ qa_synthesize/ # QA dataset synthesis pipeline
β βββ baselines/ # Baseline RAG implementations
β βββ evaluation/ # Evaluation metrics and tools
β βββ tagging_prompts/ # Prompts for document tagging
βββ data/
β βββ QA/filtered/ # Filtered QA datasets by domain
βββ docs/ # Documentation and examples
src/vllm_tagging.py)Automated document tagging and classification system that processes PDF documents and extracts:
Key Features:
src/qa_synthesize/)Complete pipeline for generating high-quality question-answer pairs from document collections:
Pipeline Steps:
1_kg_create.py) - Build knowledge graphs from documents2_qa_synthesize.py) - Generate QA pairs using RAGAS framework3_filter_qa.py) - Filter out low-quality pairs4_filter_similarities.py) - Remove duplicate/similar questions5_balance.py) - Balance question types and difficulty6_rewriting.py) - Improve question quality and diversitySupported Domains:
Dataset Statistics:
src/baselines/)Multiple RAG baseline implementations supporting four paradigms:
simple_rag.py) - Traditional text-based retrievalimage_rag.py) - Visual document retrievalimage_text_rag.py) - Combined text and image retrievalgemini_call.py) - Google Gemini model integrationimage_rag_voyage.py) - Voyage AI embeddingsSupported Models:
src/evaluation/)Comprehensive evaluation suite using RAGAS metrics:
correctness.py) - Answer accuracy assessmentretrieval_eval.py) - Retrieval quality metricsevaluation_ragas.py) - Full RAGAS evaluation pipelineanalysis.py) - Results analysis and visualizationEvaluation Metrics:
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
export OPENAI_API_KEY="your-openai-key"
export GOOGLE_API_KEY="your-google-key" # For Gemini
python src/vllm_tagging.py \
--input_path /path/to/documents \
--output_path /path/to/tagged_output \
--model_name "Qwen/Qwen-VL-Chat"
# Run the complete synthesis pipeline
bash src/qa_synthesize/scripts/create_dataset.sh
# Text RAG baseline
bash src/baselines/scripts/text_rag.sh
# Multimodal RAG baseline
bash src/baselines/scripts/img_text_rag.sh
# Run end-to-end evaluation
bash src/evaluation/scripts/eval_e2e.sh
conda create -n unidoc-bench python=3.9
conda activate unidoc-bench
pip install -r requirements.txt
export OPENAI_API_KEY="your-key"
export GOOGLE_API_KEY="your-key"
export VOYAGE_API_KEY="your-key" # Optional
β οΈ Note: The full dataset (70k PDF pages) is too large for GitHub. Please download it separately.
Download the Dataset:
π Hugging Face Dataset: Salesforce/UniDoc-Bench - Complete dataset with all PDFs and QA pairs
The dataset includes compressed PDF files for each domain that can be used for RAG database construction:
| Domain | File Size | PDF Count |
|---|---|---|
| π₯ Healthcare | 1.19 GB | 1,098 |
| π Education | 816.9 MB | 812 |
| ποΈ Construction | 844.2 MB | 736 |
| β‘ Energy | 708.4 MB | 766 |
| π₯ CRM | 704.7 MB | 776 |
| βοΈ Legal | 541.4 MB | 909 |
| π Commerce & Manufacturing | 504.9 MB | 719 |
| π° Finance | 360.8 MB | 621 |
data/
βββ final_database/
β βββ healthcare/ # PDFs (download separately)
β βββ ...
βββ QA/
βββ filtered/ # Processed QA datasets (included in repo)
# Create data directory structure
mkdir -p data/final_database
mkdir -p data/QA/filtered
# Download dataset from Hugging Face
from huggingface_hub import hf_hub_download
import tarfile
# Download and extract PDFs for each domain
domains = ["healthcare", "education", "construction", "crm", "energy", "finance", "commerce_manufacturing", "legal"]
for domain in domains:
# Download PDF archive
archive_path = hf_hub_download(
repo_id="Salesforce/UniDoc-Bench",
filename=f"{domain}_pdfs.tar.gz",
repo_type="dataset"
)
# Extract to data directory
with tarfile.open(archive_path, 'r:gz') as tar:
tar.extractall("data/final_database/")
# The QA datasets are already included in the repository
from src.vllm_tagging import process_documents
# Process a single PDF
results = process_documents(
input_path="document.pdf",
model_name="Qwen/Qwen-VL-Chat"
)
# Process a folder of documents
results = process_documents(
input_path="documents/",
model_name="Qwen/Qwen-VL-Chat",
batch_size=10
)
from src.qa_synthesize.kg_create import create_knowledge_graph
# Create knowledge graph
kg = create_knowledge_graph(
name_str="healthcare",
database_path="data/final_database/healthcare_database"
)
from src.evaluation.evaluation_ragas import evaluate_ragas
# Evaluate a RAG system
results = evaluate_ragas(
input_file="results.json",
output_file="evaluation.json",
testsize=500
)
We welcome contributions! Please see our Contributing Guide for details.
If you use UNIDOC-BENCH in your research, please cite:
@article{peng2025unidoc,
title={UNIDOC-BENCH: A Unified Benchmark for Document-Centric Multimodal RAG},
author={Peng, Xiangyu and Qin, Can and Chen, Zeyuan and Xu, Ran and Xiong, Caiming and Wu, Chien-Sheng},
journal={arXiv preprint arXiv:2510.03663},
year={2025}
}
This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC-BY-NC 4.0) - see the LICENSE file for details.
π« This dataset was generated using GPT-4.1 and should not be used to develop models that compete with OpenAI.
For questions and support: