Repository navigation
Conversation
…kend Move `LlamaForCausalLM`, `LLaMAForCausalLM`, `LlamaModel` and `MistralModel` to the Transformers modeling backend. Rename `llama.py` to `llama_layers.py` for the models that still build on the native Llama classes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This was referenced Nov 9, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Contributor
|
Documentation preview: https://vllm--66547.org.readthedocs.build/en/66547/ |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
6 tasks done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…ers modeling backend These need huggingface/transformers#50477. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
…d-llama Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> # Conflicts: # vllm/model_executor/models/phi3.py
Phi3 moved to the backend in vllm-project#66559, so convert the remote config to a Transformers Phi3Config rather than pinning a native architecture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This was referenced Nov 10, 2026
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
15 of 28 tasks
Their move to the Transformers modeling backend lands in vllm-project#66416 instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Draft
2 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Serve Llama with the Transformers modeling backend.
vllm/model_executor/models/llama.pymoves tovllm/model_executor/layers/llama.py, kept only for the models that still build on the native Llama classes. Draft until the gaps below are closed. Tracked in #67003.Claims
LlamaForCausalLM,LLaMAForCausalLM,LlamaModelandMistralModelresolve to the Transformers modeling backend.InternLM3ForCausalLMandIQuestCoderForCausalLMstay native here, importing fromvllm/model_executor/layers/llama.py. [Transformers backend] Migrate InternLM3 and IQuestCoder #66416 moves them. [Model] Remove TeleChat2 and TeleChat3 #67035 removesTeleChat2ForCausalLMandTeleChat3ForCausalLM.LlamaBidirectional*stay native here, [Transformers backend] Serve bidirectional Llama with the Transformers modeling backend #67018 moves them.llama.py(Mistral, Llama 4, Eagle/Eagle3, GLM4, MiniCPM-V, ...) imports fromvllm/model_executor/layers/llama.pyinstead.init_vllm_registered_modelcallself.language_model(...)instead ofself.language_model.model(...), so their text model can be a Transformers modeling backend model (Llava-1.5 fails at startup without this).Phi3ForCausalLM, built from a TransformersPhi3Configconverted from its remote-code config (it keeps going through the registry, so VLM2Vec still gets the embedding adapter). Kanana-V keeps the nativeLlamaForCausalLM: its remote-code text config can't be built by the Transformers modeling backend.Gaps
lm_headare rejectedKeyErrorcompute_logits_localLlamaModel/MistralModelembedding models without a sentence-transformers config default to CLS pooling instead of LAST--mm-encoder-onlyshared root check #65965{k,v}_proj.output_scalefail to load: the QKV fuser renames them before Quark's rule matchesmaybe_fused_act_quantlm_headabiasvllm-gguf-plugin#154 and a plugin release with [BugFix] Flatten batched inputs in the GGUF linear method vllm-gguf-plugin#149lm_headhas nobiasLlamaModel.forwardtest_backendauto-vs-transformers comparisons assume native Llamarotary_embeddingop, impact not measuredValidation
B200 bf16 Llama-3.1-8B-Instruct, native vs backend: GSM8K (500q, 5-shot) 0.782 vs 0.790, throughput (1024 in / 256 out) 43.15/43.24/43.15 vs 42.88/43.90/42.73 req/s, latency (bs 1) 0.956 vs 0.913 s. FP8 (compressed-tensors, ModelOpt), FP8 KV cache, W4A16, Quark FP8, GPTQ, AWQ, bitsandbytes, tensorizer, runai_streamer and TP=2 match native on GSM8K.
vllm bench throughput --model meta-llama/Llama-3.1-8B-Instruct --model-impl {vllm,transformers} --input-len 1024 --output-len 256 --num-prompts 1000Passing on this branch:
test_registry,test_config,test_common(Llama), andtest_initializationfor every Llama arch and native Llama dependent (Mistral, Llama 4, Eagle/Eagle3, GLM4, Jina v5, MiniCPM-V, Idefics3,LlamaBidirectional*) and every VLM whoselanguage_model.model(...)call changed (50 passed after mergingmain; Eagle2.5 fails only because it's gated). InternLM3, IQuestCoder, TeleChat2/3 and IQuestLoopCoder passtest_initializationnatively on this branch. Llava-1.5 generates correctly and passes multimodaltest_common. Phi-3-vision-128k-instruct generates the same greedy text asmainfor an image and a text prompt.Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.
🤖 Generated with Claude Code