支持的模型¶
对于每项任务,我们都列出了已在 vLLM 中实现的模型架构。在每个架构旁边,我们还列出了一些使用该架构的流行模型。
模型实现¶
vLLM¶
如果 vLLM 原生支持某个模型,其实现可以在 vllm/model_executor/models 中找到。
这些模型是我们支持的纯文本模型和支持的多模态模型列表中列出的模型。
Transformers¶
vLLM 也支持 Transformers 中可用的模型实现。在 vLLM 中使用 Transformers 模型实现的性能,预期会与专用的 vLLM 模型实现的性能相差在 5% 以内。我们将此功能称为“Transformers 建模后端”。
目前,Transformers 建模后端适用于以下情况:
- 模态:嵌入模型、语言模型和视觉语言模型*
- 架构:仅编码器、仅解码器、混合专家模型
- 注意力类型:全注意力(full attention)和/或滑动注意力(sliding attention)
*视觉语言模型目前仅接受图像输入。对视频输入的支持将在未来版本中添加。
如果 Transformers 模型实现遵循编写自定义模型中的所有步骤,那么当与 Transformers 建模后端一起使用时,它将与 vLLM 的以下功能兼容:
- 兼容性矩阵中列出的所有功能
- 以下 vLLM 并行化方案的任意组合:
- 数据并行
- 张量并行
- 专家并行
- 流水线并行
检查建模后端是否为 Transformers 非常简单:
from vllm import LLM
llm = LLM(model=...) # Name or path of your model
llm.apply_model(lambda model: print(type(model)))
如果打印出的类型以 `Transformers...` 开头,那么它正在使用 Transformers 模型实现!
如果一个模型有 vLLM 实现,但您更倾向于通过 Transformers 建模后端使用 Transformers 实现,请为离线推理设置 `model_impl="transformers"`,或为在线服务设置 `--model-impl transformers`。
注意
对于视觉语言模型,如果您使用 `dtype="auto"` 加载,vLLM 会使用配置中的 `dtype`(如果存在)加载整个模型。相比之下,原生的 Transformers 会尊重模型中每个主干网络的 `dtype` 属性。这可能会导致性能略有差异。
自定义模型¶
如果一个模型既不被 vLLM 原生支持,也不被 Transformers 支持,它仍然可以在 vLLM 中使用!
要使一个模型与 vLLM 的 Transformers 建模后端兼容,它必须:
- 是一个与 Transformers 兼容的自定义模型(参见 Transformers - 自定义模型)
- 模型目录必须具有正确的结构(例如,存在 `config.json` 文件)。
- `config.json` 必须包含 `auto_map.AutoModel`。
- 是一个与 vLLM 的 Transformers 建模后端兼容的模型(参见 编写自定义模型)
- 自定义应在基础模型中完成(例如,在 `MyModel` 中,而不是 `MyModelForCausalLM` 中)。
如果兼容的模型
- 在 Hugging Face 模型中心上,只需为离线推理设置 `trust_remote_code=True`,或为兼容 OpenAI 的服务器设置 `--trust-remote-code`。
- 在本地目录中,只需将目录路径传递给 `model=<MODEL_DIR>`(用于离线推理)或 `vllm serve <MODEL_DIR>`(用于兼容 OpenAI 的服务器)。
这意味着,借助 vLLM 的 Transformers 建模后端,新模型可以在 Transformers 或 vLLM 正式支持之前就可以使用!
编写自定义模型¶
本节详细说明了为了使一个与 Transformers 兼容的自定义模型与 vLLM 的 Transformers 建模后端兼容,需要进行的必要修改。(我们假设已经创建了一个与 Transformers 兼容的自定义模型,请参阅 Transformers - 自定义模型)。
要使您的模型与 Transformers 建模后端兼容,它需要:
- `kwargs` 从 `MyModel` 到 `MyAttention` 的所有模块中都向下传递。
- 如果您的模型是仅编码器(encoder-only)模型:
- 在 `MyAttention` 中添加 `is_causal = False`。
- 如果您的模型是混合专家(MoE)模型:
- 您的稀疏 MoE 块必须有一个名为 `experts` 的属性。
- `experts` 的类(`MyExperts`)必须
- 继承自 `nn.ModuleList`(朴素实现)。
- 或者包含所有 3D 的 `nn.Parameters`(打包实现)。
- `MyExperts.forward` 必须接受 `hidden_states`, `top_k_index`, `top_k_weights`。
- 如果您的模型是仅编码器(encoder-only)模型:
- `MyAttention` 必须使用 `ALL_ATTENTION_FUNCTIONS` 来调用注意力机制。
- `MyModel` 必须包含 `_supports_attention_backend = True`。
modeling_my_model.py
from transformers import PreTrainedModel
from torch import nn
class MyAttention(nn.Module):
is_causal = False # Only do this for encoder-only models
def forward(self, hidden_states, **kwargs):
...
attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
attn_output, attn_weights = attention_interface(
self,
query_states,
key_states,
value_states,
**kwargs,
)
...
# Only do this for mixture-of-experts models
class MyExperts(nn.ModuleList):
def forward(self, hidden_states, top_k_index, top_k_weights):
...
# Only do this for mixture-of-experts models
class MySparseMoEBlock(nn.Module):
def __init__(self, config):
...
self.experts = MyExperts(config)
...
def forward(self, hidden_states: torch.Tensor):
...
hidden_states = self.experts(hidden_states, top_k_index, top_k_weights)
...
class MyModel(PreTrainedModel):
_supports_attention_backend = True
加载此模型时,后台会发生以下情况:
- 加载配置。
- 从配置中的 `auto_map` 加载 `MyModel` Python 类,并检查模型是否 `is_backend_compatible()`。
- `MyModel` 被加载到 vllm/model_executor/models/transformers 中的一个 Transformers 建模后端类中,该类会设置 `self.config._attn_implementation = "vllm"`,以便使用 vLLM 的注意力层。
就是这样!
为了使您的模型与 vLLM 的张量并行和/或流水线并行功能兼容,您必须将 `base_model_tp_plan` 和/或 `base_model_pp_plan` 添加到您模型的配置类中:
configuration_my_model.py
from transformers import PretrainedConfig
class MyConfig(PretrainedConfig):
base_model_tp_plan = {
"layers.*.self_attn.k_proj": "colwise",
"layers.*.self_attn.v_proj": "colwise",
"layers.*.self_attn.o_proj": "rowwise",
"layers.*.mlp.gate_proj": "colwise",
"layers.*.mlp.up_proj": "colwise",
"layers.*.mlp.down_proj": "rowwise",
}
base_model_pp_plan = {
"embed_tokens": (["input_ids"], ["inputs_embeds"]),
"layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
"norm": (["hidden_states"], ["hidden_states"]),
}
- `base_model_tp_plan` 是一个 `dict`,它将完全限定的层名称模式映射到张量并行样式(目前仅支持 `"colwise"` 和 `"rowwise"`)。
- `base_model_pp_plan` 是一个 `dict`,它将直接子层名称映射到 `tuple`,该 `tuple` 包含 `list` of `str`s。
- 您只需要为那些并非在所有流水线阶段都存在的层执行此操作。
- vLLM 假设只有一个 `nn.ModuleList`,它分布在各个流水线阶段。
- 元组中第一个元素的列表包含输入参数的名称。
- 元组中最后一个元素的列表包含层在您的建模代码中输出的变量名称。
加载模型¶
Hugging Face Hub¶
默认情况下,vLLM 从 Hugging Face (HF) Hub 加载模型。要更改模型的下载路径,您可以设置 `HF_HOME` 环境变量;更多详情,请参阅他们的官方文档。
要确定一个给定的模型是否被原生支持,您可以检查 HF 仓库内的 `config.json` 文件。如果 `"architectures"` 字段包含下面列出的模型架构,那么它应该被原生支持。
模型*不一定*需要被原生支持才能在 vLLM 中使用。Transformers 建模后端使您能够直接使用其 Transformers 实现(甚至是在 Hugging Face 模型中心上的远程代码!)来运行模型。
提示
检查您的模型在运行时是否真的受支持的最简单方法是运行下面的程序:
from vllm import LLM
# For generative models (runner=generate) only
llm = LLM(model=..., runner="generate") # Name or path of your model
output = llm.generate("Hello, my name is")
print(output)
# For pooling models (runner=pooling) only
llm = LLM(model=..., runner="pooling") # Name or path of your model
output = llm.encode("Hello, my name is")
print(output)
如果 vLLM 成功返回文本(对于生成式模型)或隐藏状态(对于池化模型),则表明您的模型受支持。
否则,请参阅添加新模型以获取有关如何在 vLLM 中实现您的模型的说明。或者,您可以在 GitHub 上提出一个 issue 来请求 vLLM 的支持。
下载模型¶
如果您愿意,可以使用 Hugging Face CLI 来下载模型或模型仓库中的特定文件:
# Download a model
huggingface-cli download HuggingFaceH4/zephyr-7b-beta
# Specify a custom cache directory
huggingface-cli download HuggingFaceH4/zephyr-7b-beta --cache-dir ./path/to/cache
# Download a specific file from a model repo
huggingface-cli download HuggingFaceH4/zephyr-7b-beta eval_results.json
列出已下载的模型¶
使用 Hugging Face CLI 来管理存储在本地缓存中的模型:
# List cached models
huggingface-cli scan-cache
# Show detailed (verbose) output
huggingface-cli scan-cache -v
# Specify a custom cache directory
huggingface-cli scan-cache --dir ~/.cache/huggingface/hub
删除缓存的模型¶
使用 Hugging Face CLI 以交互方式从缓存中删除已下载的模型:
命令
# The `delete-cache` command requires extra dependencies to work with the TUI.
# Please run `pip install huggingface_hub[cli]` to install them.
# Launch the interactive TUI to select models to delete
$ huggingface-cli delete-cache
? Select revisions to delete: 1 revisions selected counting for 438.9M.
○ None of the following (if selected, nothing will be deleted).
Model BAAI/bge-base-en-v1.5 (438.9M, used 1 week ago)
❯ ◉ a5beb1e3: main # modified 1 week ago
Model BAAI/bge-large-en-v1.5 (1.3G, used 1 week ago)
○ d4aa6901: main # modified 1 week ago
Model BAAI/bge-reranker-base (1.1G, used 4 weeks ago)
○ 2cfc18c9: main # modified 4 weeks ago
Press <space> to select, <enter> to validate and <ctrl+c> to quit without modification.
# Need to confirm after selected
? Select revisions to delete: 1 revision(s) selected.
? 1 revisions selected counting for 438.9M. Confirm deletion ? Yes
Start deletion.
Done. Deleted 1 repo(s) and 0 revision(s) for a total of 438.9M.
使用代理¶
这里有一些使用代理从 Hugging Face 加载/下载模型的技巧:
- 为您的会话全局设置代理(或在配置文件中设置)
- 仅为当前命令设置代理
https_proxy=http://your.proxy.server:port huggingface-cli download <model_name>
# or use vllm cmd directly
https_proxy=http://your.proxy.server:port vllm serve <model_name>
- 在 Python 解释器中设置代理
import os
os.environ["http_proxy"] = "http://your.proxy.server:port"
os.environ["https_proxy"] = "http://your.proxy.server:port"
ModelScope¶
要使用来自魔搭(ModelScope)而非 Hugging Face Hub 的模型,请设置一个环境变量:
并与 `trust_remote_code=True` 一起使用。
from vllm import LLM
llm = LLM(model=..., revision=..., runner=..., trust_remote_code=True)
# For generative models (runner=generate) only
output = llm.generate("Hello, my name is")
print(output)
# For pooling models (runner=pooling) only
output = llm.encode("Hello, my name is")
print(output)
功能状态图例¶
-
✅︎ 表示该模型支持此功能。
-
🚧 表示该功能已计划但尚未为该模型提供支持。
-
⚠️ 表示该功能可用,但可能存在已知问题或限制。
纯文本语言模型列表¶
生成式模型¶
有关如何使用生成式模型的更多信息,请参阅此页面。
文本生成¶
这些模型主要接受 `LLM.generate` API。聊天/指令模型还额外支持 `LLM.chat` API。
| 架构 | 模型 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|
AfmoeForCausalLM | Afmoe | 待定 | ✅︎ | ✅︎ |
ApertusForCausalLM | Apertus | `swiss-ai/Apertus-8B-2509`、`swiss-ai/Apertus-70B-Instruct-2509` 等。 | ✅︎ | ✅︎ |
AquilaForCausalLM | Aquila、Aquila2 | `BAAI/Aquila-7B`、`BAAI/AquilaChat-7B` 等。 | ✅︎ | ✅︎ |
ArceeForCausalLM | Arcee (AFM) | `arcee-ai/AFM-4.5B-Base` 等。 | ✅︎ | ✅︎ |
ArcticForCausalLM | Arctic | `Snowflake/snowflake-arctic-base`、`Snowflake/snowflake-arctic-instruct` 等。 | ✅︎ | |
BaiChuanForCausalLM | 百川2(Baichuan2)、百川(Baichuan) | `baichuan-inc/Baichuan2-13B-Chat`、`baichuan-inc/Baichuan-7B` 等。 | ✅︎ | ✅︎ |
BailingMoeForCausalLM | 百聆(Ling) | `inclusionAI/Ling-lite-1.5`、`inclusionAI/Ling-plus` 等。 | ✅︎ | ✅︎ |
BailingMoeV2ForCausalLM | 百聆(Ling) | `inclusionAI/Ling-mini-2.0` 等。 | ✅︎ | ✅︎ |
BambaForCausalLM | Bamba | `ibm-ai-platform/Bamba-9B-fp8`, `ibm-ai-platform/Bamba-9B` | ✅︎ | ✅︎ |
BloomForCausalLM | BLOOM、BLOOMZ、BLOOMChat | `bigscience/bloom`、`bigscience/bloomz` 等。 | ✅︎ | |
| `ChatGLMModel`, `ChatGLMForConditionalGeneration` | ChatGLM | `zai-org/chatglm2-6b`、`zai-org/chatglm3-6b`、`ShieldLM-6B-chatglm3` 等。 | ✅︎ | ✅︎ |
| `CohereForCausalLM`, `Cohere2ForCausalLM` | Command-R, Command-A | `CohereLabs/c4ai-command-r-v01`、`CohereLabs/c4ai-command-r7b-12-2024`、`CohereLabs/c4ai-command-a-03-2025`、`CohereLabs/command-a-reasoning-08-2025` 等。 | ✅︎ | ✅︎ |
DbrxForCausalLM | DBRX | `databricks/dbrx-base`、`databricks/dbrx-instruct` 等。 | ✅︎ | |
DeciLMForCausalLM | DeciLM | `nvidia/Llama-3_3-Nemotron-Super-49B-v1` 等。 | ✅︎ | ✅︎ |
DeepseekForCausalLM | DeepSeek | `deepseek-ai/deepseek-llm-67b-base`、`deepseek-ai/deepseek-llm-7b-chat` 等。 | ✅︎ | ✅︎ |
DeepseekV2ForCausalLM | DeepSeek-V2 | `deepseek-ai/DeepSeek-V2`、`deepseek-ai/DeepSeek-V2-Chat` 等。 | ✅︎ | ✅︎ |
DeepseekV3ForCausalLM | DeepSeek-V3 | `deepseek-ai/DeepSeek-V3`、`deepseek-ai/DeepSeek-R1`、`deepseek-ai/DeepSeek-V3.1` 等。 | ✅︎ | ✅︎ |
Dots1ForCausalLM | dots.llm1 | `rednote-hilab/dots.llm1.base`、`rednote-hilab/dots.llm1.inst` 等。 | ✅︎ | |
DotsOCRForCausalLM | dots_ocr | rednote-hilab/dots.ocr | ✅︎ | |
Ernie4_5ForCausalLM | Ernie4.5 | `baidu/ERNIE-4.5-0.3B-PT` 等。 | ✅︎ | ✅︎ |
Ernie4_5_MoeForCausalLM | Ernie4.5MoE | `baidu/ERNIE-4.5-21B-A3B-PT`、`baidu/ERNIE-4.5-300B-A47B-PT` 等。 | ✅︎ | ✅︎ |
ExaoneForCausalLM | EXAONE-3 | `LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct` 等。 | ✅︎ | ✅︎ |
Exaone4ForCausalLM | EXAONE-4 | `LGAI-EXAONE/EXAONE-4.0-32B` 等。 | ✅︎ | ✅︎ |
Fairseq2LlamaForCausalLM | Llama (fairseq2 格式) | `mgleize/fairseq2-dummy-Llama-3.2-1B` 等。 | ✅︎ | ✅︎ |
FalconForCausalLM | Falcon | `tiiuae/falcon-7b`、`tiiuae/falcon-40b`、`tiiuae/falcon-rw-7b` 等。 | ✅︎ | |
FalconMambaForCausalLM | FalconMamba | `tiiuae/falcon-mamba-7b`、`tiiuae/falcon-mamba-7b-instruct` 等。 | ✅︎ | |
FalconH1ForCausalLM | Falcon-H1 | `tiiuae/Falcon-H1-34B-Base`、`tiiuae/Falcon-H1-34B-Instruct` 等。 | ✅︎ | ✅︎ |
FlexOlmoForCausalLM | FlexOlmo | `allenai/FlexOlmo-7x7B-1T`、`allenai/FlexOlmo-7x7B-1T-RT` 等。 | ✅︎ | |
GemmaForCausalLM | Gemma | `google/gemma-2b`、`google/gemma-1.1-2b-it` 等。 | ✅︎ | ✅︎ |
Gemma2ForCausalLM | Gemma 2 | `google/gemma-2-9b`、`google/gemma-2-27b` 等。 | ✅︎ | ✅︎ |
Gemma3ForCausalLM | Gemma 3 | `google/gemma-3-1b-it` 等。 | ✅︎ | ✅︎ |
Gemma3nForCausalLM | Gemma 3n | `google/gemma-3n-E2B-it`、`google/gemma-3n-E4B-it` 等。 | ||
GlmForCausalLM | GLM-4 | `zai-org/glm-4-9b-chat-hf` 等。 | ✅︎ | ✅︎ |
Glm4ForCausalLM | GLM-4-0414 | `zai-org/GLM-4-32B-0414` 等。 | ✅︎ | ✅︎ |
Glm4MoeForCausalLM | GLM-4.5、GLM-4.6 | `zai-org/GLM-4.5` 等。 | ✅︎ | ✅︎ |
GPT2LMHeadModel | GPT-2 | `gpt2`、`gpt2-xl` 等。 | ✅︎ | |
GPTBigCodeForCausalLM | StarCoder, SantaCoder, WizardCoder | `bigcode/starcoder`、`bigcode/gpt_bigcode-santacoder`、`WizardLM/WizardCoder-15B-V1.0` 等。 | ✅︎ | ✅︎ |
GPTJForCausalLM | GPT-J | `EleutherAI/gpt-j-6b`、`nomic-ai/gpt4all-j` 等。 | ✅︎ | |
GPTNeoXForCausalLM | GPT-NeoX、Pythia、OpenAssistant、Dolly V2、StableLM | `EleutherAI/gpt-neox-20b`、`EleutherAI/pythia-12b`、`OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5`、`databricks/dolly-v2-12b`、`stabilityai/stablelm-tuned-alpha-7b` 等。 | ✅︎ | |
GptOssForCausalLM | GPT-OSS | `openai/gpt-oss-120b`, `openai/gpt-oss-20b` | ✅︎ | |
GraniteForCausalLM | Granite 3.0, Granite 3.1, PowerLM | `ibm-granite/granite-3.0-2b-base`、`ibm-granite/granite-3.1-8b-instruct`、`ibm/PowerLM-3b` 等。 | ✅︎ | ✅︎ |
GraniteMoeForCausalLM | Granite 3.0 MoE, PowerMoE | `ibm-granite/granite-3.0-1b-a400m-base`、`ibm-granite/granite-3.0-3b-a800m-instruct`、`ibm/PowerMoE-3b` 等。 | ✅︎ | ✅︎ |
GraniteMoeHybridForCausalLM | Granite 4.0 MoE 混合模型 | `ibm-granite/granite-4.0-tiny-preview` 等。 | ✅︎ | ✅︎ |
GraniteMoeSharedForCausalLM | Granite MoE 共享模型 | `ibm-research/moe-7b-1b-active-shared-experts` (测试模型) | ✅︎ | ✅︎ |
GritLM | GritLM | parasail-ai/GritLM-7B-vllm. | ✅︎ | ✅︎ |
Grok1ModelForCausalLM | Grok1 | hpcai-tech/grok-1. | ✅︎ | ✅︎ |
HunYuanDenseV1ForCausalLM | 混元 Dense | tencent/Hunyuan-7B-Instruct | ✅︎ | ✅︎ |
HunYuanMoEV1ForCausalLM | Hunyuan-A13B | `tencent/Hunyuan-A13B-Instruct`、`tencent/Hunyuan-A13B-Pretrain`、`tencent/Hunyuan-A13B-Instruct-FP8` 等。 | ✅︎ | ✅︎ |
HCXVisionForCausalLM | HyperCLOVAX-SEED-Vision-Instruct-3B | naver-hyperclovax/HyperCLOVAX-SEED-Vision-Instruct-3B | ||
InternLMForCausalLM | InternLM | `internlm/internlm-7b`、`internlm/internlm-chat-7b` 等。 | ✅︎ | ✅︎ |
InternLM2ForCausalLM | InternLM2 | `internlm/internlm2-7b`、`internlm/internlm2-chat-7b` 等。 | ✅︎ | ✅︎ |
InternLM3ForCausalLM | InternLM3 | `internlm/internlm3-8b-instruct` 等。 | ✅︎ | ✅︎ |
JAISLMHeadModel | Jais | `inceptionai/jais-13b`、`inceptionai/jais-13b-chat`、`inceptionai/jais-30b-v3`、`inceptionai/jais-30b-chat-v3` 等。 | ✅︎ | |
JambaForCausalLM | Jamba | `ai21labs/AI21-Jamba-1.5-Large`、`ai21labs/AI21-Jamba-1.5-Mini`、`ai21labs/Jamba-v0.1` 等。 | ✅︎ | ✅︎ |
KimiLinearForCausalLM | Kimi-Linear-48B-A3B-Base, Kimi-Linear-48B-A3B-Instruct | `moonshotai/Kimi-Linear-48B-A3B-Base`, `moonshotai/Kimi-Linear-48B-A3B-Instruct` | ✅︎ | |
Lfm2ForCausalLM | LFM2 | `LiquidAI/LFM2-1.2B`、`LiquidAI/LFM2-700M`、`LiquidAI/LFM2-350M` 等。 | ✅︎ | ✅︎ |
Lfm2MoeForCausalLM | LFM2MoE | `LiquidAI/LFM2-8B-A1B-preview` 等。 | ✅︎ | ✅︎ |
LlamaForCausalLM | Llama 3.1、Llama 3、Llama 2、LLaMA、Yi | `meta-llama/Meta-Llama-3.1-405B-Instruct`、`meta-llama/Meta-Llama-3.1-70B`、`meta-llama/Meta-Llama-3-70B-Instruct`、`meta-llama/Llama-2-70b-hf`、`01-ai/Yi-34B` 等。 | ✅︎ | ✅︎ |
MambaForCausalLM | Mamba | `state-spaces/mamba-130m-hf`、`state-spaces/mamba-790m-hf`、`state-spaces/mamba-2.8b-hf` 等。 | ✅︎ | |
Mamba2ForCausalLM | Mamba2 | `mistralai/Mamba-Codestral-7B-v0.1` 等。 | ✅︎ | |
MiMoForCausalLM | MiMo | `XiaomiMiMo/MiMo-7B-RL` 等。 | ✅︎ | ✅︎ |
MiniCPMForCausalLM | MiniCPM | `openbmb/MiniCPM-2B-sft-bf16`、`openbmb/MiniCPM-2B-dpo-bf16`、`openbmb/MiniCPM-S-1B-sft` 等。 | ✅︎ | ✅︎ |
MiniCPM3ForCausalLM | MiniCPM3 | `openbmb/MiniCPM3-4B` 等。 | ✅︎ | ✅︎ |
MiniMaxM2ForCausalLM | MiniMax-M2 | `MiniMaxAI/MiniMax-M2` 等。 | ✅︎ | |
MistralForCausalLM | Ministral-3、Mistral、Mistral-Instruct | `mistralai/Ministral-3-3B-Instruct-2512`、`mistralai/Mistral-7B-v0.1`、`mistralai/Mistral-7B-Instruct-v0.1` 等。 | ✅︎ | ✅︎ |
MistralLarge3ForCausalLM | Mistral-Large-3-675B-Base-2512, Mistral-Large-3-675B-Instruct-2512 | `mistralai/Mistral-Large-3-675B-Base-2512`、`mistralai/Mistral-Large-3-675B-Instruct-2512` 等。 | ✅︎ | ✅︎ |
MixtralForCausalLM | Mixtral-8x7B、Mixtral-8x7B-Instruct | `mistralai/Mixtral-8x7B-v0.1`、`mistralai/Mixtral-8x7B-Instruct-v0.1`、`mistral-community/Mixtral-8x22B-v0.1` 等。 | ✅︎ | ✅︎ |
MPTForCausalLM | MPT、MPT-Instruct、MPT-Chat、MPT-StoryWriter | `mosaicml/mpt-7b`、`mosaicml/mpt-7b-storywriter`、`mosaicml/mpt-30b` 等。 | ✅︎ | |
NemotronForCausalLM | Nemotron-3, Nemotron-4, Minitron | `nvidia/Minitron-8B-Base`、`mgoin/Nemotron-4-340B-Base-hf-FP8` 等。 | ✅︎ | ✅︎ |
NemotronHForCausalLM | Nemotron-H | `nvidia/Nemotron-H-8B-Base-8K`、`nvidia/Nemotron-H-47B-Base-8K`、`nvidia/Nemotron-H-56B-Base-8K` 等。 | ✅︎ | ✅︎ |
OLMoForCausalLM | OLMo | `allenai/OLMo-1B-hf`、`allenai/OLMo-7B-hf` 等。 | ✅︎ | ✅︎ |
OLMo2ForCausalLM | OLMo2 | `allenai/OLMo-2-0425-1B` 等。 | ✅︎ | ✅︎ |
OLMo3ForCausalLM | OLMo3 | `allenai/Olmo-3-7B-Instruct`、`allenai/Olmo-3-32B-Think` 等。 | ✅︎ | ✅︎ |
OLMoEForCausalLM | OLMoE | `allenai/OLMoE-1B-7B-0924`、`allenai/OLMoE-1B-7B-0924-Instruct` 等。 | ✅︎ | |
OPTForCausalLM | OPT、OPT-IML | `facebook/opt-66b`、`facebook/opt-iml-max-30b` 等。 | ✅︎ | ✅︎ |
OrionForCausalLM | Orion | `OrionStarAI/Orion-14B-Base`、`OrionStarAI/Orion-14B-Chat` 等。 | ✅︎ | |
OuroForCausalLM | ouro | `ByteDance/Ouro-1.4B`、`ByteDance/Ouro-2.6B` 等。 | ✅︎ | |
PanguEmbeddedForCausalLM | openPangu-Embedded-7B | FreedomIntelligence/openPangu-Embedded-7B-V1.1 | ✅︎ | ✅︎ |
PanguUltraMoEForCausalLM | openpangu-ultra-moe-718b-model | FreedomIntelligence/openPangu-Ultra-MoE-718B-V1.1 | ✅︎ | ✅︎ |
PhiForCausalLM | Phi | `microsoft/phi-1_5`、`microsoft/phi-2` 等。 | ✅︎ | ✅︎ |
Phi3ForCausalLM | Phi-4、Phi-3 | `microsoft/Phi-4-mini-instruct`、`microsoft/Phi-4`、`microsoft/Phi-3-mini-4k-instruct`、`microsoft/Phi-3-mini-128k-instruct`、`microsoft/Phi-3-medium-128k-instruct` 等。 | ✅︎ | ✅︎ |
PhiMoEForCausalLM | Phi-3.5-MoE | `microsoft/Phi-3.5-MoE-instruct` 等。 | ✅︎ | ✅︎ |
PersimmonForCausalLM | Persimmon | `adept/persimmon-8b-base`、`adept/persimmon-8b-chat` 等。 | ✅︎ | |
Plamo2ForCausalLM | PLaMo2 | `pfnet/plamo-2-1b`、`pfnet/plamo-2-8b` 等。 | ✅︎ | |
Plamo3ForCausalLM | PLaMo3 | `pfnet/plamo-3-nict-2b-base`、`pfnet/plamo-3-nict-8b-base` 等。 | ✅︎ | |
QWenLMHeadModel | Qwen | `Qwen/Qwen-7B`、`Qwen/Qwen-7B-Chat` 等。 | ✅︎ | ✅︎ |
Qwen2ForCausalLM | QwQ、Qwen2 | `Qwen/QwQ-32B-Preview`、`Qwen/Qwen2-7B-Instruct`、`Qwen/Qwen2-7B` 等。 | ✅︎ | ✅︎ |
Qwen2MoeForCausalLM | Qwen2MoE | `Qwen/Qwen1.5-MoE-A2.7B`、`Qwen/Qwen1.5-MoE-A2.7B-Chat` 等。 | ✅︎ | ✅︎ |
Qwen3ForCausalLM | Qwen3 | `Qwen/Qwen3-8B` 等。 | ✅︎ | ✅︎ |
Qwen3MoeForCausalLM | Qwen3MoE | `Qwen/Qwen3-30B-A3B` 等。 | ✅︎ | ✅︎ |
Qwen3NextForCausalLM | Qwen3NextMoE | `Qwen/Qwen3-Next-80B-A3B-Instruct` 等。 | ✅︎ | ✅︎ |
SeedOssForCausalLM | SeedOss | `ByteDance-Seed/Seed-OSS-36B-Instruct` 等。 | ✅︎ | ✅︎ |
StableLmForCausalLM | StableLM | `stabilityai/stablelm-3b-4e1t`、`stabilityai/stablelm-base-alpha-7b-v2` 等。 | ||
Starcoder2ForCausalLM | Starcoder2 | `bigcode/starcoder2-3b`、`bigcode/starcoder2-7b`、`bigcode/starcoder2-15b` 等。 | ✅︎ | |
SolarForCausalLM | Solar Pro | `upstage/solar-pro-preview-instruct` 等。 | ✅︎ | ✅︎ |
TeleChat2ForCausalLM | TeleChat2 | `Tele-AI/TeleChat2-3B`、`Tele-AI/TeleChat2-7B`、`Tele-AI/TeleChat2-35B` 等。 | ✅︎ | ✅︎ |
TeleFLMForCausalLM | TeleFLM | `CofeAI/FLM-2-52B-Instruct-2407`、`CofeAI/Tele-FLM` 等。 | ✅︎ | ✅︎ |
XverseForCausalLM | XVERSE | `xverse/XVERSE-7B-Chat`、`xverse/XVERSE-13B-Chat`、`xverse/XVERSE-65B-Chat` 等。 | ✅︎ | ✅︎ |
MiniMaxM1ForCausalLM | MiniMax-Text | `MiniMaxAI/MiniMax-M1-40k`、`MiniMaxAI/MiniMax-M1-80k` 等。 | ||
MiniMaxText01ForCausalLM | MiniMax-Text | `MiniMaxAI/MiniMax-Text-01` 等。 | ||
Zamba2ForCausalLM | Zamba2 | `Zyphra/Zamba2-7B-instruct`、`Zyphra/Zamba2-2.7B-instruct`、`Zyphra/Zamba2-1.2B-instruct` 等。 | ||
LongcatFlashForCausalLM | LongCat-Flash | `meituan-longcat/LongCat-Flash-Chat`, `meituan-longcat/LongCat-Flash-Chat-FP8` | ✅︎ | ✅︎ |
一些模型仅通过Transformers 建模后端支持。下表旨在确认我们以这种方式正式支持的模型。日志将显示正在使用 Transformers 建模后端,并且您不会看到任何关于这是后备行为的警告。这意味着,如果您对下面列出的任何模型有疑问,请提出一个 issue,我们将尽力修复它!
| 架构 | 模型 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|
SmolLM3ForCausalLM | SmolLM3 | HuggingFaceTB/SmolLM3-3B | ✅︎ | ✅︎ |
注意
目前,vLLM 的 ROCm 版本仅支持 Mistral 和 Mixtral 模型,且上下文长度最高为 4096。
池化模型¶
有关如何使用池化模型的更多信息,请参阅此页面。
重要
由于一些模型架构同时支持生成任务和池化任务,您应明确指定 `--runner pooling` 以确保模型在池化模式下使用,而不是生成模式。
嵌入(Embedding)¶
这些模型主要支持 `LLM.embed` API。
| 架构 | 模型 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|
BertModelC | 基于 BERT 的模型 | `BAAI/bge-base-en-v1.5`、`Snowflake/snowflake-arctic-embed-xs` 等。 | ||
BertSpladeSparseEmbeddingModel | SPLADE | naver/splade-v3 | ||
Gemma2ModelC | 基于 Gemma 2 的模型 | `BAAI/bge-multilingual-gemma2` 等。 | ✅︎ | ✅︎ |
Gemma3TextModelC | 基于 Gemma 3 的模型 | `google/embeddinggemma-300m` 等。 | ✅︎ | ✅︎ |
GritLM | GritLM | parasail-ai/GritLM-7B-vllm. | ✅︎ | ✅︎ |
GteModelC | Arctic-Embed-2.0-M | Snowflake/snowflake-arctic-embed-m-v2.0. | ||
GteNewModelC | mGTE-TRM (见注) | `Alibaba-NLP/gte-multilingual-base` 等。 | ||
ModernBertModelC | 基于 ModernBERT 的模型 | `Alibaba-NLP/gte-modernbert-base` 等。 | ||
NomicBertModelC | Nomic BERT | `nomic-ai/nomic-embed-text-v1`、`nomic-ai/nomic-embed-text-v2-moe`、`Snowflake/snowflake-arctic-embed-m-long` 等。 | ||
LlamaModelC、LlamaForCausalLMC、MistralModelC 等。 | 基于 Llama 的模型 | `intfloat/e5-mistral-7b-instruct` 等。 | ✅︎ | ✅︎ |
Qwen2ModelC, Qwen2ForCausalLMC | 基于 Qwen2 的模型 | `ssmits/Qwen2-7B-Instruct-embed-base` (见注)、`Alibaba-NLP/gte-Qwen2-7B-instruct` (见注) 等。 | ✅︎ | ✅︎ |
Qwen3ModelC、Qwen3ForCausalLMC | 基于 Qwen3 的模型 | `Qwen/Qwen3-Embedding-0.6B` 等。 | ✅︎ | ✅︎ |
RobertaModel, RobertaForMaskedLM | 基于 RoBERTa 的模型 | `sentence-transformers/all-roberta-large-v1` 等。 | ||
*ModelC、*ForCausalLMC 等。 | 生成式模型 | 不适用 | * | * |
C 通过 `--convert embed` 自动转换为嵌入模型。(详情)
* 功能支持与原始模型相同。
注意
`ssmits/Qwen2-7B-Instruct-embed-base` 的 Sentence Transformers 配置定义不当。您需要通过传递 `--pooler-config '{"pooling_type": "MEAN"}'` 来手动设置平均池化。
注意
对于 `Alibaba-NLP/gte-Qwen2-*`,您需要启用 `--trust-remote-code` 才能加载正确的 tokenizer。请参阅 HF Transformers 上的相关问题。
注意
`jinaai/jina-embeddings-v3` 通过 LoRA 支持多种任务,而 vllm 暂时只通过合并 LoRA 权重来支持文本匹配任务。
注意
第二代 GTE 模型 (mGTE-TRM) 名为 `NewModel`。`NewModel` 这个名称过于通用,您应该设置 `--hf-overrides '{"architectures": ["GteNewModel"]}'` 来指定使用 `GteNewModel` 架构。
如果您的模型不在上述列表中,我们将尝试使用 as_embedding_model 自动转换模型。默认情况下,整个提示的嵌入是从与最后一个词元对应的归一化隐藏状态中提取的。
分类¶
这些模型主要支持 `LLM.classify` API。
| 架构 | 模型 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|
JambaForSequenceClassification | Jamba | `ai21labs/Jamba-tiny-reward-dev` 等。 | ✅︎ | ✅︎ |
GPT2ForSequenceClassification | GPT2 | nie3e/sentiment-polish-gpt2-small | ||
*ModelC、*ForCausalLMC 等。 | 生成式模型 | 不适用 | * | * |
C 通过 `--convert classify` 自动转换为分类模型。(详情)
* 功能支持与原始模型相同。
如果您的模型不在上述列表中,我们将尝试使用 as_seq_cls_model 自动转换模型。默认情况下,类别概率是从与最后一个词元对应的、经过 softmax 处理的隐藏状态中提取的。
交叉编码器 / 重排序器¶
交叉编码器和重排序器模型是分类模型的一个子集,它们接受两个提示作为输入。这些模型主要支持 `LLM.score` API。
| 架构 | 模型 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|
BertForSequenceClassification | 基于 BERT 的模型 | `cross-encoder/ms-marco-MiniLM-L-6-v2` 等。 | ||
GemmaForSequenceClassification | 基于 Gemma 的模型 | `BAAI/bge-reranker-v2-gemma` (见注) 等。 | ✅︎ | ✅︎ |
GteNewForSequenceClassification | mGTE-TRM (见注) | `Alibaba-NLP/gte-multilingual-reranker-base` 等。 | ||
Qwen2ForSequenceClassification | 基于 Qwen2 的模型 | `mixedbread-ai/mxbai-rerank-base-v2` (见注) 等。 | ✅︎ | ✅︎ |
Qwen3ForSequenceClassification | 基于 Qwen3 的模型 | `tomaarsen/Qwen3-Reranker-0.6B-seq-cls`、`Qwen/Qwen3-Reranker-0.6B` (见注) 等。 | ✅︎ | ✅︎ |
RobertaForSequenceClassification | 基于 RoBERTa 的模型 | `cross-encoder/quora-roberta-base` 等。 | ||
XLMRobertaForSequenceClassification | 基于 XLM-RoBERTa 的模型 | `BAAI/bge-reranker-v2-m3` 等。 | ||
*ModelC、*ForCausalLMC 等。 | 生成式模型 | 不适用 | * | * |
C 通过 `--convert classify` 自动转换为分类模型。(详情)
* 功能支持与原始模型相同。
注意
使用以下命令加载官方原始的 `BAAI/bge-reranker-v2-gemma`。
注意
第二代 GTE 模型 (mGTE-TRM) 名为 `NewForSequenceClassification`。`NewForSequenceClassification` 这个名称过于通用,您应该设置 `--hf-overrides '{"architectures": ["GteNewForSequenceClassification"]}'` 来指定使用 `GteNewForSequenceClassification` 架构。
注意
使用以下命令加载官方原始的 `mxbai-rerank-v2`。
注意
使用以下命令加载官方原始的 `Qwen3 Reranker`。更多信息可以在以下位置找到: examples/pooling/score/qwen3_reranker.py。
奖励建模¶
这些模型主要支持 `LLM.reward` API。
| 架构 | 模型 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|
InternLM2ForRewardModel | 基于 InternLM2 的模型 | `internlm/internlm2-1_8b-reward`、`internlm/internlm2-7b-reward` 等。 | ✅︎ | ✅︎ |
LlamaForCausalLMC | 基于 Llama 的模型 | `peiyi9979/math-shepherd-mistral-7b-prm` 等。 | ✅︎ | ✅︎ |
Qwen2ForRewardModel | 基于 Qwen2 的模型 | `Qwen/Qwen2.5-Math-RM-72B` 等。 | ✅︎ | ✅︎ |
Qwen2ForProcessRewardModel | 基于 Qwen2 的模型 | `Qwen/Qwen2.5-Math-PRM-7B` 等。 | ✅︎ | ✅︎ |
*ModelC、*ForCausalLMC 等。 | 生成式模型 | 不适用 | * | * |
C 通过 `--convert reward` 自动转换为奖励模型。(详情)
* 功能支持与原始模型相同。
如果您的模型不在上述列表中,我们将尝试使用 as_reward_model 自动转换模型。默认情况下,我们直接返回每个词元的隐藏状态。
重要
对于过程监督奖励模型,如 `peiyi9979/math-shepherd-mistral-7b-prm`,应明确设置池化配置,例如:`--pooler-config '{"pooling_type": "STEP", "step_tag_id": 123, "returned_token_ids": [456, 789]}'`。
词元分类¶
这些模型主要支持 `LLM.encode` API。
| 架构 | 模型 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|
BertForTokenClassification | 基于 bert 的模型 | `boltuix/NeuroBERT-NER` (见注) 等。 | ||
ModernBertForTokenClassification | 基于 ModernBERT 的模型 | disham993/electrical-ner-ModernBERT-base |
注意
命名实体识别 (NER) 的用法,请参考 examples/pooling/token_classify/ner.py, examples/pooling/token_classify/ner_client.py。
多模态语言模型列表¶
根据模型的不同,支持以下模态:
- Text (文本)
- Image (图像)
- Video (视频)
- Audio (音频)
支持由 `+` 连接的任何模态组合。
- 例如:`T + I` 表示模型支持纯文本、纯图像以及文本与图像混合的输入。
另一方面,由 `/` 分隔的模态是互斥的。
- 例如:`T / I` 表示模型支持纯文本和纯图像输入,但不支持文本与图像混合的输入。
关于如何向模型传递多模态输入,请参阅此页面。
提示
对于像 Llama-4、Step3 和 Mistral-3 这样的纯混合模型,可以通过将所有支持的多模态设置为 0 来启用纯文本模式(例如,`--limit-mm-per-prompt '{"image":0}`),这样它们的多模态模块就不会被加载,从而为 KV 缓存释放更多 GPU 内存。
注意
vLLM 目前仅支持在多模态模型的语言主干上使用动态 LoRA 适配器。如果您希望在多模态编码器中使用带有 LoRA 的模型,请先将权重合并到基础模型中,然后再像常规模型一样在 vLLM 中运行。
from peft import PeftConfig, PeftModel
from transformers import AutoModelForImageTextToText, AutoProcessor
def merge_and_save(model_id: str, output_dir: str):
base_model = AutoModelForImageTextToText.from_pretrained(model_id)
lora_model = PeftModel.from_pretrained(
base_model,
model_id,
config=PeftConfig.from_pretrained(model_id),
)
model = lora_model.merge_and_unload().to(dtype=base_model.dtype)
model._hf_peft_config_loaded = False # Needed to save the merged model
processor = AutoProcessor.from_pretrained(model_id)
model.save_pretrained(output_dir)
processor.save_pretrained(output_dir)
生成式模型¶
有关如何使用生成式模型的更多信息,请参阅此页面。
文本生成¶
这些模型主要接受 `LLM.generate` API。聊天/指令模型还额外支持 `LLM.chat` API。
| 架构 | 模型 | 输入 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|---|
AriaForConditionalGeneration | Aria | T + I+ | rhymes-ai/Aria | ||
AyaVisionForConditionalGeneration | Aya Vision | T + I+ | `CohereForAI/aya-vision-8b`、`CohereForAI/aya-vision-32b` 等。 | ✅︎ | |
BeeForConditionalGeneration | Bee-8B | T + IE+ | `Open-Bee/Bee-8B-RL`, `Open-Bee/Bee-8B-SFT` | ✅︎ | |
Blip2ForConditionalGeneration | BLIP-2 | T + IE | `Salesforce/blip2-opt-2.7b`、`Salesforce/blip2-opt-6.7b` 等。 | ✅︎ | |
ChameleonForConditionalGeneration | Chameleon | T + I | `facebook/chameleon-7b` 等。 | ✅︎ | |
Cohere2VisionForConditionalGeneration | Command A Vision | T + I+ | `CohereLabs/command-a-vision-07-2025` 等。 | ✅︎ | |
DeepseekVLV2ForCausalLM^ | DeepSeek-VL2 | T + I+ | `deepseek-ai/deepseek-vl2-tiny`、`deepseek-ai/deepseek-vl2-small`、`deepseek-ai/deepseek-vl2` 等。 | ✅︎ | |
DeepseekOCRForCausalLM | DeepSeek-OCR | T + I+ | `deepseek-ai/DeepSeek-OCR` 等。 | ✅︎ | |
Ernie4_5_VLMoeForConditionalGeneration | Ernie4.5-VL | T + I+/ V+ | `baidu/ERNIE-4.5-VL-28B-A3B-PT`, `baidu/ERNIE-4.5-VL-424B-A47B-PT` | ✅︎ | |
FuyuForCausalLM | Fuyu | T + I | `adept/fuyu-8b` 等。 | ✅︎ | |
Gemma3ForConditionalGeneration | Gemma 3 | T + IE+ | `google/gemma-3-4b-it`、`google/gemma-3-27b-it` 等。 | ✅︎ | ✅︎ |
Gemma3nForConditionalGeneration | Gemma 3n | T + I + A | `google/gemma-3n-E2B-it`、`google/gemma-3n-E4B-it` 等。 | ||
GLM4VForCausalLM^ | GLM-4V | T + I | `zai-org/glm-4v-9b`、`zai-org/cogagent-9b-20241220` 等。 | ✅︎ | ✅︎ |
Glm4vForConditionalGeneration | GLM-4.1V-Thinking | T + IE+ + VE+ | `zai-org/GLM-4.1V-9B-Thinking` 等。 | ✅︎ | ✅︎ |
Glm4vMoeForConditionalGeneration | GLM-4.5V | T + IE+ + VE+ | `zai-org/GLM-4.5V` 等。 | ✅︎ | ✅︎ |
GraniteSpeechForConditionalGeneration | Granite Speech | T + A | ibm-granite/granite-speech-3.3-8b | ✅︎ | ✅︎ |
H2OVLChatModel | H2OVL | T + IE+ | `h2oai/h2ovl-mississippi-800m`、`h2oai/h2ovl-mississippi-2b` 等。 | ✅︎ | |
HunYuanVLForConditionalGeneration | HunyuanOCR | T + IE+ | `tencent/HunyuanOCR` 等。 | ✅︎ | ✅︎ |
Idefics3ForConditionalGeneration | Idefics3 | T + I | `HuggingFaceM4/Idefics3-8B-Llama3` 等。 | ✅︎ | |
InternS1ForConditionalGeneration | Intern-S1 | T + IE+ + VE+ | `internlm/Intern-S1`、`internlm/Intern-S1-mini` 等。 | ✅︎ | ✅︎ |
InternVLChatModel | InternVL 3.5, InternVL 3.0, InternVideo 2.5, InternVL 2.5, Mono-InternVL, InternVL 2.0 | T + IE+ + (VE+) | `OpenGVLab/InternVL3_5-14B`、`OpenGVLab/InternVL3-9B`、`OpenGVLab/InternVideo2_5_Chat_8B`、`OpenGVLab/InternVL2_5-4B`、`OpenGVLab/Mono-InternVL-2B`、`OpenGVLab/InternVL2-4B` 等。 | ✅︎ | ✅︎ |
InternVLForConditionalGeneration | InternVL 3.0 (HF 格式) | T + IE+ + VE+ | `OpenGVLab/InternVL3-1B-hf` 等。 | ✅︎ | ✅︎ |
KeyeForConditionalGeneration | Keye-VL-8B-Preview | T + IE+ + VE+ | Kwai-Keye/Keye-VL-8B-Preview | ✅︎ | ✅︎ |
KeyeVL1_5ForConditionalGeneration | Keye-VL-1_5-8B | T + IE+ + VE+ | Kwai-Keye/Keye-VL-1_5-8B | ✅︎ | ✅︎ |
KimiVLForConditionalGeneration | Kimi-VL-A3B-Instruct, Kimi-VL-A3B-Thinking | T + I+ | `moonshotai/Kimi-VL-A3B-Instruct`, `moonshotai/Kimi-VL-A3B-Thinking` | ✅︎ | |
LightOnOCRForConditionalGeneration | LightOnOCR-1B | T + I+ | `lightonai/LightOnOCR-1B` 等 | ✅︎ | ✅︎ |
Llama4ForConditionalGeneration | Llama 4 | T + I+ | `meta-llama/Llama-4-Scout-17B-16E-Instruct`、`meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8`、`meta-llama/Llama-4-Maverick-17B-128E-Instruct` 等。 | ✅︎ | ✅︎ |
Llama_Nemotron_Nano_VL | Llama Nemotron Nano VL | T + IE+ | nvidia/Llama-3.1-Nemotron-Nano-VL-8B-V1 | ✅︎ | ✅︎ |
LlavaForConditionalGeneration | LLaVA-1.5, Pixtral (HF Transformers) | T + IE+ | `llava-hf/llava-1.5-7b-hf`、`TIGER-Lab/Mantis-8B-siglip-llama3` (见注)、`mistral-community/pixtral-12b` 等。 | ✅︎ | |
LlavaNextForConditionalGeneration | LLaVA-NeXT | T + IE+ | `llava-hf/llava-v1.6-mistral-7b-hf`、`llava-hf/llava-v1.6-vicuna-7b-hf` 等。 | ✅︎ | |
LlavaNextVideoForConditionalGeneration | LLaVA-NeXT-Video | T + V | `llava-hf/LLaVA-NeXT-Video-7B-hf` 等。 | ✅︎ | |
LlavaOnevisionForConditionalGeneration | LLaVA-Onevision | T + I+ + V+ | `llava-hf/llava-onevision-qwen2-7b-ov-hf`、`llava-hf/llava-onevision-qwen2-0.5b-ov-hf` 等。 | ✅︎ | |
MiDashengLMModel | MiDashengLM | T + A+ | mispeech/midashenglm-7b | ✅︎ | |
MiniCPMO | MiniCPM-O | T + IE+ + VE+ + AE+ | `openbmb/MiniCPM-o-2_6` 等。 | ✅︎ | ✅︎ |
MiniCPMV | MiniCPM-V | T + IE+ + VE+ | `openbmb/MiniCPM-V-2` (见注)、`openbmb/MiniCPM-Llama3-V-2_5`、`openbmb/MiniCPM-V-2_6`、`openbmb/MiniCPM-V-4`、`openbmb/MiniCPM-V-4_5` 等。 | ✅︎ | |
MiniMaxVL01ForConditionalGeneration | MiniMax-VL | T + IE+ | `MiniMaxAI/MiniMax-VL-01` 等。 | ✅︎ | |
Mistral3ForConditionalGeneration | Mistral3 (HF Transformers) | T + I+ | `mistralai/Mistral-Small-3.1-24B-Instruct-2503` 等。 | ✅︎ | ✅︎ |
MolmoForCausalLM | Molmo | T + I+ | `allenai/Molmo-7B-D-0924`、`allenai/Molmo-7B-O-0924` 等。 | ✅︎ | ✅︎ |
NVLM_D_Model | NVLM-D 1.0 | T + I+ | `nvidia/NVLM-D-72B` 等。 | ✅︎ | |
OpenCUAForConditionalGeneration | OpenCUA-7B | T + IE+ | xlangai/OpenCUA-7B | ✅︎ | ✅︎ |
Ovis | Ovis2, Ovis1.6 | T + I+ | `AIDC-AI/Ovis2-1B`、`AIDC-AI/Ovis1.6-Llama3.2-3B` 等。 | ✅︎ | |
Ovis2_5 | Ovis2.5 | T + I+ + V | `AIDC-AI/Ovis2.5-9B` 等。 | ||
PaddleOCRVLForConditionalGeneration | Paddle-OCR | T + I+ | `PaddlePaddle/PaddleOCR-VL` 等。 | ||
PaliGemmaForConditionalGeneration | PaliGemma, PaliGemma 2 | T + IE | `google/paligemma-3b-pt-224`、`google/paligemma-3b-mix-224`、`google/paligemma2-3b-ft-docci-448` 等。 | ✅︎ | |
Phi3VForCausalLM | Phi-3-Vision, Phi-3.5-Vision | T + IE+ | `microsoft/Phi-3-vision-128k-instruct`、`microsoft/Phi-3.5-vision-instruct` 等。 | ✅︎ | |
Phi4MMForCausalLM | Phi-4-multimodal | T + I+ / T + A+ / I+ + A+ | `microsoft/Phi-4-multimodal-instruct` 等。 | ✅︎ | ✅︎ |
Phi4MultimodalForCausalLM | Phi-4-multimodal (HF Transformers) | T + I+ / T + A+ / I+ + A+ | `microsoft/Phi-4-multimodal-instruct` (修订版 `refs/pr/70`) 等。 | ✅︎ | ✅︎ |
PixtralForConditionalGeneration | Ministral 3 (Mistral 格式)、Mistral 3 (Mistral 格式)、Mistral Large 3 (Mistral 格式)、Pixtral (Mistral 格式) | T + I+ | `mistralai/Ministral-3-3B-Instruct-2512`、`mistralai/Mistral-Small-3.1-24B-Instruct-2503`、`mistralai/Mistral-Large-3-675B-Instruct-2512`、`mistralai/Pixtral-12B-2409` 等。 | ✅︎ | |
QwenVLForConditionalGeneration^ | Qwen-VL | T + IE+ | `Qwen/Qwen-VL`、`Qwen/Qwen-VL-Chat` 等。 | ✅︎ | ✅︎ |
Qwen2AudioForConditionalGeneration | Qwen2-Audio | T + A+ | Qwen/Qwen2-Audio-7B-Instruct | ✅︎ | |
Qwen2VLForConditionalGeneration | QVQ, Qwen2-VL | T + IE+ + VE+ | `Qwen/QVQ-72B-Preview`、`Qwen/Qwen2-VL-7B-Instruct`、`Qwen/Qwen2-VL-72B-Instruct` 等。 | ✅︎ | ✅︎ |
Qwen2_5_VLForConditionalGeneration | Qwen2.5-VL | T + IE+ + VE+ | `Qwen/Qwen2.5-VL-3B-Instruct`、`Qwen/Qwen2.5-VL-72B-Instruct` 等。 | ✅︎ | ✅︎ |
Qwen2_5OmniThinkerForConditionalGeneration | Qwen2.5-Omni | T + IE+ + VE+ + A+ | `Qwen/Qwen2.5-Omni-3B`, `Qwen/Qwen2.5-Omni-7B` | ✅︎ | ✅︎ |
Qwen3VLForConditionalGeneration | Qwen3-VL | T + IE+ + VE+ | `Qwen/Qwen3-VL-4B-Instruct` 等。 | ✅︎ | ✅︎ |
Qwen3VLMoeForConditionalGeneration | Qwen3-VL-MOE | T + IE+ + VE+ | `Qwen/Qwen3-VL-30B-A3B-Instruct` 等。 | ✅︎ | ✅︎ |
Qwen3OmniMoeThinkerForConditionalGeneration | Qwen3-Omni | T + IE+ + VE+ + A+ | `Qwen/Qwen3-Omni-30B-A3B-Instruct`, `Qwen/Qwen3-Omni-30B-A3B-Thinking` | ✅︎ | ✅︎ |
RForConditionalGeneration | R-VL-4B | T + IE+ | YannQi/R-4B | ✅︎ | |
SkyworkR1VChatModel | Skywork-R1V-38B | T + I | Skywork/Skywork-R1V-38B | ✅︎ | |
SmolVLMForConditionalGeneration | SmolVLM2 | T + I | SmolVLM2-2.2B-Instruct | ✅︎ | |
Step3VLForConditionalGeneration | Step3-VL | T + I+ | stepfun-ai/step3 | ✅︎ | |
TarsierForConditionalGeneration | Tarsier | T + IE+ | `omni-search/Tarsier-7b`, `omni-search/Tarsier-34b` | ✅︎ | |
Tarsier2ForConditionalGeneration^ | Tarsier2 | T + IE+ + VE+ | `omni-research/Tarsier2-Recap-7b`, `omni-research/Tarsier2-7b-0115` | ✅︎ | |
UltravoxModel | Ultravox | T + AE+ | fixie-ai/ultravox-v0_5-llama-3_2-1b | ✅︎ | ✅︎ |
一些模型仅通过Transformers 建模后端支持。下表旨在确认我们以这种方式正式支持的模型。日志将显示正在使用 Transformers 建模后端,并且您不会看到任何关于这是后备行为的警告。这意味着,如果您对下面列出的任何模型有疑问,请提出一个 issue,我们将尽力修复它!
| 架构 | 模型 | 输入 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|---|
Emu3ForConditionalGeneration | Emu3 | T + I | BAAI/Emu3-Chat-hf | ✅︎ | ✅︎ |
^ 您需要通过 `--hf-overrides` 设置架构名称,以匹配 vLLM 中的名称。 • 例如,要使用 DeepSeek-VL2 系列模型: `--hf-overrides '{"architectures": ["DeepseekVLV2ForCausalLM"]}'` E 此模态可以输入预先计算的嵌入。+ 此模态每个文本提示可以输入多个项目。
警告
V0 和 V1 都支持 `Gemma3ForConditionalGeneration` 用于纯文本输入。但是,它们在处理文本+图像输入方面存在差异:
V0 正确实现了模型的注意力模式: - 对同一图像对应的图像词元之间使用双向注意力 - 对其他词元使用因果注意力 - 通过(朴素的)PyTorch SDPA 与掩码张量实现 - 注意:对于带有图像的长提示,可能会占用大量内存
V1 目前使用简化的注意力模式: - 对所有词元(包括图像词元)都使用因果注意力 - 能生成合理的输出,但在文本+图像输入时与原始模型的注意力不匹配,尤其是在 `{"do_pan_and_scan": true}` 的情况下 - 未来将更新以支持正确的行为
存在此限制是因为模型的混合注意力模式(图像为双向,其他为因果)尚未被 vLLM 的注意力后端支持。
注意
`Gemma3nForConditionalGeneration` 仅在 V1 上受支持,因为它使用了共享的 KV 缓存,并且依赖 `timm>=1.0.17` 来利用其 MobileNet-v5 视觉主干。
性能尚未完全优化,主要原因如下:
- 音频和视觉多模态编码器都使用 `transformers.AutoModel` 实现。
- 没有 PLE 缓存或内存不足交换支持,如谷歌博客中所述。这些功能可能对 vLLM 来说过于特定于模型,而交换功能尤其可能更适合于资源受限的设置。
注意
对于 `InternVLChatModel`,目前只有带有 Qwen2.5 文本主干的 InternVL2.5(`OpenGVLab/InternVL2.5-1B` 等)、InternVL3 和 InternVL3.5 支持视频输入。
注意
要使用 `TIGER-Lab/Mantis-8B-siglip-llama3`,您在运行 vLLM 时必须传递 `--hf_overrides '{"architectures": ["MantisForConditionalGeneration"]}'`。
注意
官方的 `openbmb/MiniCPM-V-2` 尚不能工作,因此我们暂时需要使用一个分叉(`HwwwH/MiniCPM-V-2`)。更多详情,请参见: Pull Request #4087
警告
我们的 PaliGemma 实现在 V0 和 V1 上都存在与 Gemma 3 相同的问题(见上文)。
注意
对于 Qwen2.5-Omni 和 Qwen3-Omni,从视频预处理中读取音频 (`--mm-processor-kwargs '{"use_audio_in_video": true}'`) 的功能目前正在开发中,尚不支持。
转录¶
专为自动语音识别(ASR)训练的 Speech2Text 模型。
| 架构 | 模型 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|
WhisperForConditionalGeneration | Whisper | `openai/whisper-small`、`openai/whisper-large-v3-turbo` 等。 | ||
VoxtralForConditionalGeneration | Voxtral (Mistral 格式) | `mistralai/Voxtral-Mini-3B-2507`、`mistralai/Voxtral-Small-24B-2507` 等。 | ✅︎ | ✅︎ |
Gemma3nForConditionalGeneration | Gemma3n | `google/gemma-3n-E2B-it`、`google/gemma-3n-E4B-it` 等。 | ||
GraniteSpeechForConditionalGeneration | Granite Speech | `ibm-granite/granite-speech-3.3-2b`、`ibm-granite/granite-speech-3.3-8b` 等。 | ✅︎ | ✅︎ |
注意
`VoxtralForConditionalGeneration` 需要安装 `mistral-common[audio]`。
池化模型¶
有关如何使用池化模型的更多信息,请参阅此页面。
嵌入(Embedding)¶
这些模型主要支持 `LLM.embed` API。
注意
为了获得最佳结果,您应该使用专门为此训练的池化模型。
下表列出了在 vLLM 中测试过的模型。
| 架构 | 模型 | 输入 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|---|
CLIPModel | CLIP | T / I | `openai/clip-vit-base-patch32`、`openai/clip-vit-large-patch14` 等。 | ||
LlavaNextForConditionalGenerationC | 基于 LLaVA-NeXT 的模型 | T / I | royokong/e5-v | ✅︎ | |
Phi3VForCausalLMC | 基于 Phi-3-Vision 的模型 | T + I | TIGER-Lab/VLM2Vec-Full | ✅︎ | |
SiglipModel | SigLIP, SigLIP2 | T / I | `google/siglip-base-patch16-224`, `google/siglip2-base-patch16-224` | ||
*ForConditionalGenerationC、*ForCausalLMC 等。 | 生成式模型 | * | 不适用 | * | * |
C 通过 `--convert embed` 自动转换为嵌入模型。(详情)
* 功能支持与原始模型相同。
交叉编码器 / 重排序器¶
交叉编码器和重排序器模型是分类模型的一个子集,它们接受两个提示作为输入。这些模型主要支持 `LLM.score` API。
| 架构 | 模型 | 输入 | HF 模型示例 | LoRA | 流水线并行 |
|---|---|---|---|---|---|
JinaVLForSequenceClassification | 基于 JinaVL 的模型 | T + IE+ | `jinaai/jina-reranker-m0` 等。 | ✅︎ | ✅︎ |
C 通过 `--convert classify` 自动转换为分类模型。(详情)
* 功能支持与原始模型相同。
模型支持政策¶
在 vLLM,我们致力于促进第三方模型在我们生态系统内的集成和支持。我们的方法旨在平衡对鲁棒性的需求与支持广泛模型的实际限制。以下是我们管理第三方模型支持的方式:
-
社区驱动的支持:我们鼓励社区为添加新模型做出贡献。当用户请求支持新模型时,我们欢迎来自社区的拉取请求 (PR)。这些贡献主要根据其生成输出的合理性进行评估,而不是严格与现有实现(如 transformers 中的实现)保持一致。征集贡献:我们非常欢迎来自模型供应商的直接 PR!
-
尽力而为的一致性:虽然我们的目标是保持 vLLM 中实现的模型与其他框架(如 transformers)之间的一致性,但完全对齐并不总是可行的。加速技术和低精度计算的使用等因素可能会引入差异。我们的承诺是确保所实现的模型功能正常并产生合理的结果。
提示
在比较 Hugging Face Transformers 的 `model.generate` 输出与 vLLM 的 `llm.generate` 输出时,请注意前者会读取模型的生成配置文件(即 generation_config.json)并应用默认的生成参数,而后者仅使用传递给函数的参数。在比较输出时,请确保所有采样参数都完全相同。
-
问题解决与模型更新:我们鼓励用户报告他们遇到的任何关于第三方模型的错误或问题。建议的修复应通过 PR 提交,并附上对问题的清晰解释以及提议解决方案背后的理由。如果对一个模型的修复影响了另一个模型,我们依赖社区来指出并解决这些跨模型的依赖关系。注意:对于错误修复 PR,通知原作者以征求其反馈是一种良好的礼仪。
-
监控与更新:对特定模型感兴趣的用户应监控这些模型的提交历史(例如,通过跟踪 main/vllm/model_executor/models 目录中的更改)。这种积极主动的方法有助于用户随时了解可能影响他们所使用模型的更新和变化。
-
选择性关注:我们的资源主要投入到具有显著用户兴趣和影响力的模型上。使用频率较低的模型可能会受到较少关注,我们依赖社区在其维护和改进中发挥更积极的作用。
通过这种方法,vLLM fostering 一个协作环境,核心开发团队和广大社区共同为我们生态系统中支持的第三方模型的鲁棒性和多样性做出贡献。
请注意,作为一个推理引擎,vLLM 不引入新模型。因此,vLLM 支持的所有模型在这方面都是第三方模型。
我们对模型有以下几个级别的测试: