How-to guides

Self-host an embedding model on a cloud GPU

To self-host an embedding model, pick a supported model such as Qwen3-Embedding-0.6B, install the NVIDIA Container Toolkit on a GPU with compute capability 7.5 or higher, and run the Text Embeddings Inference Docker image that matches your GPU architecture. Set an API key, tune max-batch-tokens, test the /embed and /v1/embeddings endpoints, then time a sample to estimate GPU-hours for your corpus.

NEURAMESH / COMPUTE FIELD NOTES00 / 10

Prerequisites: pick the model, then the GPU

Embedding models are small next to chat models, so the GPU choice is about throughput more than memory. Text Embeddings Inference (TEI) lists supported architectures including BERT, XLM-RoBERTa, NomicBERT, JinaBERT, Alibaba GTE, ModernBERT, Mistral, Qwen2, Qwen3 and Gemma3, with example models from about 109 million to 7.6 billion parameters.

A useful default is Qwen/Qwen3-Embedding-0.6B. Its model card lists 0.6B parameters, a 32k context, an Apache-2.0 license, and output dimensions you can set from 32 to 1024. In float16 its weights are roughly 1.2 GB, which fits on any supported card. The 8B sibling needs about 16 GB at the same precision, so a 24 GB or larger card is the starting point.

TEI does not support compute capability below 7.5, which rules out V100 and older cards. NVIDIA drivers must support CUDA 12.2 or higher. You also need Docker and the NVIDIA Container Toolkit; the planned Docker with NVIDIA GPUs guide covers that setup. For RAG-specific sizing, see the planned best GPU for RAG guide.

Prerequisites: pick the model, then the GPU
Example model (TEI list)SizeStarting GPU
sentence-transformers/all-mpnet-base-v2109MT4 or L4
nomic-ai/nomic-embed-text-v1.5137MT4 or L4
Qwen/Qwen3-Embedding-0.6B509M (0.6B on card)L4, A10 or larger
intfloat/multilingual-e5-large-instruct560ML4, A10 or larger
Qwen/Qwen3-Embedding-8B7.57B24-48 GB card such as L40S

References: Hugging Face Text Embeddings Inference: supported models and hardware · Hugging Face model card: Qwen/Qwen3-Embedding-0.6B · Hugging Face Text Embeddings Inference: quick tour

Step 1: check the GPU and pick the TEI image

Run nvidia-smi and note the GPU model and the CUDA version the driver reports; it must be 12.2 or higher. Then confirm Docker can see the GPU with docker run --rm --gpus all ubuntu nvidia-smi. If that fails, fix the container toolkit before going further.

TEI publishes one image per GPU architecture. The quick tour uses ghcr.io/huggingface/text-embeddings-inference:cuda-1.9, and the hardware table lists architecture-specific tags. Pick the row that matches your card. Turing support is marked experimental, and Flash Attention is off by default on the Turing image because of precision issues.

Step 1: check the GPU and pick the TEI image
GPU architectureExample cardsTEI 1.9 image tag
Turing (experimental)T4, RTX 2000 seriesturing-1.9
Ampere 8.0A100, A301.9
Ampere 8.6A10, A40, RTX A600086-1.9
Ada LovelaceL4, L40S, RTX 409089-1.9
HopperH100, H200hopper-1.9
Blackwell 10.0 (experimental)B200100-1.9
Blackwell 12.0 (experimental)RTX 5090, RTX PRO 6000120-1.9

References: Hugging Face Text Embeddings Inference: supported models and hardware · Hugging Face Text Embeddings Inference: quick tour

Step 2: start the server

Set two shell variables: model=Qwen/Qwen3-Embedding-0.6B and volume=$PWD/data. The volume keeps downloaded weights between restarts, which the TEI docs recommend.

Start the container: docker run --gpus all -p 8080:80 -v $volume:/data --pull always ghcr.io/huggingface/text-embeddings-inference:89-1.9 --model-id $model --api-key YOUR_KEY. Swap the tag for your architecture. With --api-key set, every request must send the key as a Bearer token in the Authorization header; without it, TEI answers anyone who can reach the port.

