Improve InternVL3_5-38B Model Card with Paper Abstract and Project Links

#3
by nielsr HF Staff - opened
Files changed (1) hide show
  1. README.md +152 -50
README.md CHANGED
@@ -1,33 +1,55 @@
1
  ---
2
- license: apache-2.0
3
- pipeline_tag: image-text-to-text
4
- library_name: transformers
5
  base_model:
6
- - OpenGVLab/InternVL3_5-38B-MPO
7
- base_model_relation: finetune
8
  datasets:
9
- - OpenGVLab/MMPR-v1.2
10
- - OpenGVLab/MMPR-Tiny
11
  language:
12
- - multilingual
 
 
 
13
  tags:
14
- - internvl
15
- - custom_code
 
 
 
 
16
  ---
17
 
18
  # InternVL3_5-38B
19
 
20
- [\[📂 GitHub\]](https://github.com/OpenGVLab/InternVL) [\[📜 InternVL 1.0\]](https://huggingface.co/papers/2312.14238) [\[📜 InternVL 1.5\]](https://huggingface.co/papers/2404.16821) [\[📜 InternVL 2.5\]](https://huggingface.co/papers/2412.05271) [\[📜 InternVL2.5-MPO\]](https://huggingface.co/papers/2411.10442) [\[📜 InternVL3\]](https://huggingface.co/papers/2504.10479) [\[📜 InternVL3.5\]](https://huggingface.co/papers/2508.18265)
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
- [\[🆕 Blog\]](https://internvl.github.io/blog/) [\[🗨️ Chat Demo\]](https://chat.intern-ai.org.cn/) [\[🚀 Quick Start\]](#quick-start) [\[📖 Documents\]](https://internvl.readthedocs.io/en/latest/)
 
 
 
 
 
 
23
 
24
  <div align="center">
25
  <img width="500" alt="image" src="https://cdn-uploads.huggingface.co/production/uploads/64006c09330a45b03605bba3/zJsd2hqd3EevgXo6fNgC-.png">
26
  </div>
27
 
28
- ## Introduction
29
 
30
- We introduce *InternVL3.5*, a new family of open-source multimodal models that significantly advances versatility, reasoning capability, and inference efficiency along the InternVL series. A key innovation is the *Cascade Reinforcement Learning (Cascade RL)* framework, which enhances reasoning through a two-stage process: offline RL for stable convergence and online RL for refined alignment. This coarse-to-fine training strategy leads to substantial improvements on downstream reasoning tasks, e.g., MMMU and MathVista. To optimize efficiency, we propose a *Visual Resolution Router (ViR)* that dynamically adjusts the resolution of visual tokens without compromising performance. Coupled with ViR, our Decoupled *Vision-Language Deployment (DvD)* strategy separates the vision encoder and language model across different GPUs, effectively balancing computational load. These contributions collectively enable InternVL3.5 to achieve up to a +16.0\% gain in overall reasoning performance and a 4.05 \\(\times\\) inference speedup compared to its predecessor, i.e., InternVL3. In addition, InternVL3.5 supports novel capabilities such as GUI interaction and embodied agency. Notably, our largest model, i.e., InternVL3.5-241B-A28B, attains state-of-the-art results among open-source MLLMs across general multimodal, reasoning, text, and agentic tasks—narrowing the performance gap with leading commercial models like GPT-5. All models and code are publicly released.
31
 
32
  ![image/jpg](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B/resolve/main/images/performance.jpg)
33
 
@@ -137,11 +159,11 @@ The Dynamic High Resolution strategy introduced in InternVL1.5 is also retained
137
 
138
 
139
  `InternVL3.5-Flash`:
140
- Compared to InternVL3.5, InternVL3.5-Flash further integrates the *Visual Resolution Router (ViR)*, thus yielding a series of efficient variants friendly suitable for resource-constrained scenarios.
141
  Specifically, in InternVL3.5, each image patch is initially represented as 1024 visual tokens for the vision encoder, which are then compressed into 256 tokens via a pixel shuffle module before being passed to the Large Language Model (LLM).
142
  In InternVL3.5-Flash, as shown in the Figure below, an additional pixel shuffle module with a higher compression rate is included, enabling the compression of visual tokens down to 64 tokens.
143
  For each patch, the patch router determines the appropriate compression rate by assessing its semantic richness, and routes it to the corresponding pixel shuffle module accordingly.
144
- Benefiting from this patch-aware compression mechanism, InternVL3.5-Flash is able to reduce the number of visual tokens by 50\% while maintaining nearly 100\% of the performance of InternVL3.5.
145
 
146
 
147
  ![image/jpg](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B/resolve/main/images/architecture.jpg)
@@ -156,8 +178,8 @@ $$
156
  \mathcal{L}_{i}=-\log p_\theta\left(x_i \mid x_1, \ldots, x_{i-1}\right),
157
  $$
158
 
159
- where \\(x_i\\) is the predicted token and prefix tokens in \\(\{x_1, x_2, \ldots, x_{i-1}\}\\) can be either text tokens or image tokens. Notably, for conversation samples, only response tokens are included for the calculation of the loss.
160
- Additionally, to mitigate bias toward either longer or shorter responses during training, we adopt the square averaging to re-weight the NTP loss as follows:
161
 
162
  $$
163
  \mathcal{L}_{i}^{'} = \frac{w_i}{\sum_j w_j} \cdot \mathcal{L}_i, \quad w_i = \frac{1}{N^{0.5}},
@@ -167,20 +189,20 @@ where \\(N\\) denotes the number of tokens in the training sample on which the l
167
 
168
  ### Supervised Fine-Tuning
169
 
170
- During the SFT phase, we adopt the same objective as in the pre-training stage and use the square-root averaging strategy to calculate the final loss. In this stage, the context window is set to 32K tokens to adapt long-context information.
171
- Compared to InternVL3, the SFT stage of InternVL3.5 contains more high-quality and diverse training data derived from three sources:
172
 
173
- (1) Instruction-following data from InternVL3, which are reused to preserve broad coverage of vision–language tasks.
174
 
175
- (2) Multimodal reasoning data in the "Thinking" mode, which are included to instill long-thinking capabilities in the model. To construct such data, we first use InternVL3-78B to describe the image and then input the description into DeepSeek-R1 to sample rollouts with detailed reasoning processes. Rollouts with an incorrect final answer are filtered out. The questions in these datasets cover various expert domains, such as mathematics and scientific disciplines, thereby strengthening performance on different reasoning tasks.
176
 
177
  (3) Capability-expansion datasets, which endow InternVL3.5 with new skills, including GUI-based interaction, embodied interaction, and scalable vect
178
 
179
  ### Cascade Reinforcement Learning
180
 
181
  Cascade RL aims to combine the benefits of offline RL and online RL to progressively facilitate the post-training of MLLMs in an efficient manner.
182
- Specifically, we first fine-tune the model using an offline RL algorithm as an efficient warm-up stage to reach a satisfied results, which can guarantee the high-quality rollouts for the latter stage.
183
- Subsequently, we employ an online RL algorithm to further refine the output distribution based on rollouts generated by the model itself. Compared to the single offline or online RL stage, our cascaded RL achieves significant performance improvements at a fraction of the GPU time cost.
184
 
185
 
186
 
@@ -233,7 +255,7 @@ $$
233
  \Bigg],
234
  $$
235
 
236
- where \\(\mathrm{KL}\) denotes the KL divergence and \(\xi\) denotes the compression rate, which is uniformly sampled from \(\{\frac{1}{4},\frac{1}{16}\}\). The image \(I_\xi\) is represented as 256 tokens when \(\xi=\frac{1}{4}\) and 64 tokens when \(\xi=\frac{1}{16}\). Notably, the reference model always performs inference with \(\xi=\frac{1}{4}\).
237
 
238
 
239
  `Router training`:
@@ -257,7 +279,7 @@ y_i^\text{router} =
257
  \end{cases}
258
  $$
259
 
260
- where \(y_i^{\text{router}}=0\) and \(y_i^{\text{router}}=1\) indicate that the compression rate \(\xi\) is set to \(\tfrac{1}{16}\) and \(\tfrac{1}{4}\), respectively.
261
 
262
  > Please see [our paper](https://huggingface.co/papers/2508.18265) for more technical and experimental details.
263
 
@@ -278,7 +300,8 @@ This approach improves reasoning breadth.
278
 
279
  ### Decoupled Vision-Language Deployment
280
 
281
- In multimodal inference, the vision encoder and language model have distinct computational characteristics. The vision encoder that transforms images into semantic features is highly parallelizable and does not rely on long-term history state. In contrast, the language model adopts the inference in an autoregressive manner, which requires previous states to compute the next one. This sequential property makes the language part more sensitive to memory bandwidth and latency.
 
282
  When MLLMs are deployed online at scale, the vision and language models often block each other, thus incurring additional inference cost. This effect becomes more pronounced with larger vision models or higher-resolution images.
283
 
284
  ![image/jpg](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B/resolve/main/images/DvD.jpg)
@@ -422,7 +445,7 @@ You are an AI assistant that rigorously follows this response protocol:
422
  Ensure that the thinking process is thorough but remains focused on the query. The final answer should be standalone and not reference the thinking section.
423
  """.strip()
424
 
425
- model.system_message = R1_SYSTEMP_PROMPT
426
  ```
427
 
428
  ### Inference with Transformers
@@ -529,40 +552,50 @@ generation_config = dict(max_new_tokens=1024, do_sample=True)
529
  # pure-text conversation (纯文本对话)
530
  question = 'Hello, who are you?'
531
  response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)
532
- print(f'User: {question}\nAssistant: {response}')
 
533
 
534
  question = 'Can you tell me a story?'
535
  response, history = model.chat(tokenizer, None, question, generation_config, history=history, return_history=True)
536
- print(f'User: {question}\nAssistant: {response}')
 
537
 
538
  # single-image single-round conversation (单图单轮对话)
539
- question = '<image>\nPlease describe the image shortly.'
 
540
  response = model.chat(tokenizer, pixel_values, question, generation_config)
541
- print(f'User: {question}\nAssistant: {response}')
 
542
 
543
  # single-image multi-round conversation (单图多轮对话)
544
- question = '<image>\nPlease describe the image in detail.'
 
545
  response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)
546
- print(f'User: {question}\nAssistant: {response}')
 
547
 
548
  question = 'Please write a poem according to the image.'
549
  response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=history, return_history=True)
550
- print(f'User: {question}\nAssistant: {response}')
 
551
 
552
  # multi-image multi-round conversation, combined images (多图多轮对话,拼接图像)
553
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
554
  pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
555
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
556
 
557
- question = '<image>\nDescribe the two images in detail.'
 
558
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
559
  history=None, return_history=True)
560
- print(f'User: {question}\nAssistant: {response}')
 
561
 
562
  question = 'What are the similarities and differences between these two images.'
563
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
564
  history=history, return_history=True)
565
- print(f'User: {question}\nAssistant: {response}')
 
566
 
567
  # multi-image multi-round conversation, separate images (多图多轮对话,独立图像)
568
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
@@ -570,17 +603,20 @@ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat1
570
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
571
  num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
572
 
573
- question = 'Image-1: <image>\nImage-2: <image>\nDescribe the two images in detail.'
 
 
574
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
575
  num_patches_list=num_patches_list,
576
  history=None, return_history=True)
577
- print(f'User: {question}\nAssistant: {response}')
 
578
 
579
  question = 'What are the similarities and differences between these two images.'
580
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
581
- num_patches_list=num_patches_list,
582
- history=history, return_history=True)
583
- print(f'User: {question}\nAssistant: {response}')
584
 
585
  # batch inference, single image per sample (单图批处理)
586
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
@@ -588,13 +624,15 @@ pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat1
588
  num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
589
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
590
 
591
- questions = ['<image>\nDescribe the image in detail.'] * len(num_patches_list)
 
592
  responses = model.batch_chat(tokenizer, pixel_values,
593
  num_patches_list=num_patches_list,
594
  questions=questions,
595
  generation_config=generation_config)
596
  for question, response in zip(questions, responses):
597
- print(f'User: {question}\nAssistant: {response}')
 
598
 
599
  # video multi-round conversation (视频多轮对话)
600
  def get_index(bound, fps, max_frame, first_idx=0, num_segments=32):
@@ -632,17 +670,24 @@ def load_video(video_path, bound=None, input_size=448, max_num=1, num_segments=3
632
  video_path = './examples/red-panda.mp4'
633
  pixel_values, num_patches_list = load_video(video_path, num_segments=8, max_num=1)
634
  pixel_values = pixel_values.to(torch.bfloat16).cuda()
635
- video_prefix = ''.join([f'Frame{i+1}: <image>\n' for i in range(len(num_patches_list))])
 
636
  question = video_prefix + 'What is the red panda doing?'
637
- # Frame1: <image>\nFrame2: <image>\n...\nFrame8: <image>\n{question}
 
 
 
 
638
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
639
  num_patches_list=num_patches_list, history=None, return_history=True)
640
- print(f'User: {question}\nAssistant: {response}')
 
641
 
642
  question = 'Describe this video in detail.'
643
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
644
  num_patches_list=num_patches_list, history=history, return_history=True)
645
- print(f'User: {question}\nAssistant: {response}')
 
646
  ```
647
 
648
  #### Streaming Output
@@ -726,7 +771,9 @@ image_urls=[
726
 
727
  images = [load_image(img_url) for img_url in image_urls]
728
  # Numbering images improves multi-image conversations
729
- response = pipe((f'Image-1: {IMAGE_TOKEN}\nImage-2: {IMAGE_TOKEN}\ndescribe these two images', images))
 
 
730
  print(response.text)
731
  ```
732
 
@@ -828,4 +875,59 @@ If you find this project useful in your research, please consider citing:
828
  journal={arXiv preprint arXiv:2508.18265},
829
  year={2025}
830
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
831
  ```
 
 
 
 
 
 
 
 
 
 
 
1
  ---
 
 
 
2
  base_model:
3
+ - OpenGVLab/InternVL3_5-38B-MPO
 
4
  datasets:
5
+ - OpenGVLab/MMPR-v1.2
6
+ - OpenGVLab/MMPR-Tiny
7
  language:
8
+ - multilingual
9
+ library_name: transformers
10
+ license: apache-2.0
11
+ pipeline_tag: image-text-to-text
12
  tags:
13
+ - internvl
14
+ - custom_code
15
+ - internvl3.5
16
+ papers:
17
+ - 2412.05271
18
+ base_model_relation: finetune
19
  ---
20
 
21
  # InternVL3_5-38B
22
 
23
+ ## Paper
24
+ [Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling](https://huggingface.co/papers/2412.05271)
25
+
26
+ ## Abstract
27
+ We introduce InternVL 2.5, an advanced multimodal large language model (MLLM) series that builds upon InternVL 2.0, maintaining its core model architecture while introducing significant enhancements in training and testing strategies as well as data quality. In this work, we delve into the relationship between model scaling and performance, systematically exploring the performance trends in vision encoders, language models, dataset sizes, and test-time configurations. Through extensive evaluations on a wide range of benchmarks, including multi-discipline reasoning, document understanding, multi-image / video understanding, real-world comprehension, multimodal hallucination detection, visual grounding, multilingual capabilities, and pure language processing, InternVL 2.5 exhibits competitive performance, rivaling leading commercial models such as GPT-4o and Claude-3.5-Sonnet. Notably, our model is the first open-source MLLMs to surpass 70% on the MMMU benchmark, achieving a 3.7-point improvement through Chain-of-Thought (CoT) reasoning and showcasing strong potential for test-time scaling. We hope this model contributes to the open-source community by setting new standards for developing and applying multimodal AI systems. A HuggingFace demo is available at [https://huggingface.co/spaces/OpenGVLab/InternVL](https://huggingface.co/spaces/OpenGVLab/InternVL).
28
+
29
+ ## Project Pages
30
+ - [Hugging Face Space](https://huggingface.co/spaces/OpenGVLab/InternVL)
31
+ - [Chat Demo](https://chat.intern-ai.org.cn/)
32
+ - [Blog](https://internvl.github.io/blog/)
33
+ - [Documents](https://internvl.readthedocs.io/en/latest/)
34
+
35
+ ## GitHub Repository
36
+ [https://github.com/OpenGVLab/InternVL](https://github.com/OpenGVLab/InternVL)
37
 
38
+ ## More InternVL Papers
39
+ - [InternVL 1.0](https://huggingface.co/papers/2312.14238)
40
+ - [InternVL 1.5](https://huggingface.co/papers/2404.16821)
41
+ - [InternVL 2.5](https://huggingface.co/papers/2412.05271)
42
+ - [InternVL2.5-MPO](https://huggingface.co/papers/2411.10442)
43
+ - [InternVL3](https://huggingface.co/papers/2504.10479)
44
+ - [InternVL3.5](https://huggingface.co/papers/2508.18265)
45
 
46
  <div align="center">
47
  <img width="500" alt="image" src="https://cdn-uploads.huggingface.co/production/uploads/64006c09330a45b03605bba3/zJsd2hqd3EevgXo6fNgC-.png">
48
  </div>
49
 
50
+ ## Model Introduction
51
 
52
+ We introduce *InternVL3.5*, a new family of open-source multimodal models that significantly advances versatility, reasoning capability, and inference efficiency along the InternVL series. A key innovation is the *Cascade Reinforcement Learning (Cascade RL)* framework, which enhances reasoning through a two-stage process: offline RL for stable convergence and online RL for refined alignment. This coarse-to-fine training strategy leads to substantial improvements on downstream reasoning tasks, e.g., MMMU and MathVista. To optimize efficiency, we propose a *Visual Resolution Router (ViR)* that dynamically adjusts the resolution of visual tokens without compromising performance. Coupled with ViR, our Decoupled *Vision-Language Deployment (DvD)* strategy separates the vision encoder and language model across different GPUs, effectively balancing computational load. These contributions collectively enable InternVL3.5 to achieve up to a +16.0% gain in overall reasoning performance and a 4.05 \\(\times\\) inference speedup compared to its predecessor, i.e., InternVL3. In addition, InternVL3.5 supports novel capabilities such as GUI interaction and embodied agency. Notably, our largest model, i.e., InternVL3.5-241B-A28B, attains state-of-the-art results among open-source MLLMs across general multimodal, reasoning, text, and agentic tasks—narrowing the performance gap with leading commercial models like GPT-5. All models and code are publicly released.
53
 
54
  ![image/jpg](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B/resolve/main/images/performance.jpg)
55
 
 
159
 
160
 
161
  `InternVL3.5-Flash`:
162
+ Compared to InternVL3.5, InternVL3.5-Flash further integrates the *Visual Resolution Router (ViR)*, thus yielding a series of efficient variants friendly suitable for resource-constrained scenarios.
163
  Specifically, in InternVL3.5, each image patch is initially represented as 1024 visual tokens for the vision encoder, which are then compressed into 256 tokens via a pixel shuffle module before being passed to the Large Language Model (LLM).
164
  In InternVL3.5-Flash, as shown in the Figure below, an additional pixel shuffle module with a higher compression rate is included, enabling the compression of visual tokens down to 64 tokens.
165
  For each patch, the patch router determines the appropriate compression rate by assessing its semantic richness, and routes it to the corresponding pixel shuffle module accordingly.
166
+ Benefiting from this patch-aware compression mechanism, InternVL3.5-Flash is able to reduce the number of visual tokens by 50% while maintaining nearly 100% of the performance of InternVL3.5.
167
 
168
 
169
  ![image/jpg](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B/resolve/main/images/architecture.jpg)
 
178
  \mathcal{L}_{i}=-\log p_\theta\left(x_i \mid x_1, \ldots, x_{i-1}\right),
179
  $$
180
 
181
+ where \\(x_i\\) is the predicted token and prefix tokens in \\(\{x_1, x_2, \ldots, x_{i-1}\}\\) can be either text tokens or image tokens. Notably, for conversation samples, only response tokens are included for the calculation of the loss.
182
+ Additionally, to mitigate bias toward either longer or shorter responses during training, we adopt the square averaging to re-weight the NTP loss as follows:
183
 
184
  $$
185
  \mathcal{L}_{i}^{'} = \frac{w_i}{\sum_j w_j} \cdot \mathcal{L}_i, \quad w_i = \frac{1}{N^{0.5}},
 
189
 
190
  ### Supervised Fine-Tuning
191
 
192
+ During the SFT phase, we adopt the same objective as in the pre-training stage and use the square-root averaging strategy to calculate the final loss. In this stage, the context window is set to 32K tokens to adapt long-context information.
193
+ Compared to InternVL3, the SFT stage of InternVL3.5 contains more high-quality and diverse training data derived from three sources:
194
 
195
+ (1) Instruction-following data from InternVL3, which are reused to preserve broad coverage of vision–language tasks.
196
 
197
+ (2) Multimodal reasoning data in the "Thinking" mode, which are included to instill long-thinking capabilities in the model. To construct such data, we first use InternVL3-78B to describe the image and then input the description into DeepSeek-R1 to sample rollouts with detailed reasoning processes. Rollouts with an incorrect final answer are filtered out. The questions in these datasets cover various expert domains, such as mathematics and scientific disciplines, thereby strengthening performance on different reasoning tasks.
198
 
199
  (3) Capability-expansion datasets, which endow InternVL3.5 with new skills, including GUI-based interaction, embodied interaction, and scalable vect
200
 
201
  ### Cascade Reinforcement Learning
202
 
203
  Cascade RL aims to combine the benefits of offline RL and online RL to progressively facilitate the post-training of MLLMs in an efficient manner.
204
+ Specifically, we first fine-tune the model using an offline RL algorithm as an efficient warm-up stage to reach a satisfied results, which can guarantee the high-quality rollouts for the latter stage.
205
+ Subsequently, we employ an online RL algorithm to further refine the output distribution based on rollouts generated by the model itself. Compared to the single offline or online RL stage, our cascaded RL achieves significant performance improvements at a fraction of the GPU time cost.
206
 
207
 
208
 
 
255
  \Bigg],
256
  $$
257
 
258
+ where \\(\mathrm{KL}\\) denotes the KL divergence and \(\xi\) denotes the compression rate, which is uniformly sampled from \(\{\frac{1}{4},\frac{1}{16}\}\). The image \(I_\xi\) is represented as 256 tokens when \(\xi=\frac{1}{4}\) and 64 tokens when \(\xi=\frac{1}{16}\). Notably, the reference model always performs inference with \(\xi=\frac{1}{4}\).
259
 
260
 
261
  `Router training`:
 
279
  \end{cases}
280
  $$
281
 
282
+ where \(y_i^{\text{router}}=0\) and \(y_i^{\text{router}}=1\) indicate that the compression rate \(\xi\) is set to \(\tfrac{1}{16}\) and \(\tfrac{1}{4}\), respectively.
283
 
284
  > Please see [our paper](https://huggingface.co/papers/2508.18265) for more technical and experimental details.
285
 
 
300
 
301
  ### Decoupled Vision-Language Deployment
302
 
303
+
304
+ In multimodal inference, the vision encoder and language model have distinct computational characteristics. The vision encoder that transforms images into semantic features is highly parallelizable and does not rely on long-term history state. In contrast, the language model adopts the inference in an autoregressive manner, which requires previous states to compute the next one. This sequential property makes the language part more sensitive to memory bandwidth and latency.
305
  When MLLMs are deployed online at scale, the vision and language models often block each other, thus incurring additional inference cost. This effect becomes more pronounced with larger vision models or higher-resolution images.
306
 
307
  ![image/jpg](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B/resolve/main/images/DvD.jpg)
 
445
  Ensure that the thinking process is thorough but remains focused on the query. The final answer should be standalone and not reference the thinking section.
446
  """.strip()
447
 
448
+ model.system_message = R1_SYSTEM_PROMPT
449
  ```
450
 
451
  ### Inference with Transformers
 
552
  # pure-text conversation (纯文本对话)
553
  question = 'Hello, who are you?'
554
  response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)
555
+ print(f'User: {question}
556
+ Assistant: {response}')
557
 
558
  question = 'Can you tell me a story?'
559
  response, history = model.chat(tokenizer, None, question, generation_config, history=history, return_history=True)
560
+ print(f'User: {question}
561
+ Assistant: {response}')
562
 
563
  # single-image single-round conversation (单图单轮对话)
564
+ question = '<image>
565
+ Please describe the image shortly.'
566
  response = model.chat(tokenizer, pixel_values, question, generation_config)
567
+ print(f'User: {question}
568
+ Assistant: {response}')
569
 
570
  # single-image multi-round conversation (单图多轮对话)
571
+ question = '<image>
572
+ Please describe the image in detail.'
573
  response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)
574
+ print(f'User: {question}
575
+ Assistant: {response}')
576
 
577
  question = 'Please write a poem according to the image.'
578
  response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=history, return_history=True)
579
+ print(f'User: {question}
580
+ Assistant: {response}')
581
 
582
  # multi-image multi-round conversation, combined images (多图多轮对话,拼接图像)
583
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
584
  pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()
585
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
586
 
587
+ question = '<image>
588
+ Describe the two images in detail.'
589
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
590
  history=None, return_history=True)
591
+ print(f'User: {question}
592
+ Assistant: {response}')
593
 
594
  question = 'What are the similarities and differences between these two images.'
595
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
596
  history=history, return_history=True)
597
+ print(f'User: {question}
598
+ Assistant: {response}')
599
 
600
  # multi-image multi-round conversation, separate images (多图多轮对话,独立图像)
601
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
 
603
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
604
  num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
605
 
606
+ question = 'Image-1: <image>
607
+ Image-2: <image>
608
+ Describe the two images in detail.'
609
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
610
  num_patches_list=num_patches_list,
611
  history=None, return_history=True)
612
+ print(f'User: {question}
613
+ Assistant: {response}')
614
 
615
  question = 'What are the similarities and differences between these two images.'
616
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
617
+ num_patches_list=num_patches_list, history=history, return_history=True)
618
+ print(f'User: {question}
619
+ Assistant: {response}')
620
 
621
  # batch inference, single image per sample (单图批处理)
622
  pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()
 
624
  num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]
625
  pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)
626
 
627
+ questions = ['<image>
628
+ Describe the image in detail.'] * len(num_patches_list)
629
  responses = model.batch_chat(tokenizer, pixel_values,
630
  num_patches_list=num_patches_list,
631
  questions=questions,
632
  generation_config=generation_config)
633
  for question, response in zip(questions, responses):
634
+ print(f'User: {question}
635
+ Assistant: {response}')
636
 
637
  # video multi-round conversation (视频多轮对话)
638
  def get_index(bound, fps, max_frame, first_idx=0, num_segments=32):
 
670
  video_path = './examples/red-panda.mp4'
671
  pixel_values, num_patches_list = load_video(video_path, num_segments=8, max_num=1)
672
  pixel_values = pixel_values.to(torch.bfloat16).cuda()
673
+ video_prefix = ''.join([f'Frame{i+1}: <image>
674
+ ' for i in range(len(num_patches_list))])
675
  question = video_prefix + 'What is the red panda doing?'
676
+ # Frame1: <image>
677
+ Frame2: <image>
678
+ ...
679
+ Frame8: <image>
680
+ {question}
681
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
682
  num_patches_list=num_patches_list, history=None, return_history=True)
683
+ print(f'User: {question}
684
+ Assistant: {response}')
685
 
686
  question = 'Describe this video in detail.'
687
  response, history = model.chat(tokenizer, pixel_values, question, generation_config,
688
  num_patches_list=num_patches_list, history=history, return_history=True)
689
+ print(f'User: {question}
690
+ Assistant: {response}')
691
  ```
692
 
693
  #### Streaming Output
 
771
 
772
  images = [load_image(img_url) for img_url in image_urls]
773
  # Numbering images improves multi-image conversations
774
+ response = pipe((f'Image-1: {IMAGE_TOKEN}
775
+ Image-2: {IMAGE_TOKEN}
776
+ describe these two images', images))
777
  print(response.text)
778
  ```
779
 
 
875
  journal={arXiv preprint arXiv:2508.18265},
876
  year={2025}
877
  }
878
+ @article{zhu2025internvl3,
879
+ title={Internvl3: Exploring advanced training and test-time recipes for open-source multimodal models},
880
+ author={Zhu, Jinguo and Wang, Weiyun and Chen, Zhe and Liu, Zhaoyang and Ye, Shenglong and Gu, Lixin and Tian, Hao and Duan, Yuchen and Su, Weijie and Shao, Jie and others},
881
+ journal={arXiv preprint arXiv:2504.10479},
882
+ year={2025}
883
+ }
884
+ @article{chen2024expanding,
885
+ title={Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling},
886
+ author={Chen, Zhe and Wang, Weiyun and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Cui, Erfei and Zhu, Jinguo and Ye, Shenglong and Tian, Hao and Liu, Zhaoyang and others},
887
+ journal={arXiv preprint arXiv:2412.05271},
888
+ year={2024}
889
+ }
890
+ @article{wang2024mpo,
891
+ title={Enhancing the Reasoning Ability of Multimodal Large Language Models via Mixed Preference Optimization},
892
+ author={Wang, Weiyun and Chen, Zhe and Wang, Wenhai and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Zhu, Jinguo and Zhu, Xizhou and Lu, Lewei and Qiao, Yu and Dai, Jifeng},
893
+ journal={arXiv preprint arXiv:2411.10442},
894
+ year={2024}
895
+ }
896
+ @article{gao2024mini,
897
+ title={Mini-InternVL: a flexible-transfer pocket multi-modal model with 5% parameters and 90% performance},
898
+ author={Gao, Zhangwei and Chen, Zhe and Cui, Erfei and Ren, Yiming and Wang, Weiyun and Zhu, Jinguo and Tian, Hao and Ye, Shenglong and He, Junjun and Zhu, Xizhou and others},
899
+ journal={Visual Intelligence},
900
+ volume={2},
901
+ number={1},
902
+ pages={1--17},
903
+ year={2024},
904
+ publisher={Springer}
905
+ }
906
+ @article{chen2024far,
907
+ title={How far are we to gpt-4v? closing the gap to commercial multimodal models with open-source suites},
908
+ author={Chen, Zhe and Wang, Weiyun and Tian, Hao and Ye, Shenglong and Gao, Zhangwei and Cui, Erfei and Tong, Wenwen and Hu, Kongzhi and Luo, Jiapeng and Ma, Zheng and others},
909
+ journal={Science China Information Sciences},
910
+ volume={67},
911
+ number={12},
912
+ pages={220101},
913
+ year={2024},
914
+ publisher={Springer}
915
+ }
916
+ @inproceedings{chen2024internvl,
917
+ title={Internvl: Scaling up vision foundation models and aligning for generic visual-linguistic tasks},
918
+ author={Chen, Zhe and Wu, Jiannan and Wang, Wenhai and Su, Weijie and Chen, Guo and Xing, Sen and Zhong, Muyan and Zhang, Qinglong and Zhu, Xizhou and Lu, Lewei and others},
919
+ booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
920
+ pages={24185--24198},
921
+ year={2024}
922
+ }
923
  ```
924
+
925
+ ## Acknowledgement
926
+
927
+ InternVL is built with reference to the code of the following projects: [OpenAI CLIP](https://github.com/openai/CLIP), [Open CLIP](https://github.com/mlfoundations/open_clip), [CLIP Benchmark](https://github.com/LAION-AI/CLIP_benchmark), [EVA](https://github.com/baaivision/EVA/tree/master), [InternImage](https://github.com/OpenGVLab/InternImage), [ViT-Adapter](https://github.com/czczup/ViT-Adapter), [MMSegmentation](https://github.com/open-mmlab/mmsegmentation), [Transformers](https://github.com/huggingface/transformers), [DINOv2](https://github.com/facebookresearch/dinov2), [BLIP-2](https://github.com/salesforce/LAVIS/tree/main/projects/blip2), [Qwen-VL](https://github.com/QwenLM/Qwen-VL/tree/master/eval_mm), and [LLaVA-1.5](https://github.com/haotian-liu/LLaVA). Thanks for their awesome work!
928
+
929
+ ______________________________________________________________________
930
+
931
+ Scan the following QR Code, join our WeChat group.
932
+
933
+ <p align="center"><img width="300" alt="image" src="https://github.com/user-attachments/assets/f776df09-ebba-4fd5-80c2-fec4ff1518be"></p>