Official resources of "MMGraph-Agent: Agentic Multimodal RAG via Cache-Inspired Multimodal Knowledge HyperGraphs". Haoran Luo, Ziyue Zhu, Shangyang Wu, Linhao Luo, Yikai Guo, Qika Lin, Fangzhi Xu, Jiapu Wang, Xiaobao Wu, Yifan Zhu, Luu Anh Tuan. NeurIPS 2026 [paper].
conda create -n mmgraph_agent python==3.10
conda activate mmgraph_agent
pip3 install -e ./verl
pip3 install -r requirements.txt
python -m spacy download en_core_web_lg
playwright install
playwright install-deps # Linux only; may require sudoOn first run, Qwen/Qwen2.5-VL-3B-Instruct and the CLIP embedding model sentence-transformers/clip-ViT-L-14 are downloaded automatically from Hugging Face.
Web search (text and image) goes through SerpAPI. Get a SerpAPI API key and set it before starting the retrieval servers:
export SERPAPI_KEY="your_serpapi_key_here"The dataset is released on Hugging Face. We use 23 datasets in three retrieval settings:
| Setting | Datasets |
|---|---|
| Knowledge Only | DocBench, MMLongBench-Doc, ViDoSeek†, 2WikiMultiHopQA, HotpotQA, Musique, NQ, PopQA†, TriviaQA† |
| WebSearch Only | FVQA†, InfoSeek†, MMSearch†, SimpleVQA†, LiveVQA† |
| Knowledge + WebSearch | MedXpertQA, FinMME, We-Math2.0, R-Bench, MicroVQA, EEmo-Bench, ArtQuest, AstroLLaVA, GeoGrid-Bench |
† Out-of-distribution (O.O.D.) dataset not included in training. The dataset-to-retrieval-mode mapping is defined in configs/datasets_info.py.
Download the data into dataset/:
hf download LHRLAB/MMGraph-Agent --repo-type dataset --local-dir dataset --exclude "test_images/*"
# test_images/ is not needed locally: evaluation reads test images from the HF repo via IMAGE_BASE_URL (see below).The expected layout is:
dataset/
├── all_datasets_corpus.jsonl # Knowledge corpus used to build the hypergraph
├── all_datasets_train.parquet # 600 training samples from 14 in-distribution datasets (ArtQuest has no training samples)
├── all_datasets_test.parquet # 640 test samples from 23 datasets
└── test_images/ # Test images (flat, img_<sha256>.jpg) for the WebSearch / Knowledge + WebSearch datasets
Google Lens image search needs a public URL for each test image. The Hugging Face release provides test_images/ as a flat folder of img_<sha256>.jpg files matching the image paths in the parquet. The URL is built as IMAGE_BASE_URL + <image path in the parquet>, so the prefix must end with /:
export IMAGE_BASE_URL="https://huggingface.co/datasets/LHRLAB/MMGraph-Agent/resolve/main/test_images/"Alternatively, serve a flat folder of these files at any public URL prefix.
Run from the repository root (Qwen2.5-VL-3B-Instruct, GRPO on 8x A100 80GB: 600 training examples, batch size 8, group size G = 8, one epoch of 75 steps):
python -u mmgraph_agent/graph/build.py --corpus dataset/all_datasets_corpus.jsonl --expr_dir expr/ALL && \
bash scripts/serve.sh --kg_dir expr/ALL --mem_dir expr && \
until curl -s -o /dev/null http://localhost:8101 && curl -s -o /dev/null http://localhost:8102; do sleep 10; done && \
bash scripts/train.sh \
--train_data dataset/all_datasets_train.parquet \
--val_data dataset/all_datasets_test.parquet \
--model_path Qwen/Qwen2.5-VL-3B-Instruct \
--gpus 8 --cuda_devices 0,1,2,3,4,5,6,7 \
--wandb_project MMGraph-Agent --wandb_exp train_3B && \
bash scripts/eval.sh \
--val_data dataset/all_datasets_test.parquet \
--model_path Qwen/Qwen2.5-VL-3B-Instruct \
--checkpoint_path checkpoints/MMGraph-Agent/train_3B/global_step_75 \
--gpus 8 --cuda_devices 0,1,2,3,4,5,6,7 \
--results_save_dir results/eval_3B.jsonl \
--wandb_project MMGraph-Agent --wandb_exp eval_3B \
--image_base_url "$IMAGE_BASE_URL"If you find this work is helpful for your research, please cite:
@misc{luo2026mmgraphagent,
title={MMGraph-Agent: Agentic Multimodal RAG via Cache-Inspired Multimodal Knowledge HyperGraphs},
author={Haoran Luo and Ziyue Zhu and Shangyang Wu and Linhao Luo and Yikai Guo and Qika Lin and Fangzhi Xu and Jiapu Wang and Xiaobao Wu and Yifan Zhu and Luu Anh Tuan},
year={2026},
eprint={2611.10657},
archivePrefix={arXiv},
primaryClass={cs.AI},
url={https://arxiv.org/abs/2611.10657},
}For further questions, please contact: haoran.luo@ntu.edu.sg.
This repo benefits from MMSearch-R1, Graph-R1, RAG-Anything, and HyperGraphRAG. Thanks for their wonderful works.
