Skip to main content
SGLang provides robust support for embedding models by integrating efficient serving mechanisms with its flexible programming interface. This integration allows for streamlined handling of embedding tasks, facilitating faster and more accurate retrieval and semantic search operations. SGLang’s architecture enables better resource utilization and reduced latency in embedding model deployment.
Native encoder embedding architectures, google/embeddinggemma-300m and nvidia/Nemotron-3-Embed-1B-BF16 are detected automatically. Decoder-style embedding models require --is-embedding; add --trust-remote-code when the model requires it.

Quick Start

Launch Server

EmbeddingGemma

EmbeddingGemma uses bidirectional attention and is auto-detected, so its best default command is simply:
On CUDA, SGLang automatically uses breakable CUDA graph (BCG) for its full encoder prefill and disables incompatible radix-cache and chunked-prefill behavior. Do not add the deprecated piecewise CUDA graph knobs.

Nemotron-3-Embed

nvidia/Nemotron-3-Embed-1B-BF16 uses a bidirectional Ministral3 backbone with normalized mean pooling. It is auto-detected from its checkpoint config, so --is-embedding is not needed:
It is not supported on ROCm. SGLang disables radix cache and chunked prefill for this model, and skips the KV cache allocation when the prefill attention backend is FA3 or FA4. Prepend the task prefix to each input text as described in the model card, for example query: ... or passage: ....

Client Request

Multimodal Embedding Example

For multimodal models like GME that support both text and images:
Example

Matryoshka Embedding Example

Matryoshka Embeddings or Matryoshka Representation Learning (MRL) is a technique used in training embedding models. It allows user to trade off between performance and cost.

1. Launch a Matryoshka‑capable model

If the model config already includes matryoshka_dimensions or is_matryoshka then no override is needed. Otherwise, you can use --json-model-override-args as below:
Command
  1. Setting "is_matryoshka": true allows truncating to any dimension. Otherwise, the server will validate that the specified dimension in the request is one of matryoshka_dimensions.
  2. Omitting dimensions in a request returns the full vector.

2. Make requests with different output dimensions

Supported Models

Model FamilyExample ModelChat templateDescription
EmbeddingGemmagoogle/embeddinggemma-300mN/ABidirectional Gemma3 text encoder; auto-detected and served with BCG by default
Nemotron-3-Embednvidia/Nemotron-3-Embed-1B-BF16N/ABidirectional Ministral3 encoder with normalized mean pooling; auto-detected
E5 (Llama/Mistral based)intfloat/e5-mistral-7b-instructN/AHigh-quality text embeddings based on Mistral/Llama architectures
GTE-Qwen2Alibaba-NLP/gte-Qwen2-7B-instructN/AAlibaba’s text embedding model with multilingual support
Qwen3-EmbeddingQwen/Qwen3-Embedding-4BN/ALatest Qwen3-based text embedding model for semantic representation
Qwen3 (bare backbone)microsoft/harrier-oss-v1-0.6bN/ABare Qwen3Model backbone (no LM head); served natively on SGLang’s fused Qwen3 kernels and auto-classified as an embedding model
BGEBAAI/bge-large-en-v1.5N/ABAAI’s text embeddings (requires attention-backend triton/torch_native)
GME (Multimodal)Alibaba-NLP/gme-Qwen2-VL-2B-Instructgme-qwen2-vlMultimodal embedding for text and image cross-modal tasks
CLIPopenai/clip-vit-large-patch14-336N/AOpenAI’s CLIP for image and text embeddings