Skip to main content
Baseten Embeddings Inference is Baseten’s solution for production grade inference on embedding, classification and reranking models using TensorRT-LLM. With Baseten Embeddings Inference you get the following benefits:
  • Lowest-latency inference across any embedding solution (vLLM, SGlang, Infinity, TEI, Ollama)1
  • Highest-throughput inference across any embedding solution (vLLM, SGlang, Infinity, TEI, Ollama) - thanks to XQA kernels, FP8 and dynamic batching.2
  • High parallelism: up to 1400 client embeddings per second
  • Cached model weights for fast vertical scaling and high availability - no Hugging Face hub dependency at runtime
  • Ahead-of-time compilation, memory allocation and fp8 post-training quantization

Get started with embedding models:

Embedding models are LLMs without a lm_head for language generation. Typical architectures that are supported for embeddings are LlamaModel, BertModel, RobertaModel or Gemma2Model, and contain the safetensors, config, tokenizer and sentence-transformer config files. A good example is the repo BAAI/bge-multilingual-gemma2. To deploy a model for embeddings, set the following config in your local directory.
config.yaml
The embedding and reranking examples use 2 NVIDIA RTX PRO 6000 GPUs per replica. BEI loads the complete model on each GPU and distributes batches across them. Each GPU must fit the model and its batch; GPU memory is not combined. Use RTX_PRO_6000 for 1 GPU. Leave tensor_parallel_count unset. With config.yaml in your local directory, deploy the model to Baseten and promote it to the production environment:
Deployed embedding models are OpenAI compatible without any additional settings. You may use the client code below to consume the model.

Example deployment of classification, reranking, and classification models

Besides embedding models, BEI deploys high-throughput rerank and classification models. You can identify suitable architectures by their ForSequenceClassification suffix in the Hugging Face repo. The use-case for these models is either Reward Modeling, Reranking documents in RAG or tasks like content moderation.
As OpenAI does not offer reranking or classification, we are sending a simple request to the endpoint. Depending on the model, you might want to apply a specific prompt template first.

Benchmarks and performance optimizations

Embedding models on BEI are fast, and offer currently the fastest implementation for embeddings across all open-source and closed-source providers. The team behind the implementation is the authors of infinity. We recommend using fp8 quantization for Llama, Mistral, and Qwen2 models on L4 or newer (L4, H100, H200, and B200). Quality difference between fp8 and bfloat16 is often negligible: embedding models often retain >99% cosine similarity between both precisions, and reranking models retain the ranking order despite a difference in the retained output. For more details, check out the technical launch post.
The team at Baseten has additional options for sharing cached model weights across replicas - for fast horizontal scaling. Please contact us to enable this option.

Deploy custom or fine-tuned models on BEI

We support the deployment of the below models, as well as all finetuned variants of these models (same architecture & customized weights). The following repositories are supported - this list is not exhaustive. 1 measured on H100-HBM3 (bert-large-335M, for BAAI/bge-en-icl: 9ms) 2 measured on H100-HBM3 (leading model architecture on MTEB, MistralModel-7B)

Deploy a reranker on two L4s

Create config.yaml to deploy the ModernBERT reranker with BEI-Bert:
config.yaml
Run baseten model push from this directory. Set accelerator: L4:4 for four GPUs. Each GPU loads a complete model and consumes batches from a shared queue. Set checkpoint_repository.revision to the commit you validated for reproducible deployments. For small embedding, reranking, and decision models, start with two or four L4s or RTX 6000 Ada GPUs where available. Select RTX resources with your Baseten representative. Measure throughput and p95 latency with concurrent traffic. See multi-GPU sizing for per-GPU memory requirements.

Text model request examples

Each example requires a deployment of its named checkpoint. Set the model’s production URL and your API key:
See the model matrix for endpoint and precision requirements. For Laya, use the typed decision deployment.

Qwen3 embeddings

With Qwen/Qwen3-Embedding-0.6B deployed, include the retrieval instruction in queries. Embed documents without the query instruction.

Query and document prompts

With michaelfeil/embeddinggemma-300m deployed, use its query and document prompts:
For nomic-ai/modernbert-embed-base, use the same request shape with search_query: and search_document: prefixes. For BAAI/bge-m3, send text without a prefix. Change the model value to match your deployment.

Rank documents

With Alibaba-NLP/gte-reranker-modernbert-base deployed:

Sequence classification

With SamLowe/roberta-base-go_emotions deployed through encoder_bert and webserver_default_route: /predict:
Gemma4 and Qwen3 MoE sequence classifiers use this request shape when the checkpoint includes trained classification weights and label configuration. A base language-model checkpoint doesn’t provide that classifier head.

Typed decisions

Deploy michaelfeil/laya-typed-decisions with BEI-Bert by setting base_model: encoder_bert in the trt_llm configuration. The checkpoint uses BF16 and its custom decision head; set quantization_type: no_quant and call the explicit /sync/v1/systemone route. Create config.yaml:
config.yaml
Both GPUs load the complete model. Use L4 for one GPU or L4:4 for four. Baseten manages startup, ports, and health checks through the BEI-Bert deployment. Use the explicit sync URL below for decisions; leave webserver_default_route unset. Deploy and promote it:
Wait for deployment readiness before sending requests. Submit several questions about one state:
Laya accepts plain text in state. Serialize structured records into text before sending them. Answers include the selected choice, a boolean probability, or an expected zero-based score, plus confidence and action probability fields.