OpenGVLab/InternVL3_5-14B-Pretrained
182
1---2license: apache-2.03pipeline_tag: image-text-to-text4library_name: transformers5base_model:6 - OpenGVLab/InternViT-300M-448px-V2_57 - Qwen/Qwen3-14B8base_model_relation: merge9datasets:10 - OpenGVLab/MMPR-v1.211 - OpenGVLab/MMPR-Tiny12language:13 - multilingual14tags:15 - internvl16 - custom_code17---18 19# InternVL3_5-14B-Pretrained20 21[\[📂 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)22 23[\[🆕 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/)24 25<div align="center">26 <img width="500" alt="image" src="https://cdn-uploads.huggingface.co/production/uploads/64006c09330a45b03605bba3/zJsd2hqd3EevgXo6fNgC-.png">27</div>28 29## Introduction30 31We 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.32 3334 35> Hatched bars represent closed-source commercial models. We report average scores on a set of multimodal general, reasoning, text, and agentic benchmarks: MMBench v1.1 (en), MMStar,BLINK, HallusionBench, AI2D, OCRBench, MMVet, MME-RealWorld (en), MVBench, VideoMME, MMMU, MathVista, MathVision, MathVerse, DynaMath, WeMath, LogicVista, MATH500, AIME24, AIME25, GPQA, MMLU-Pro, GAOKAO, IFEval, SGP-Bench, VSI-Bench, ERQA, SpaCE-10, and OmniSpatial.36 37See [quick start](#quick-start) for how to use our model.38 39## InternVL3.5 Family40 41In the following table, we provide an overview of the InternVL3.5 series.42To maintain consistency with earlier generations, we provide two model formats: [the GitHub format](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B), consistent with prior releases, and [the HF format](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B-HF), aligned with the official Transformers standard.43 44> If you want to convert the checkpoint between these two formats, please refer to the scripts about [custom2hf](https://github.com/OpenGVLab/InternVL/blob/main/internvl_chat/tools/internvl_custom2hf.py) and [hf2custom](https://github.com/OpenGVLab/InternVL/blob/main/internvl_chat/tools/internvl_hf2custom.py).45 46 47### Github Format48 49 50| Model | #Vision Param | #Language Param | #Total Param | HF Link | ModelScope Link |51| --------------------- | ------------- | --------------- | ------------ | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- |52| InternVL3.5-1B | 0.3B | 0.8B | 1.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B) |53| InternVL3.5-2B | 0.3B | 2.0B | 2.3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B) |54| InternVL3.5-4B | 0.3B | 4.4B | 4.7B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B) |55| InternVL3.5-8B | 0.3B | 8.2B | 8.5B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B) |56| InternVL3.5-14B | 0.3B | 14.8B | 15.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B) |57| InternVL3.5-38B | 5.5B | 32.8B | 38.4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B) |58| InternVL3.5-20B-A4B | 0.3B | 20.9B | 21.2B-A4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview) |59| InternVL3.5-30B-A3B | 0.3B | 30.5B | 30.8B-A3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B) |60| InternVL3.5-241B-A28B | 5.5B | 235.1B | 240.7B-A28B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B) |61 62 63### HuggingFace Format64 65 66| Model | #Vision Param | #Language Param | #Total Param | HF Link | ModelScope Link |67| ------------------------ | ------------- | --------------- | ------------ | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |68| InternVL3.5-1B-HF | 0.3B | 0.8B | 1.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B-HF) |69| InternVL3.5-2B-HF | 0.3B | 2.0B | 2.3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B-HF) |70| InternVL3.5-4B-HF | 0.3B | 4.4B | 4.7B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B-HF) |71| InternVL3.5-8B-HF | 0.3B | 8.2B | 8.5B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B-HF) |72| InternVL3.5-14B-HF | 0.3B | 14.8B | 15.1B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B-HF) |73| InternVL3.5-38B-HF | 5.5B | 32.8B | 38.4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B-HF) |74| InternVL3.5-20B-A4B-HF | 0.3B | 20.9B | 21.2B-A4B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-GPT-OSS-20B-A4B-Preview-HF) |75| InternVL3.5-30B-A3B-HF | 0.3B | 30.5B | 30.8B-A3B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B-HF) |76| InternVL3.5-241B-A28B-HF | 5.5B | 235.1B | 240.7B-A28B | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B-HF) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B-HF) |77 78 7980 81> We conduct the evaluation with [VLMEvalkit](https://github.com/open-compass/VLMEvalKit). ***To enable the Thinking mode of our model, please set the system prompt to [R1_SYSTEM_PROMPT](https://github.com/open-compass/VLMEvalKit/blob/main/vlmeval/vlm/internvl/internvl_chat.py#L38).*** When enabling Thinking mode, we recommend setting `do_sample=True` and `temperature=0.6` to mitigate undesired repetition.82 83Our training pipeline comprises four stages: Multimodal Continual Pre-Training (**CPT**), Supervised Fine-Tuning (**SFT**), and Cascade Reinforcement Learning (**CascadeRL**). In CascadeRL, we first fine-tune the model using Mixed Preference Optimization (**MPO**) under an offline RL setting, followed by **GSPO** under an oneline RL setting.84For the Flash version of InternVL3.5, we additionally introduce a lightweight training stage, termed Visual Consistency Learning (**ViCO**), which reduces the token cost required to represent an image patch.85 8687 88Here, we also open-source the model weights after different training stages for potential research usage.89***If you're unsure which version to use, please select the one without any suffix, as it has completed the full training pipeline.***90 91 92| Model | Training Pipeline | HF Link | ModelScope Link |93| -------------------------------- | --------------------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |94| InternVL3.5-1B-Pretrained | CPT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B-Pretrained) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B-Pretrained) |95| InternVL3.5-1B-Instruct | CPT + SFT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B-Instruct) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B-Instruct) |96| InternVL3.5-1B-MPO | CPT + SFT + MPO | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B-MPO) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B-MPO) |97| InternVL3.5-1B | CPT + SFT + CascadeRL | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-1B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-1B) |98| InternVL3.5-2B-Pretrained | CPT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B-Pretrained) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B-Pretrained) |99| InternVL3.5-2B-Instruct | CPT + SFT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B-Instruct) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B-Instruct) |100| InternVL3.5-2B-MPO | CPT + SFT + MPO | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B-MPO) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B-MPO) |101| InternVL3.5-2B | CPT + SFT + CascadeRL | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-2B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-2B) |102| InternVL3.5-4B-Pretrained | CPT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B-Pretrained) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B-Pretrained) |103| InternVL3.5-4B-Instruct | CPT + SFT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B-Instruct) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B-Instruct) |104| InternVL3.5-4B-MPO | CPT + SFT + MPO | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B-MPO) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B-MPO) |105| InternVL3.5-4B | CPT + SFT + CascadeRL | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-4B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-4B) |106| InternVL3.5-8B-Pretrained | CPT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B-Pretrained) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B-Pretrained) |107| InternVL3.5-8B-Instruct | CPT + SFT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B-Instruct) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B-Instruct) |108| InternVL3.5-8B-MPO | CPT + SFT + MPO | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B-MPO) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B-MPO) |109| InternVL3.5-8B | CPT + SFT + CascadeRL | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-8B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-8B) |110| InternVL3.5-14B-Pretrained | CPT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B-Pretrained) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B-Pretrained) |111| InternVL3.5-14B-Instruct | CPT + SFT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B-Instruct) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B-Instruct) |112| InternVL3.5-14B-MPO | CPT + SFT + MPO | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B-MPO) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B-MPO) |113| InternVL3.5-14B | CPT + SFT + CascadeRL | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-14B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-14B) |114| InternVL3.5-30B-A3B-Pretrained | CPT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B-Pretrained) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B-Pretrained) |115| InternVL3.5-30B-A3B-Instruct | CPT + SFT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B-Instruct) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B-Instruct) |116| InternVL3.5-30B-A3B-MPO | CPT + SFT + MPO | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B-MPO) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B-MPO) |117| InternVL3.5-30B-A3B | CPT + SFT + CascadeRL | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-30B-A3B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-30B-A3B) |118| InternVL3.5-38B-Pretrained | CPT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B-Pretrained) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B-Pretrained) |119| InternVL3.5-38B-Instruct | CPT + SFT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B-Instruct) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B-Instruct) |120| InternVL3.5-38B-MPO | CPT + SFT + MPO | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B-MPO) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B-MPO) |121| InternVL3.5-38B | CPT + SFT + CascadeRL | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-38B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-38B) |122| InternVL3.5-241B-A28B-Pretrained | CPT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B-Pretrained) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B-Pretrained) |123| InternVL3.5-241B-A28B-Instruct | CPT + SFT | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B-Instruct) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B-Instruct) |124| InternVL3.5-241B-A28B-MPO | CPT + SFT + MPO | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B-MPO) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B-MPO) |125| InternVL3.5-241B-A28B | CPT + SFT + CascadeRL | [🤗 link](https://huggingface.co/OpenGVLab/InternVL3_5-241B-A28B) | [🤖 link](https://www.modelscope.cn/models/OpenGVLab/InternVL3_5-241B-A28B) |126 127 128The Flash version of our model will be released as soon as possible.129 130 131 132## Model Architecture133 134`InternVL3.5`:135This series of models follow the "ViT–MLP–LLM" paradigm adopted in previous versions of InternVL.136We initialize the language model using the Qwen3 series and GPT-OSS, and the vision encoder using InternViT-300M and InternViT-6B.137The Dynamic High Resolution strategy introduced in InternVL1.5 is also retained in our design.138 139 140`InternVL3.5-Flash`:141Compared 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. 142Specifically, 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).143In 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.144For 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.145Benefiting 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.146 147 148149 150## Training and Deployment Strategy151 152### Pre-Training153 154During the pre-training stage, we update all model parameters jointly using the combination of large-scale text and multimodal corpora. Specifically, given an arbitrary training sample consisting of a multimodal token sequence \\(\mathbf{x}=\left(x_1, x_2, \ldots, x_L\right)\\), the next token prediction (NTP) loss is calculated on each text token as follows:155 156$$157 \mathcal{L}_{i}=-\log p_\theta\left(x_i \mid x_1, \ldots, x_{i-1}\right),158$$159 160where \\(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.161Additionally, to mitigate bias toward either longer or shorter responses during training, we adopt the square averaging to re-weight the NTP loss as follows:162 163$$164\mathcal{L}_{i}^{'} = \frac{w_i}{\sum_j w_j} \cdot \mathcal{L}_i, \quad w_i = \frac{1}{N^{0.5}},165$$166 167where \\(N\\) denotes the number of tokens in the training sample on which the loss needs to be calculated. The random JPEG compression is also included to enhance the model's real-world performance.168 169### Supervised Fine-Tuning170 171During 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.172Compared to InternVL3, the SFT stage of InternVL3.5 contains more high-quality and diverse training data derived from three sources: 173 174(1) Instruction-following data from InternVL3, which are reused to preserve broad coverage of vision–language tasks. 175 176(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. 177 178(3) Capability-expansion datasets, which endow InternVL3.5 with new skills, including GUI-based interaction, embodied interaction, and scalable vect179 180### Cascade Reinforcement Learning181 182Cascade RL aims to combine the benefits of offline RL and online RL to progressively facilitate the post-training of MLLMs in an efficient manner.183Specifically, 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. 184Subsequently, 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.185 186 187 188During the offline RL stage, we employ mixed preference optimization (MPO) to fine-tune the model. Specifically, the training objective of MPO is a combination of preference loss \\(\mathcal{L}_{p}\\), quality loss \\(\mathcal{L}_{q}\\), and generation loss \\(\mathcal{L}_{g}\\), which can be formulated as follows:189 190$$191 \mathcal{L}_{\text{MPO}}=192 w_{p} \mathcal{L}_{p}193 +194 w_{q} \mathcal{L}_{q}195 +196 w_{g} \mathcal{L}_{g}197 ,198$$199 200where \\(w_{*}\\) represents the weight assigned to each loss component.201The DPO loss, BCO loss, and LM loss serve as the preference loss, quality loss, and generation loss, respectively.202 203 204During the online RL stage, we employ GSPO, without reference model constraints, as our online RL algorithm, which we find more effective in training both dense and mixture-of-experts (MoE) models. Similar to GRPO, the advantage is defined as the normalized reward across responses sampled from the same query.205The training objective of GSPO is given by:206 207$$208 \mathcal{L}_{\mathrm{GSPO}}(\theta)=\mathbb{E}_{x \sim \mathcal{D},\left\{y_i\right\}_{i=1}^G \sim \pi_{\theta \text { old }}(\cdot \mid x)}\left[\frac{1}{G} \sum_{i=1}^G \min \left(s_i(\theta) \widehat{A}_i, \operatorname{clip}\left(s_i(\theta), 1-\varepsilon, 1+\varepsilon\right) \widehat{A}_i\right)\right],209$$210 211where the importance sampling ratio is defined as the geometric mean of the per-token ratios.212 213> Please see [our paper](https://huggingface.co/papers/2508.18265) for more technical and experimental details.214 215 216### Visual Consistency Learning217 218 219We further include ViCO as an additional training stage to integrate the *visual resolution router (ViR)* into InternVL3.5, thereby reducing the inference cost of InternVL3.5. The obtained efficient version of InternVL3.5 are termed as *InternVL3.5-Flash*. In particular, ViCO comprises two stages:220 221`Consistency training`:222In this stage, the entire model is trained to minimize the divergence between response distributions conditioned on visual tokens with different compression rates.223In practice, we introduce an extra reference model, which is frozen and initialized with InternVL3.5.224Given a sample, each image patch is represented as either 256 or 64 tokens, and the training objective is defined as follows:225 226 227$$228\mathcal{L}_\text{ViCO} =229\mathbb{E}_{\xi \sim \mathcal{R}} \Bigg[230\frac{1}{N} \sum_{i=1}^{N} \mathrm{KL} \Big(231\pi_{\theta_{ref}}\left(y_i \mid y_{<i}, I\right) \;\Big\|\;232\pi_{\theta_{policy}}\left(y_i \mid y_{<i}, I_\xi\right)233\Big)234\Bigg],235$$236 237where \\(\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}\).238 239 240`Router training`:241This stage aims to train the ViR to select an appropriate trade-off resolution for different inputs.242ViR is formulated as a binary classifier and trained using standard cross-entropy loss.243To construct the route targets, we first compute the KL divergence between the model outputs conditioned on uncompressed visual tokens (i.e., 256 tokens per patch) and those conditioned on compressed visual tokens (i.e., 64 tokens per patch).244During this stage, the main MLLM (ViT, MLP and LLM) is kept frozen, and only the ViR is trained.245Specifically, we first compute the loss ratio for each patch:246 247$$248r_i = \frac{\mathcal{L}_\text{ViCO}\big(y_i \mid I_{\frac{1}{16}}\big)}{\mathcal{L}_\text{ViCO}\big(y_i \mid I_{\frac{1}{4}}\big)},249$$250 251which quantifies the relative increase in loss caused by compressing the visual tokens. Based on this ratio, the binary ground-truth label for the patch router is defined as:252 253$$254y_i^\text{router} =255\begin{cases}2560, & r_i < \tau \; \text{(compression has negligible impact)} \\2571, & r_i \ge \tau \; \text{(compression has significant impact)},258\end{cases}259$$260 261where \(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.262 263> Please see [our paper](https://huggingface.co/papers/2508.18265) for more technical and experimental details.264 265 266### Test-Time Scaling267 268 269Test-time scaling (TTS) has been empirically demonstrated as an effective approach to enhance the reasoning capabilities of LLMs and MLLMs, particularly for complex tasks necessitating multi-step inference.270In this work, we implement a comprehensive test-time scaling approach that simultaneously improves reasoning depth (i.e., deep thinking) and breadth (i.e., parallel thinking).271 272`Deep Thinking`: By activating the Thinking mode, we guide the model to deliberately engage in step-by-step reasoning (i.e., decomposing complex problems into logical steps and validating intermediate conclusions) prior to generating the final answer. This approach systematically improves the logical structure of solutions for complex problems, particularly those requiring multi-step inference, and enhances reasoning depth.273 274`Parallel Thinking`: Following InternVL3, for reasoning tasks, we adopt the Best-of-N (BoN) strategy by employing [VisualPRM-v1.1](https://huggingface.co/OpenGVLab/VisualPRM-8B-v1_1) as the critic model to select the optimal response from multiple reasoning candidates.275This approach improves reasoning breadth.276 277> Notably, unless otherwise specified, the experimental results reported in our paper are obtained without applying TTS. Thus far, we have only applied TTS to reasoning benchmarks, since we found that the model already exhibits strong perception and understanding capabilities, and initiating TTS yields no significant improvement.278 279 280### Decoupled Vision-Language Deployment281 282In 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. 283When 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.284 285286 287As shown in the Figure above, we propose decoupled vision-language deployment (DvD) to address this issue by separating vision and language processing, with a particular focus on optimizing the prefilling stage. The vision subsystem batches and processes images to produce compact feature embeddings, which are then transmitted to the language subsystem for fusion with the text context prior to decoding. This separation alleviates blocking and brings multimodal prefilling performance closer to that of pure language models.288In our system implementation, the ViT and MLP (and ViR for InternVL3.5-Flash) are deployed on the vision server, while the language server executes only the LLM. The communication is unidirectional, transmitting BF16 visual features over TCP, with RDMA optionally employed to achieve higher transmission speed. Vision processing, feature transmission, and language processing are organized into an asynchronous three-stage pipeline, enabling overlapped execution and minimizing pipeline stalls.289 290 291DvD increases GPU utilization and processing efficiency on the vision side, while enabling the language server to focus exclusively on the LLM’s prefilling and decoding without being blocked by vision computation. This design leads to improved throughput and responsiveness. Moreover, the architecture supports independent hardware cost optimization for the vision and language modules, and facilitates the seamless integration of new modules without requiring modifications to the language server deployment.292 293 294## Evaluation on Multimodal Capability295 296### Multimodal Reasoning and Mathematics297 298299 300### OCR, Chart, and Document Understanding301 302303 304### Multi-Image Understanding & Real-World Comprehension305 306307 308### Comprehensive Multimodal Understanding & Multimodal Hallucination Evaluation309 310311 312### Visual Grounding313 314315 316### Multimodal Multilingual Understanding317 318319 320### Video Understanding321 322323 324### GUI Tasks325 326327 328### Embodied Tasks329 330331 332### SVG Tasks333 334335 336337 338## Evaluation on Language Capability339 340341 342## Ablation Study343 344### Cascade Reinforcement Learning345 346347 348349 350### Decoupled Vision-Language Deployment351 352 353354 355## Quick Start356 357We provide an example code to run `InternVL3.5-8B` using `transformers`. Please note that our models with up to 30B parameters can be deployed on a single A100 GPU, while the 38B model requires two A100 GPUs and the 235B model requires eight A100 GPUs.358 359> In most cases, both [LMDeploy](https://github.com/InternLM/lmdeploy) and [vLLM](https://github.com/vllm-project/vllm) can be used for model deployment. However, for InternVL3.5-20B-A4B, we recommend using vLLM since lmdeploy has not yet supported GPT-OSS.360 361> Please use transformers>=4.52.1 to ensure the model works normally. For the 20B version of our model, transformers>=4.55.0 is required.362 363### Model Loading364 365#### 16-bit (bf16 / fp16)366 367```python368import torch369from transformers import AutoTokenizer, AutoModel370path = "OpenGVLab/InternVL3_5-8B"371model = AutoModel.from_pretrained(372 path,373 torch_dtype=torch.bfloat16,374 low_cpu_mem_usage=True,375 use_flash_attn=True,376 trust_remote_code=True).eval().cuda()377```378 379#### BNB 8-bit Quantization380 381```python382import torch383from transformers import AutoTokenizer, AutoModel384path = "OpenGVLab/InternVL3_5-8B"385model = AutoModel.from_pretrained(386 path,387 torch_dtype=torch.bfloat16,388 load_in_8bit=True,389 low_cpu_mem_usage=True,390 use_flash_attn=True,391 trust_remote_code=True).eval()392```393 394#### Multiple GPUs395 396```python397import math398import torch399from transformers import AutoTokenizer, AutoModel400 401path = "OpenGVLab/InternVL3_5-8B"402model = AutoModel.from_pretrained(403 path,404 torch_dtype=torch.bfloat16,405 low_cpu_mem_usage=True,406 use_flash_attn=True,407 trust_remote_code=True,408 device_map="auto").eval()409```410 411### Thinking Mode412 413To enable thinking mode, please set the system prompt to our Thinking System Prompt. When enabling Thinking mode, we recommend setting `do_sample=True` and `temperature=0.6` to mitigate undesired repetition.414 415```python416R1_SYSTEM_PROMPT = """417You are an AI assistant that rigorously follows this response protocol:418 4191. First, conduct a detailed analysis of the question. Consider different angles, potential solutions, and reason through the problem step-by-step. Enclose this entire thinking process within <think> and </think> tags.420 4212. After the thinking section, provide a clear, concise, and direct answer to the user's question. Separate the answer from the think section with a newline.422 423Ensure that the thinking process is thorough but remains focused on the query. The final answer should be standalone and not reference the thinking section.424""".strip()425 426model.system_message = R1_SYSTEMP_PROMPT427```428 429### Inference with Transformers430 431```python432import math433import numpy as np434import torch435import torchvision.transforms as T436from decord import VideoReader, cpu437from PIL import Image438from torchvision.transforms.functional import InterpolationMode439from transformers import AutoModel, AutoTokenizer440 441IMAGENET_MEAN = (0.485, 0.456, 0.406)442IMAGENET_STD = (0.229, 0.224, 0.225)443 444def build_transform(input_size):445 MEAN, STD = IMAGENET_MEAN, IMAGENET_STD446 transform = T.Compose([447 T.Lambda(lambda img: img.convert('RGB') if img.mode != 'RGB' else img),448 T.Resize((input_size, input_size), interpolation=InterpolationMode.BICUBIC),449 T.ToTensor(),450 T.Normalize(mean=MEAN, std=STD)451 ])452 return transform453 454def find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height, image_size):455 best_ratio_diff = float('inf')456 best_ratio = (1, 1)457 area = width * height458 for ratio in target_ratios:459 target_aspect_ratio = ratio[0] / ratio[1]460 ratio_diff = abs(aspect_ratio - target_aspect_ratio)461 if ratio_diff < best_ratio_diff:462 best_ratio_diff = ratio_diff463 best_ratio = ratio464 elif ratio_diff == best_ratio_diff:465 if area > 0.5 * image_size * image_size * ratio[0] * ratio[1]:466 best_ratio = ratio467 return best_ratio468 469def dynamic_preprocess(image, min_num=1, max_num=12, image_size=448, use_thumbnail=False):470 orig_width, orig_height = image.size471 aspect_ratio = orig_width / orig_height472 473 # calculate the existing image aspect ratio474 target_ratios = set(475 (i, j) for n in range(min_num, max_num + 1) for i in range(1, n + 1) for j in range(1, n + 1) if476 i * j <= max_num and i * j >= min_num)477 target_ratios = sorted(target_ratios, key=lambda x: x[0] * x[1])478 479 # find the closest aspect ratio to the target480 target_aspect_ratio = find_closest_aspect_ratio(481 aspect_ratio, target_ratios, orig_width, orig_height, image_size)482 483 # calculate the target width and height484 target_width = image_size * target_aspect_ratio[0]485 target_height = image_size * target_aspect_ratio[1]486 blocks = target_aspect_ratio[0] * target_aspect_ratio[1]487 488 # resize the image489 resized_img = image.resize((target_width, target_height))490 processed_images = []491 for i in range(blocks):492 box = (493 (i % (target_width // image_size)) * image_size,494 (i // (target_width // image_size)) * image_size,495 ((i % (target_width // image_size)) + 1) * image_size,496 ((i // (target_width // image_size)) + 1) * image_size497 )498 # split the image499 split_img = resized_img.crop(box)500 processed_images.append(split_img)501 assert len(processed_images) == blocks502 if use_thumbnail and len(processed_images) != 1:503 thumbnail_img = image.resize((image_size, image_size))504 processed_images.append(thumbnail_img)505 return processed_images506 507def load_image(image_file, input_size=448, max_num=12):508 image = Image.open(image_file).convert('RGB')509 transform = build_transform(input_size=input_size)510 images = dynamic_preprocess(image, image_size=input_size, use_thumbnail=True, max_num=max_num)511 pixel_values = [transform(image) for image in images]512 pixel_values = torch.stack(pixel_values)513 return pixel_values514 515path = 'OpenGVLab/InternVL3_5-8B'516model = AutoModel.from_pretrained(517 path,518 torch_dtype=torch.bfloat16,519 load_in_8bit=False,520 low_cpu_mem_usage=True,521 use_flash_attn=True,522 trust_remote_code=True,523 device_map="auto").eval()524tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True, use_fast=False)525 526# set the max number of tiles in `max_num`527pixel_values = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()528generation_config = dict(max_new_tokens=1024, do_sample=True)529 530# pure-text conversation (纯文本对话)531question = 'Hello, who are you?'532response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)533print(f'User: {question}\nAssistant: {response}')534 535question = 'Can you tell me a story?'536response, history = model.chat(tokenizer, None, question, generation_config, history=history, return_history=True)537print(f'User: {question}\nAssistant: {response}')538 539# single-image single-round conversation (单图单轮对话)540question = '<image>\nPlease describe the image shortly.'541response = model.chat(tokenizer, pixel_values, question, generation_config)542print(f'User: {question}\nAssistant: {response}')543 544# single-image multi-round conversation (单图多轮对话)545question = '<image>\nPlease describe the image in detail.'546response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)547print(f'User: {question}\nAssistant: {response}')548 549question = 'Please write a poem according to the image.'550response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=history, return_history=True)551print(f'User: {question}\nAssistant: {response}')552 553# multi-image multi-round conversation, combined images (多图多轮对话,拼接图像)554pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()555pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()556pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)557 558question = '<image>\nDescribe the two images in detail.'559response, history = model.chat(tokenizer, pixel_values, question, generation_config,560 history=None, return_history=True)561print(f'User: {question}\nAssistant: {response}')562 563question = 'What are the similarities and differences between these two images.'564response, history = model.chat(tokenizer, pixel_values, question, generation_config,565 history=history, return_history=True)566print(f'User: {question}\nAssistant: {response}')567 568# multi-image multi-round conversation, separate images (多图多轮对话,独立图像)569pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()570pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()571pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)572num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]573 574question = 'Image-1: <image>\nImage-2: <image>\nDescribe the two images in detail.'575response, history = model.chat(tokenizer, pixel_values, question, generation_config,576 num_patches_list=num_patches_list,577 history=None, return_history=True)578print(f'User: {question}\nAssistant: {response}')579 580question = 'What are the similarities and differences between these two images.'581response, history = model.chat(tokenizer, pixel_values, question, generation_config,582 num_patches_list=num_patches_list,583 history=history, return_history=True)584print(f'User: {question}\nAssistant: {response}')585 586# batch inference, single image per sample (单图批处理)587pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()588pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()589num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]590pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)591 592questions = ['<image>\nDescribe the image in detail.'] * len(num_patches_list)593responses = model.batch_chat(tokenizer, pixel_values,594 num_patches_list=num_patches_list,595 questions=questions,596 generation_config=generation_config)597for question, response in zip(questions, responses):598 print(f'User: {question}\nAssistant: {response}')599 600# video multi-round conversation (视频多轮对话)601def get_index(bound, fps, max_frame, first_idx=0, num_segments=32):602 if bound:603 start, end = bound[0], bound[1]604 else:605 start, end = -100000, 100000606 start_idx = max(first_idx, round(start * fps))607 end_idx = min(round(end * fps), max_frame)608 seg_size = float(end_idx - start_idx) / num_segments609 frame_indices = np.array([610 int(start_idx + (seg_size / 2) + np.round(seg_size * idx))611 for idx in range(num_segments)612 ])613 return frame_indices614 615def load_video(video_path, bound=None, input_size=448, max_num=1, num_segments=32):616 vr = VideoReader(video_path, ctx=cpu(0), num_threads=1)617 max_frame = len(vr) - 1618 fps = float(vr.get_avg_fps())619 620 pixel_values_list, num_patches_list = [], []621 transform = build_transform(input_size=input_size)622 frame_indices = get_index(bound, fps, max_frame, first_idx=0, num_segments=num_segments)623 for frame_index in frame_indices:624 img = Image.fromarray(vr[frame_index].asnumpy()).convert('RGB')625 img = dynamic_preprocess(img, image_size=input_size, use_thumbnail=True, max_num=max_num)626 pixel_values = [transform(tile) for tile in img]627 pixel_values = torch.stack(pixel_values)628 num_patches_list.append(pixel_values.shape[0])629 pixel_values_list.append(pixel_values)630 pixel_values = torch.cat(pixel_values_list)631 return pixel_values, num_patches_list632 633video_path = './examples/red-panda.mp4'634pixel_values, num_patches_list = load_video(video_path, num_segments=8, max_num=1)635pixel_values = pixel_values.to(torch.bfloat16).cuda()636video_prefix = ''.join([f'Frame{i+1}: <image>\n' for i in range(len(num_patches_list))])637question = video_prefix + 'What is the red panda doing?'638# Frame1: <image>\nFrame2: <image>\n...\nFrame8: <image>\n{question}639response, history = model.chat(tokenizer, pixel_values, question, generation_config,640 num_patches_list=num_patches_list, history=None, return_history=True)641print(f'User: {question}\nAssistant: {response}')642 643question = 'Describe this video in detail.'644response, history = model.chat(tokenizer, pixel_values, question, generation_config,645 num_patches_list=num_patches_list, history=history, return_history=True)646print(f'User: {question}\nAssistant: {response}')647```648 649#### Streaming Output650 651Besides this method, you can also use the following code to get streamed output.652 653```python654from transformers import TextIteratorStreamer655from threading import Thread656 657# Initialize the streamer658streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True, timeout=10)659# Define the generation configuration660generation_config = dict(max_new_tokens=1024, do_sample=False, streamer=streamer)661# Start the model chat in a separate thread662thread = Thread(target=model.chat, kwargs=dict(663 tokenizer=tokenizer, pixel_values=pixel_values, question=question,664 history=None, return_history=False, generation_config=generation_config,665))666thread.start()667 668# Initialize an empty string to store the generated text669generated_text = ''670# Loop through the streamer to get the new text as it is generated671for new_text in streamer:672 if new_text == model.conv_template.sep:673 break674 generated_text += new_text675 print(new_text, end='', flush=True) # Print each new chunk of generated text on the same line676```677 678## Finetune679 680Many repositories now support fine-tuning of the InternVL series models, including [InternVL](https://github.com/OpenGVLab/InternVL), [SWIFT](https://github.com/modelscope/ms-swift), [XTuner](https://github.com/InternLM/xtuner), and others. Please refer to their documentation for more details on fine-tuning.681 682## Deployment683 684### LMDeploy685 686LMDeploy is a toolkit for compressing, deploying, and serving LLMs & VLMs.687 688```sh689pip install lmdeploy>=0.9.1690```691 692LMDeploy abstracts the complex inference process of multi-modal Vision-Language Models (VLM) into an easy-to-use pipeline, similar to the Large Language Model (LLM) inference pipeline.693 694#### A 'Hello, world' Example695 696```python697from lmdeploy import pipeline, PytorchEngineConfig698from lmdeploy.vl import load_image699 700image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/tests/data/tiger.jpeg')701 702# Please set tp=2 for the 38B version and tp=8 for the 241B-A28B version.703model = 'OpenGVLab/InternVL3_5-8B'704pipe = pipeline(model, backend_config=PytorchEngineConfig(session_len=32768, tp=1))705 706response = pipe(('describe this image', image))707print(response.text)708```709 710#### Multi-images Inference711 712When dealing with multiple images, you can put them all in one list. Keep in mind that multiple images will lead to a higher number of input tokens, and as a result, the size of the context window typically needs to be increased.713 714```python715from lmdeploy import pipeline, PytorchEngineConfig716from lmdeploy.vl import load_image717from lmdeploy.vl.constants import IMAGE_TOKEN718 719# Please set tp=2 for the 38B version and tp=8 for the 241B-A28B version.720model = 'OpenGVLab/InternVL3_5-8B'721pipe = pipeline(model, backend_config=PytorchEngineConfig(session_len=32768, tp=1))722 723image_urls=[724 'https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg',725 'https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/det.jpg'726]727 728images = [load_image(img_url) for img_url in image_urls]729# Numbering images improves multi-image conversations730response = pipe((f'Image-1: {IMAGE_TOKEN}\nImage-2: {IMAGE_TOKEN}\ndescribe these two images', images))731print(response.text)732```733 734#### Batch Prompts Inference735 736Conducting inference with batch prompts is quite straightforward; just place them within a list structure:737 738```python739from lmdeploy import pipeline, PytorchEngineConfig740from lmdeploy.vl import load_image741 742# Please set tp=2 for the 38B version and tp=8 for the 241B-A28B version.743model = 'OpenGVLab/InternVL3_5-8B'744pipe = pipeline(model, backend_config=PytorchEngineConfig(session_len=32768, tp=1))745 746image_urls=[747 "https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg",748 "https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/det.jpg"749]750prompts = [('describe this image', load_image(img_url)) for img_url in image_urls]751response = pipe(prompts)752print(response)753```754 755#### Multi-turn Conversation756 757There are two ways to do the multi-turn conversations with the pipeline. One is to construct messages according to the format of OpenAI and use above introduced method, the other is to use the `pipeline.chat` interface.758 759```python760from lmdeploy import pipeline, PytorchEngineConfig, GenerationConfig761from lmdeploy.vl import load_image762 763# Please set tp=2 for the 38B version and tp=8 for the 241B-A28B version.764model = 'OpenGVLab/InternVL3_5-8B'765pipe = pipeline(model, backend_config=PytorchEngineConfig(session_len=32768, tp=1))766 767image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg')768gen_config = GenerationConfig(top_k=50, top_p=0.95, temperature=0.6, max_new_tokens=8192)769sess = pipe.chat(('describe this image', image), gen_config=gen_config)770print(sess.response.text)771sess = pipe.chat('What is the woman doing?', session=sess, gen_config=gen_config)772print(sess.response.text)773```774 775#### Service776 777LMDeploy's `api_server` enables models to be easily packed into services with a single command. The provided RESTful APIs are compatible with OpenAI's interfaces. Below are an example of service startup:778 779```shell780lmdeploy serve api_server OpenGVLab/InternVL3_5-8B --server-port 23333 --tp 1 --backend pytorch781```782 783To use the OpenAI-style interface, you need to install OpenAI:784 785```shell786pip install openai787```788 789Then, use the code below to make the API call:790 791```python792from openai import OpenAI793 794client = OpenAI(api_key='YOUR_API_KEY', base_url='http://0.0.0.0:23333/v1')795model_name = client.models.list().data[0].id796response = client.chat.completions.create(797 model=model_name,798 messages=[{799 'role':800 'user',801 'content': [{802 'type': 'text',803 'text': 'describe this image',804 }, {805 'type': 'image_url',806 'image_url': {807 'url':808 'https://modelscope.oss-cn-beijing.aliyuncs.com/resource/tiger.jpeg',809 },810 }],811 }],812 temperature=0.8,813 top_p=0.8)814print(response)815```816 817## License818 819This project is released under the apache-2.0 License. This project uses the pre-trained Qwen3 as a component, which is licensed under the apache-2.0 License.820 821## Citation822 823If you find this project useful in your research, please consider citing:824 825```BibTeX826@article{wang2025internvl3_5,827 title={InternVL3.5: Advancing Open-Source Multimodal Models in Versatility, Reasoning, and Efficiency},828 author={Wang, Weiyun and Gao, Zhangwei and Gu, Lixin and Pu, Hengjun and Cui, Long and Wei, Xingguang and Liu, Zhaoyang and Jing, Linglin and Ye, Shenglong and Shao, Jie and others},829 journal={arXiv preprint arXiv:2508.18265},830 year={2025}831}832```833 