Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
V

VLM-R1

> AI 编程
Open source

Solve Visual Understanding with Reinforced VLMs

6.0K stars0 likes0 views
WebsiteGitHub

About

Solve Visual Understanding with Reinforced VLMs

VLM-R1: A stable and generalizable R1-style Large Vision-Language Model

Since the introduction of Deepseek-R1, numerous works have emerged focusing on reproducing and improving upon it. In this project, we propose VLM-R1, a stable and generalizable R1-style Large Vision-Language Model.

Specifically, for the task of Referring Expression Comprehension (REC), we trained Qwen2.5-VL using both R1 and SFT approaches. The results reveal that, on the in-domain test data, the performance of the SFT model shows little change compared to that of the R1 model base model when the number of training steps is relatively small (100–600 steps), while the R1 model shows a steady improvement (as shown at the left of the figure below). More importantly, on the out-of-domain test data, the SFT model's performance deteriorates slightly as the number of steps increases. Nevertheless, the RL model generalizes its reasoning ability to the out-of-domain data (as shown at the right of the figure below).

* We found previous REC SFT exps used a mismatch pixel config. Therefore, we re-run the study with the correct config on a more complex out-of-domain data. See our findings for details.

Features

This repository supports:

  • Full Fine-tuning for GRPO: see run_grpo_rec.sh
  • Freeze Vision Modules: set freeze_vision_modules as true in the script.
  • LoRA Fine-tuning for GRPO: see run_grpo_rec_lora.sh
  • Multi-node Training: see multinode_training_demo.sh
  • Multi-image Input Training: see run_grpo_gui.sh
  • For your own data: see here
  • Various VLMs: see How to add a new model, now we support QwenVL and InternVL

️ Update

  • 2025-08-29: We have further optimized the VLM-R1 series models based on JD's latest open-source inference framework xllm (github is here). The TTFT (Time to First Token) has been reduced by 50% compared to vllm-ascend, and the overall throughput has increased by 127% compared to vllm-ascend. Please refer to ascend_inference/910B/xllm/README.md for more details.

  • 2025-08-22: We have adapted the VLM-R1 series models to Huawei Ascend Atlas 800T A2 and Atlas 300I Duo series using the vllm-ascend framework, further expanding the deployment scenarios and hardware compatibility of the model series. Please refer to ascend_inference/910B/vllm_ascend/README.md and ascend_inference/300IDuo/README.md for more details.

  • 2025-06-26: We introduce a post-resize operation for the bounding box for QwenVL (both training and evaluation) and the results are improved slightly.

  • 2025-04-16: We have updated the codebase to improve functionality and maintain unified implementation. Specifically, the REC process is now integrated into grpo_jsonl.py for consistency across tasks. Additionally, we introduce a new parameter, is_reward_customized_from_vlm_module, which enables the use of customized reward functions defined within the VLM module. When set to true, the reward logic is handled in either QwenVL2Module or InternVLModule, depending on the selected model. Furthermore, the training log has been enhanced to provide more detailed output for easier monitoring and debugging.

  • 2025-04-11: We release the technical report of VLM-R1, summarizing our main results and insights.

  • 2025-04-03: We add the odLength, weighted_sum, and cosine reward used in OVD task, please refer our blog post and findings to the details of the reward usage and see grpo_jsonl.py for code implementation.

  • 2025-03-24: We release the findings of VLM-R1-OVD.

  • 2025-03-23: We release the VLM-R1-OVD model weights and demo, which shows the state-of-the-art performance on OVDEval. Welcome to use it.

  • 2025-03-20: We achieved SOTA results on OVDEval with our RL-based model, outperforming SFT baselines and specialized object detection models. Read our blog post for details on how reinforcement learning enhances object detection performance.

  • 2025-03-17: Our VLM-R1 Math model reaches the top of the Open-Compass Math Leaderboard (under 4B parameters). We have released the checkpoint.

  • 2025-03-15: We support multi-image input data. Check the format of multi-image input here. We also provide an example of multi-image script run_grpo_gui.sh, see here for details.

  • 2025-03-13: We support InternVL for GRPO. See run_grpo_rec_internvl.sh for details. The annotation json files used in InternVL are here. If you want to add your new model, please refer to How to add a new model.

  • 2025-03-02: We support LoRA Fine-tuning for GRPO. See run_grpo_rec_lora.sh for details.

  • 2025-02-27: We support the number of iterations per batch and epsilon value for clipping in the original GRPO algorithm with args: --num_iterations and --epsilon.

  • 2025-02-25: We support multi-node training for GRPO. See multinode_training_demo.sh for details.

  • 2025-02-21: We release the checkpoint of the VLM-R1 REC model.

  • 2025-02-20: We release the script for general data loading.

  • 2025-02-19: We incorporate an explanation of the SFT method.

  • 2025-02-17: We release the VLM-R1 REC Demo on Hugging Face Spaces.

  • 2025-02-15: We release the VLM-R1 repository and GRPO training script.

