Skip to main content
ModernBERT-base is a 149M-parameter bidirectional encoder trained on English text and code. SGLang serves the base checkpoint through /v1/embeddings. Each input can contain up to 8,192 tokens, including special tokens.

Start the server

Use an SGLang installation that includes ModernBERT support on a Linux machine with one NVIDIA CUDA GPU. The checkpoint is public. This command uses FP16 and the Triton attention backend. It disables prefix caching and chunked prefill so that each token can attend to the full input in the global attention layers.

Embed a batch of texts

From another terminal, send two inputs in one request. The example prints each input’s index, vector dimension and L2 norm so you can check the response without printing 1,536 floats.
Expect indices 0 and 1, each with 768 dimensions and a norm close to 1. SGLang takes the last token’s hidden state for each input and L2-normalizes it. Use the same pooling and normalization when comparing against a Transformers reference. The base checkpoint was pretrained with masked language modeling. For semantic search, evaluate retrieval quality on your own queries and documents. A retrieval-tuned checkpoint can use a different pooling rule.