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.Documentation Index
Fetch the complete documentation index at: https://docs.sglang.io/llms.txt
Use this file to discover all available pages before exploring further.
Quick Start
Launch Server
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 includesmatryoshka_dimensions or is_matryoshka then no override is needed. Otherwise, you can use --json-model-override-args as below:
Command
- Setting
"is_matryoshka": trueallows truncating to any dimension. Otherwise, the server will validate that the specified dimension in the request is one ofmatryoshka_dimensions. - Omitting
dimensionsin a request returns the full vector.
2. Make requests with different output dimensions
Supported Models
| Model Family | Example Model | Chat template | Description |
|---|---|---|---|
| E5 (Llama/Mistral based) | intfloat/e5-mistral-7b-instruct | N/A | High-quality text embeddings based on Mistral/Llama architectures |
| GTE-Qwen2 | Alibaba-NLP/gte-Qwen2-7B-instruct | N/A | Alibaba’s text embedding model with multilingual support |
| Qwen3-Embedding | Qwen/Qwen3-Embedding-4B | N/A | Latest Qwen3-based text embedding model for semantic representation |
| BGE | BAAI/bge-large-en-v1.5 | N/A | BAAI’s text embeddings (requires attention-backend triton/torch_native) |
| GME (Multimodal) | Alibaba-NLP/gme-Qwen2-VL-2B-Instruct | gme-qwen2-vl | Multimodal embedding for text and image cross-modal tasks |
| CLIP | openai/clip-vit-large-patch14-336 | N/A | OpenAI’s CLIP for image and text embeddings |