Models

  • OVD: Trained with VLM-R1, our Open-Vocabulary Detection (OVD) model achieves the state-of-the-art performance on OVDEval.
  • Math: Through VLM-R1 training, our math model focuses on multimodal reasoning tasks and has achieved Top1 on the OpenCompass Multi-modal Reasoning Leaderboard among models < 4B.
  • REC: Trained with VLM-R1, our Referring Expression Comprehension (REC) model showcases the superior performance on out-of-domain data and a series of reasoning-grounding tasks.
  • GUI: Trained with VLM-R1, our GUI Defect Detection model outperforms both base and SFT models by achieving the best accuracy and improved generalization across both defective and clean screens.
Version Base VLM Checkpoint Task Type VLM-R1-Qwen2.5VL-3B-OVD-0321 Qwen2.5VL-3B omlab/VLM-R1-Qwen2.5VL-3B-OVD-0321 Open-Vocabulary Detection VLM-R1-Qwen2.5VL-3B-Math-0305 Qwen2.5VL-3B omlab/VLM-R1-Qwen2.5VL-3B-Math-0305 Multi-Modal Math VLM-R1-Qwen2.5VL-3B-REC-500steps Qwen2.5VL-3B omlab/Qwen2.5VL-3B-VLM-R1-REC-500steps REC/Reasoning-Grounding

ToDo

  • Implement multi-node training.
  • Implement LoRA Fine-tuning.
  • Support more Multimodal LLMs.
  • Support multi-image input.
  • Release the VLM-R1 Math model.
  • Release the blog of VLM-R1.
  • Release the VLM-R1-OVD model.
  • Release the technical report of VLM-R1.
  • Adapt to Huawei Ascend Atlas 800T A2 and Atlas 300I Duo series using the vllm-ascend framework.
  • Adapt to Huawei Ascend Atlas 800T A2 series using the xllm framework.
  • Study cross task generalization.
  • Enhance VLM for other tasks [welcome issue].

️ Setup

conda create -n vlm-r1 python=3.10
conda activate vlm-r1
bash setup.sh

Training

Referring Expression Comprehension (REC)

GRPO

  1. Download the COCO Train2014 image and unzip it, and we refer to the image dir as <your_image_root>.
  2. Download the RefCOCO/+/g and LISA-Grounding Annotation files and unzip it (LISA-Grounding is used for out-of-domain evaluation).
  3. Change the data_paths and image_folders in the run_scripts/run_grpo_rec.sh file.
# These jsonl files are included in the annotation files at step 2.
# Note: please use jsonl files instead of json files.
data_paths="path/to/refcoco_train.jsonl:path/to/refcocop_train.jsonl:path/to/refcocog_train.jsonl"
image_folders="path/to/coco:path/to/coco:path/to/coco"
  1. bash run_scripts/run_grpo_rec.sh

[!NOTE] If you encounter 'CUDA out of memory' error, you can try to reduce the per_device_train_batch_size.

Multi-Node GRPO

For multi-node training, please refers to multinode_training_demo.sh.

SFT

We use LLaMA-Factory to train the SFT model.

  1. Clone the LLaMA-Factory repository and install the dependencies.
git clone https://github.com/hiyouga/LLaMA-Factory.git
cd LLaMA-Factory
pip install -e ".[torch,metrics]"
  1. Download the dataset_info.json, mllm_rec_json.json, and qwen2_5_vl_full_sft.yaml we provided here. Put the json files in the LLaMA-Factory/data directory and the yaml file in the LLaMA-Factory/examples/train_full directory.
  2. Run the following command to train the SFT model.
llamafactory-cli train examples/train_full/qwen2_5_vl_full_sft.yaml

For your own data

The jsonl has the format as follows:

{
  "id": 1,
  "image": "Clevr_CoGenT_TrainA_R1/data/images/CLEVR_trainA_000001_16885.png",
  "conversations": [
    {"from": "human", "value": "<image>What number of purple metallic balls are there?"},
    {"from": "gpt", "value": "0"}
  ]
}
``

GitHub Issues· 0 open

View all on GitHub

No open issues yet, or sync has not completed.

Highlights

  • •Full Fine-tuning for GRPO: see run_grpo_rec.sh
  • •Freeze Vision Modules: set freeze_vision_modules as true in the script.
  • •LoRA Fine-tuning for GRPO: see run_grpo_rec_lora.sh
  • •Multi-node Training: see multinode_training_demo.sh
  • •Multi-image Input Training: see run_grpo_gui.sh
  • •For your own data: see here
  • •Various VLMs: see How to add a new model, now we support QwenVL and InternVL
  • •2025-06-26: We introduce a post-resize operation for the bounding box for QwenVL (both training and evaluation) and the results are improved slightly.
  • •2025-04-11: We release the technical report of VLM-R1, summarizing our main results and insights.
  • •2025-03-24: We release the findings of VLM-R1-OVD.

> Tags

Pythondeepseek-r1grpollmmultimodal

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.