For gated models such as google/embeddinggemma-300m, pass -e HF_TOKEN=your_token to docker run. TEI reads --hf-token, then HF_TOKEN, then the token file under HF_HOME. Wait for the log line that says the server is ready before sending traffic.

References: Hugging Face Text Embeddings Inference: quick tour · Hugging Face Text Embeddings Inference: CLI arguments · Hugging Face Text Embeddings Inference: supported models and hardware

Step 3: test the endpoints

Send one input: curl 127.0.0.1:8080/embed -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_KEY" -d '{"inputs":"What is deep learning?"}'. The response is a list containing one vector. Send a list in inputs to batch several texts in one request.

TEI also exposes an OpenAI-compatible route at /v1/embeddings. With the OpenAI Python SDK, set base_url="http://localhost:8080/v1" and call client.embeddings.create(model="text-embeddings-inference", input="..."). This lets existing RAG code switch from a hosted API by changing one URL.

Follow the model card’s query format. Qwen3-Embedding recommends a one-sentence task instruction on queries, in the form Instruct: task, newline, Query: text, and none on documents. The card says instructions typically improve results by 1% to 5%. Embed a few known pairs and check that related texts score higher than unrelated ones before you index anything.

References: Hugging Face Text Embeddings Inference: quick tour · Hugging Face model card: Qwen/Qwen3-Embedding-0.6B

Alternative: self-host an embedding model with vLLM

If you already run vLLM for chat models, it can serve embeddings too. The pooling models page uses vllm serve intfloat/e5-small as its example. The --runner pooling flag exists, but the docs say you rarely need it because the default auto runner detects embedding models.

vLLM serves the OpenAI-compatible /v1/embeddings route, plus /pooling and a Cohere-style /v2/embed. Embeddings are L2-normalized by default, and each request is capped at 1,024 inputs unless you raise VLLM_MAX_COMPLETION_PROMPTS when starting the server. The Qwen3-Embedding card says vLLM 0.8.5 or later is required for that family.

TEI is the narrower tool: a single container built for embedding, re-ranking and classification models. vLLM makes sense when one serving stack for everything matters more. The general server setup is in deploy vLLM on a cloud GPU.

References: vLLM documentation: pooling models · Hugging Face model card: Qwen/Qwen3-Embedding-0.6B

Settings table for Text Embeddings Inference

These defaults come from the TEI CLI reference. Each flag also has an environment variable of the same name in capitals, which is handy in container configs.

Settings table for Text Embeddings Inference
FlagDefaultWhen to change it
--max-batch-tokens16384Raise until the GPU is compute bound; the most important throughput setting
--max-client-batch-size32Raise if your indexer sends larger batches per request
--max-concurrent-requests512Lower to refuse excess load instead of queuing it
--auto-truncatetrueSet false to fail loudly instead of truncating long inputs
--payload-limit2,000,000 bytesRaise for large batches of long chunks
--dtypeModel defaultfloat16 on GPU, as the Qwen3 card shows
--poolingFrom model configOverride only if the model card says so
--api-keyNoneAlways set on a reachable server

References: Hugging Face Text Embeddings Inference: CLI arguments

Common errors and fixes

Most problems show up at container start or on the first request. Read the container logs with docker logs before changing flags.

Common errors and fixes
Error or symptomLikely causeFix
Container exits on a V100Compute capability below 7.5Use a Turing or newer GPU
CUDA or driver error at startDriver below CUDA 12.2, or wrong image tagUpdate the driver; match the tag to the architecture
could not select device driverNVIDIA Container Toolkit missingInstall the toolkit and restart Docker
401 UnauthorizedMissing Bearer header with --api-key setSend Authorization: Bearer YOUR_KEY
Request rejected for too many inputsOver --max-client-batch-size (32)Split batches or raise the flag
Payload too largeOver the 2 MB payload limitRaise --payload-limit or send smaller batches
Search quality poor on long documentsInputs silently truncatedChunk documents; consider --auto-truncate false
vLLM rejects a large batchDefault 1,024-input capSet VLLM_MAX_COMPLETION_PROMPTS

