You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature]: Add Qwen3-Embedding model support (0.6B/4B/8B) for LLM API encode_only mode #14715
LLM API<NV>High-level LLM Python API & tools (e.g., trtllm-llmapi-launch) for TRTLLM inference/workflows.Model customization<NV>Adding support for new model architectures or variantsfeature requestNew feature or request. This includes new model, dtype, functionality support
Native support for the Qwen3-Embedding model family (0.6B, 4B, 8B) for use with the LLM API's encode_only mode.
Problem
The Qwen3 embedding models don't work correctly out of the box with encode_only. TensorRT-LLM returns logits (post lm_head), whereas the correct output should be the last prompt token's hidden state before the lm_head (model card's transformers usage)
Proposed support
Add a new architecture/model class, e.g. Qwen3ForEmbedding, for use with LLM(..., encode_only=True).
The model class would:
Reuse the existing Qwen3 transformer backbone without applying lm_head.
Return last prompt token's hidden states from LLM.encode(...) instead of logits.
Leave normalization and MRL/custom-dimension slicing to the caller or serving layer.
Hi team, I am interested in implementing support for Qwen3-Embedding models in encode_only mode within the Qwen model architecture.
I have already analyzed qwen/model.py and qwen/config.py to draft the head bypass logic and conditional architecture flags. I will be working on a PR for this shortly.
LLM API<NV>High-level LLM Python API & tools (e.g., trtllm-llmapi-launch) for TRTLLM inference/workflows.Model customization<NV>Adding support for new model architectures or variantsfeature requestNew feature or request. This includes new model, dtype, functionality support
Activity
Priyanshu31102003 commentedon May 29, 2026
Hi team, I am interested in implementing support for Qwen3-Embedding models in
encode_onlymode within the Qwen model architecture.I have already analyzed
qwen/model.pyandqwen/config.pyto draft the head bypass logic and conditional architecture flags. I will be working on a PR for this shortly.