EVisRAG (VisRAG 2.0)
is an evidence-guided Vision Retrieval-augmented Generation framework that equips VLMs for multi-image questions by first linguistically observing retrieved images to collect per-image evidence, then reasoning over those cues to answer.
EVisRAG
trains with Reward-Scoped GRPO, applying fine-grained token-level rewards to jointly optimize visual perception and reasoning.
🎉 News
20251001: Released
EVisRAG (VisRAG 2.0)
, an end-to-end Vision-Language Model. Released our
Paper
on arXiv. Released our
Model
on Hugging Face. Released our
Code
on GitHub
✨ EVisRAG Pipeline
EVisRAG
is an end-to-end framework which equips VLMs with precise visual perception during reasoning in multi-image scenarios. We trained and realeased VLRMs with EVisRAG built on
Qwen2.5-VL-7B-Instruct
, and
Qwen2.5-VL-3B-Instruct
.
The training data is available on Hugging Face under
EVisRAG-Train
, which is referenced at the beginning of this page.
We adopt a two-stage training strategy. In the first stage, please clone
LLaMA-Factory
and update the model path in the full_sft.sh script. In the second stage, we built our customized algorithm
RS-GRPO
based on
Easy-R1
, specifically designed for EVisRAG, whose implementation can be found in
src/RS-GRPO
.
The test data is available on Hugging Face under
EVisRAG-Test-xxx
, as referenced at the beginning of this page.
To run the evaluation, first execute the
predict.sh
script. The model outputs will be saved in the preds directory. Then, use the
eval.sh
script to evaluate the predictions. The metrics
EM
,
Accuracy
, and
F1
will be reported directly.
from transformers import AutoProcessor
from vllm import LLM, SamplingParams
from qwen_vl_utils import process_vision_info
defevidence_promot_grpo(query):
returnf"""You are an AI Visual QA assistant. I will provide you with a question and several images. Please follow the four steps below:Step 1: Observe the ImagesFirst, analyze the question and consider what types of images may contain relevant information. Then, examine each image one by one, paying special attention to aspects related to the question. Identify whether each image contains any potentially relevant information.Wrap your observations within <observe></observe> tags.Step 2: Record Evidences from ImagesAfter reviewing all images, record the evidence you find for each image within <evidence></evidence> tags.If you are certain that an image contains no relevant information, record it as: [i]: no relevant information(where i denotes the index of the image).If an image contains relevant evidence, record it as: [j]: [the evidence you find for the question](where j is the index of the image).Step 3: Reason Based on the Question and EvidencesBased on the recorded evidences, reason about the answer to the question.Include your step-by-step reasoning within <think></think> tags.Step 4: Answer the QuestionProvide your final answer based only on the evidences you found in the images.Wrap your answer within <answer></answer> tags.Avoid adding unnecessary contents in your final answer, like if the question is a yes/no question, simply answer "yes" or "no".If none of the images contain sufficient information to answer the question, respond with <answer>insufficient to answer</answer>.Formatting Requirements:Use the exact tags <observe>, <evidence>, <think>, and <answer> for structured output.It is possible that none, one, or several images contain relevant evidence.If you find no evidence or few evidences, and insufficient to help you answer the question, follow the instruction above for insufficient information.Question and images are provided below. Please follow the steps as instructed.Question: {query}"""
model_path = "xxx"
processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True, padding_side='left')
imgs, query = ["imgpath1", "imgpath2", ..., "imgpathX"], "What xxx?"
input_prompt = evidence_promot_grpo(query)
content = [{"type": "text", "text": input_prompt}]
for imgP in imgs:
content.append({
"type": "image",
"image": imgP
})
msg = [{
"role": "user",
"content": content,
}]
llm = LLM(
model=model_path,
tensor_parallel_size=1,
dtype="bfloat16",
limit_mm_per_prompt={"image":5, "video":0},
)
sampling_params = SamplingParams(
temperature=0.1,
repetition_penalty=1.05,
max_tokens=2048,
)
prompt = processor.apply_chat_template(
msg,
tokenize=False,
add_generation_prompt=True,
)
image_inputs, _ = process_vision_info(msg)
msg_input = [{
"prompt": prompt,
"multi_modal_data": {"image": image_inputs},
}]
output_texts = llm.generate(msg_input,
sampling_params=sampling_params,
)
print(output_texts[0].outputs[0].text)
📄 License
The code in this repo is released under the
Apache-2.0
License.
EVisRAG-3B huggingface.co is an AI model on huggingface.co that provides EVisRAG-3B's model effect (), which can be used instantly with this openbmb EVisRAG-3B model. huggingface.co supports a free trial of the EVisRAG-3B model, and also provides paid use of the EVisRAG-3B. Support call EVisRAG-3B model through api, including Node.js, Python, http.
EVisRAG-3B huggingface.co is an online trial and call api platform, which integrates EVisRAG-3B's modeling effects, including api services, and provides a free online trial of EVisRAG-3B, you can try EVisRAG-3B online for free by clicking the link below.
openbmb EVisRAG-3B online free url in huggingface.co:
EVisRAG-3B is an open source model from GitHub that offers a free installation service, and any user can find EVisRAG-3B on GitHub to install. At the same time, huggingface.co provides the effect of EVisRAG-3B install, users can directly use EVisRAG-3B installed effect in huggingface.co for debugging and trial. It also supports api for free installation.