Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
agent
conversational
text-generation-inference
Instructions to use LeonMiao/ViRC-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LeonMiao/ViRC-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="LeonMiao/ViRC-3B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("LeonMiao/ViRC-3B") model = AutoModelForMultimodalLM.from_pretrained("LeonMiao/ViRC-3B", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LeonMiao/ViRC-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LeonMiao/ViRC-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LeonMiao/ViRC-3B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/LeonMiao/ViRC-3B
- SGLang
How to use LeonMiao/ViRC-3B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "LeonMiao/ViRC-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LeonMiao/ViRC-3B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "LeonMiao/ViRC-3B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LeonMiao/ViRC-3B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use LeonMiao/ViRC-3B with Docker Model Runner:
docker model run hf.co/LeonMiao/ViRC-3B
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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<div align="center">
|
| 15 |
+
<img src="docs/logo.png" alt="logo" height="150">
|
| 16 |
+
<h1 style="font-size: 32px; font-weight: bold;"> [CVPR 2026] VΙͺRC: Enhancing Visual Interleaved Mathematical CoT with Reason Chunking </h1>
|
| 17 |
+
|
| 18 |
+
<a href="https://arxiv.org/abs/2512.14654v3"><img src="https://img.shields.io/badge/ArXiv-ViRC-brown?logo=arxiv" alt="Paper"></a>
|
| 19 |
+
<a href="https://huggingface.co/datasets/LeonMiao/CRUX"><img src="https://img.shields.io/badge/π€ huggingface-CRUX-blue" alt="dataset"></a>
|
| 20 |
+
<br>
|
| 21 |
+
<a href="https://huggingface.co/LeonMiao/ViRC-7B"><img src="https://img.shields.io/badge/π€ huggingface-ViRC--7B-purple" alt="checkpoint"></a>
|
| 22 |
+
<a href="https://huggingface.co/LeonMiao/ViRC-3B"><img src="https://img.shields.io/badge/π€ huggingface-ViRC--3B-purple" alt="checkpoint"></a>
|
| 23 |
+
<a href="https://huggingface.co/LeonMiao/ViRC-Qwen2VL-7B"><img src="https://img.shields.io/badge/π€ huggingface-ViRC--Qwen2VL--7B-purple" alt="checkpoint"></a>
|
| 24 |
+
<a href="https://huggingface.co/LeonMiao/ViRC-Qwen2VL-2B"><img src="https://img.shields.io/badge/π€ huggingface-ViRC--Qwen2VL--2B-purple" alt="checkpoint"></a>
|
| 25 |
+
</div>
|
| 26 |
+
|
| 27 |
+
## π₯ News
|
| 28 |
+
|
| 29 |
+
- **[2026.04.09]** We officially open-source the **CRUX dataset** and **ViRC models** as scheduled. π
|
| 30 |
+
- **[2026.03.01]** The **CURX dataset** and **ViRC models** are ready and are currently **under internal review at Ant Group**. Full open-sourcing will be completed **no later than 2026.04.19**.β‘οΈ
|
| 31 |
+
- **[2026.02.21]** ViRC has been accepted by **CVPR 2026**. π
|
| 32 |
+
- **[2025.12.16]** We release the [arxiv paper](https://arxiv.org/abs/2512.14654v3) and the code. π₯
|
| 33 |
+
|
| 34 |
+
## π About VΙͺRC
|
| 35 |
+
|
| 36 |
+
Existing MLLMs typically perform textual reasoning solely from a single static mathematical image, overlooking dynamic visual acquisition during reasoning. In contrast, humans repeatedly examine visual image and employ step-by-step reasoning to prove intermediate propositions. We propose a **ViRC** framework for multimodal mathematical tasks, introducing a **Reason Chunking** mechanism that structures multimodal mathematical CoT into consecutive **C**ritical **R**easoning **U**nits (**CRU**s) to simulate human expert problem-solving patterns. CRUs ensure intra-unit textual coherence for intermediate proposition verification while integrating visual information across units to generate subsequent propositions and support structured reasoning.
|
| 37 |
+
|
| 38 |
+
<p align="center">
|
| 39 |
+
<img src="docs/teaser.png" width="40%"> <br>
|
| 40 |
+
</p>
|
| 41 |
+
|
| 42 |
+
To this end, we present **CRUX dataset** by using **three visual tools** and **four reasoning patterns** to provide explicitly annotated CRUs across multiple reasoning paths for each mathematical problem.
|
| 43 |
+
|
| 44 |
+
<p align="center">
|
| 45 |
+
<img src="docs/data_pipeline.png"> <br>
|
| 46 |
+
</p>
|
| 47 |
+
|
| 48 |
+
Leveraging the CRUX dataset, we propose a progressive training strategy inspired by human cognitive learning, which includes Instructional SFT, Practice SFT, and Strategic RL, aimed at further strengthening the Reason Chunking ability of the model.
|
| 49 |
+
|
| 50 |
+
<p align="center">
|
| 51 |
+
<img src="docs/training_strategy.png" width="40%"> <br>
|
| 52 |
+
</p>
|
| 53 |
+
|
| 54 |
+
The resulting ViRC-7B model achieves a 18.8% average improvement over baselines across multiple mathematical benchmarks and cross-domain high-resolution image benchmarks.
|
| 55 |
+
|
| 56 |
+
## πͺ Get Started
|
| 57 |
+
|
| 58 |
+
### Installation
|
| 59 |
+
|
| 60 |
+
Clone the repository:
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
git clone https://github.com/Leon-LihongWang/ViRC.git
|
| 64 |
+
cd ViRC
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
Create and activate a conda environment:
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
conda create -n virc python=3.10 -y
|
| 71 |
+
conda activate virc
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
Install additional dependencies:
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
bash src/setup.sh
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
### π Training
|
| 81 |
+
|
| 82 |
+
### Preparation
|
| 83 |
+
|
| 84 |
+
Download our [dataset](https://huggingface.co/datasets/LeonMiao/ViRC-100K), and extract `ViRC_images.tar.lz4`:
|
| 85 |
+
|
| 86 |
+
```bash
|
| 87 |
+
huggingface-cli repo download --repo-type dataset LeonMiao/CRUX --local-dir ./data
|
| 88 |
+
cd ./data && lz4 -d ViRC_images.tar.lz4 | tar -xf -
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
Download [Qwen2.5-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct), which is the base model used for training.
|
| 92 |
+
|
| 93 |
+
```bash
|
| 94 |
+
huggingface-cli repo download --repo-type model Qwen/Qwen2.5-VL-7B-Instruct --local-dir ./model
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
#### Stage 1: Instructional SFT
|
| 98 |
+
|
| 99 |
+
```bash
|
| 100 |
+
cd ViRC
|
| 101 |
+
pip install datasets==3.6.0
|
| 102 |
+
DISABLE_VERSION_CHECK=1 llamafactory-cli train src/train/stage_1_InstrSFT.yaml
|
| 103 |
+
```
|
| 104 |
+
|
| 105 |
+
#### Stage 2: Practice SFT
|
| 106 |
+
|
| 107 |
+
```bash
|
| 108 |
+
DISABLE_VERSION_CHECK=1 llamafactory-cli train src/train/stage_2_PracSFT.yaml
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
#### Stage 3: Strategic RL
|
| 112 |
+
|
| 113 |
+
```bash
|
| 114 |
+
pip install datasets==4.0.0
|
| 115 |
+
# Start Qwen2.5-VL-72B-Instruct with vLLM, and update Lines 32, 36, and 37 accordingly (the model-related settings).
|
| 116 |
+
\cp -f src/train/reward_for_scale_dynamic.py ./verl/utils/reward_score/init.py
|
| 117 |
+
bash src/train/stage_3_StratRL
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
#### Notes on Training Config
|
| 121 |
+
|
| 122 |
+
- We provide `src/train/merge_rl_result.sh` to merge Strategic RL outputs and export the final model weights in **safetensors** format.
|
| 123 |
+
- Our training data and scripts support **two image-resolution settings**:
|
| 124 |
+
- **Dynamic resolution** (for models such as **Qwen2.5VL**).
|
| 125 |
+
- **Fixed resolution** (images resized to **1000Γ1000**, for models such as **Qwen2VL/Qwen3VL**).
|
| 126 |
+
These are distinguished by the suffixes `_scale_dynamic` and `_scale_fixed` under `data/` and `src/`.
|
| 127 |
+
- For reproducibility, we release a **50K subset** of the training data (suffix `_50K`) and the **full 100K set** (suffix `_100K`).
|
| 128 |
+
|
| 129 |
+
### π« Inference
|
| 130 |
+
|
| 131 |
+
We provide inference scripts for **two image-resolution settings**:
|
| 132 |
+
|
| 133 |
+
- **Dynamic resolution** (`src/evaluation/ViRC_scale_dynamic.py`): for [ViRC-7B](https://huggingface.co/LeonMiao/ViRC-7B) and [ViRC-3B](https://huggingface.co/LeonMiao/ViRC-3B), based on the **Qwen2.5-VL-Instruct** series.
|
| 134 |
+
- **Fixed resolution (1000Γ1000)** (`src/evaluation/ViRC_scale_fixed.py`): for [ViRC-Qwen2VL-7B](https://huggingface.co/LeonMiao/ViRC-Qwen2VL-7B) and [ViRC-Qwen2VL-2B](https://huggingface.co/LeonMiao/ViRC-Qwen2VL-2B), based on the **Qwen2-VL-Instruct** series.
|
| 135 |
+
|
| 136 |
+
`src/evaluation/` also includes a sample input image (`image.png`) and an expected output example in `src/evaluation/response/` for a quick sanity check.
|
| 137 |
+
|
| 138 |
+
Start the ViRC model with **vLLM**, then run the evaluation script:
|
| 139 |
+
|
| 140 |
+
```bash
|
| 141 |
+
model_path=./ViRC/models/ViRC-7B
|
| 142 |
+
model_name=ViRC
|
| 143 |
+
tensor_parallel_size=4
|
| 144 |
+
port=8000
|
| 145 |
+
|
| 146 |
+
python -u -m vllm.entrypoints.openai.api_server \
|
| 147 |
+
--model $model_path \
|
| 148 |
+
--served-model-name $model_name \
|
| 149 |
+
--dtype auto \
|
| 150 |
+
--tensor-parallel-size $tensor_parallel_size \
|
| 151 |
+
--gpu-memory-utilization 0.9 \
|
| 152 |
+
--port $port
|
| 153 |
+
|
| 154 |
+
python src/evaluation/ViRC_scale_dynamic.py
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
### π₯³ Acknowledgements
|
| 158 |
+
|
| 159 |
+
We would like to thank [LLaMA-Factory](https://github.com/hiyouga/LLaMA-Factory) and [verl](https://github.com/verl-project/verl), upon which our repo is built.
|
| 160 |
+
|
| 161 |
+
## β
Citation
|
| 162 |
+
|
| 163 |
+
```
|
| 164 |
+
@article{wang2025virc,
|
| 165 |
+
title={ViRC: Enhancing Visual Interleaved Mathematical CoT with Reason Chunking},
|
| 166 |
+
author={Lihong, Wang and Liangqi, Li and Weiwei, Feng and Jiamin, Wu and Changtao, Miao and Tieru, Wu and Rui, Ma and Bo, Zhang and Zhe, Li},
|
| 167 |
+
journal={arXiv preprint arXiv:2512.14654},
|
| 168 |
+
year={2025}
|
| 169 |
+
}
|
| 170 |
+
```
|