References: Hugging Face Text Embeddings Inference: supported models and hardware · Hugging Face Text Embeddings Inference: CLI arguments · Hugging Face Text Embeddings Inference: quick tour · vLLM documentation: pooling models

Estimate time and GPU-hours to embed a corpus

Measure throughput on your own data, because chunk length dominates. Take 10,000 representative chunks, send them in batches of 32 from several concurrent clients, and record tokens per second once the GPU is warm. Then divide total corpus tokens by that rate.

An illustrative calculation with assumed inputs, not a benchmark: 2 million chunks at 300 tokens is 600 million tokens. At an assumed measured 20,000 tokens per second, embedding takes 30,000 seconds, about 8.3 hours. Add 30 minutes for setup and the sample run, and the job uses about 8.8 GPU-hours, or about $7 at an assumed $0.80 per GPU-hour.

Two costs hide outside that figure. Switching embedding models later means re-embedding the whole corpus, and moving vectors and source documents in and out of the machine has its own price, covered in storage and egress costs.

Estimate time and GPU-hours to embed a corpus
Input (illustrative)Value
Corpus2M chunks × 300 tokens = 600M tokens
Measured rate (assumed)20,000 tokens per second
Embedding time≈8.3 hours
Setup and sample run0.5 hours
GPU-hours at $0.80 (assumed)≈8.8, about $7

References: Hugging Face Text Embeddings Inference: CLI arguments

Checklist and next step

Choose a model from the TEI supported list and read its card for query instructions. Confirm compute capability 7.5 or higher and a CUDA 12.2 driver. Match the image tag to the architecture. Mount a volume, set --api-key, and pass HF_TOKEN for gated models. Test /embed and /v1/embeddings. Raise --max-batch-tokens until throughput stops improving. Time 10,000 chunks before you embed the full corpus.

A small embedding model runs well on an inference card such as the L4; large corpora or 8B models justify a bigger GPU. NeuraMesh rents cloud GPUs by the hour: choose GPU, plan, count, hours and region on rent GPUs, receive a confirmed quotation, typically within one business day, and pay only when you approve. For a sizing check, ask the compute advisor.

NeuraMesh prices for these GPUs

NeuraMesh prices per GPU-hour in USD, excluding taxes, as of 2026-11-27. Live prices are on the rental pages.
GPUMemoryData centerValue
RTX 409024 GB$0.46$0.40
L40S48 GB$1.26$0.54
A10080 GB$1.56$0.98
H10080 GB$2.88$2.00

Every order is confirmed in a quotation before you pay. See all GPU prices.

Questions readers ask

What GPU do I need to self-host an embedding model?

Any NVIDIA GPU with compute capability 7.5 or higher works with Text Embeddings Inference, from T4 and L4 up to H100. Models under one billion parameters need only a few gigabytes. An 8B embedding model needs about 16 GB in float16, so use a 24 GB or larger card.

Is TEI or vLLM better for embeddings?

TEI is a dedicated server for embedding, re-ranking and classification models with per-architecture images and token-based batching. vLLM also serves /v1/embeddings and suits teams that already run it for chat models. Test both on your own model and chunk sizes.

Does Text Embeddings Inference have an OpenAI-compatible API?

Yes. TEI exposes /v1/embeddings alongside its native /embed route, so the OpenAI Python SDK works by pointing base_url at the server’s /v1 path.

How do I secure a self-hosted embedding server?

Start TEI with --api-key so every request must carry a Bearer token, and keep the port off the public internet behind a firewall or SSH tunnel where possible. Lower --max-concurrent-requests to shed excess load.

Why are my long documents embedding poorly?

TEI truncates inputs longer than the model maximum by default. Split documents into chunks that fit the model’s context, or set --auto-truncate false so oversize inputs fail instead of being cut silently.

Sources and editorial notes

Primary documentation reviewed November 24, 2026. Provider descriptions reflect published documentation. Recommendations are our analysis; worked figures are illustrative unless explicitly stated otherwise. No independent provider benchmark or uptime ranking is claimed.

Read the editorial policy.

Need this GPU? Rent it from NeuraMesh: choose a GPU and plan, get a confirmed quotation, and pay only when you approve. See pricing.