# Serving Open-Weight Models at Scale

> Host open models in production with vLLM, TGI or SGLang: batching, KV cache, quantization and autoscaling on GPUs. Free notes, key concepts, resources and a...

Canonical: https://www.internhack.in/roadmaps/tracks/ai-engineer/serving-open-models
Last updated: 2026-11-28

Host open models in production with vLLM, TGI or SGLang: batching, KV cache, quantization and autoscaling on GPUs.

Advanced · about 6 hours · difficulty 4/5

Learn first: [Running Open-Weight Models Locally](https://www.internhack.in/roadmaps/tracks/ai-engineer/open-weight-models), [Deploying LLM-Powered Services](https://www.internhack.in/roadmaps/tracks/ai-engineer/deploying-ai-services)

Running a model on your laptop with Ollama is different from serving hundreds of concurrent users. Production **inference servers** are built to squeeze throughput out of expensive GPUs.

### Inference servers

- **vLLM**: the most widely used open-source server, with an OpenAI-compatible API, continuous batching and PagedAttention for efficient KV cache memory.
- **SGLang** and **Hugging Face TGI**: strong alternatives with similar features.
- **NVIDIA TensorRT-LLM / Triton**: maximum performance on NVIDIA hardware with more setup.
- **Managed endpoints** (Hugging Face Inference Endpoints, cloud AI platforms, specialist GPU clouds) handle the infrastructure for you.

### Key concepts

- **Continuous batching**: new requests join the running batch every step, which keeps GPUs busy.
- **KV cache**: memory holding attention state for each active sequence; it limits how many long conversations you can serve at once.
- **Quantization** (such as 8-bit, 4-bit, FP8) shrinks memory and increases speed with small quality loss. Always evaluate.
- **Tensor parallelism** splits a large model across several GPUs.
- **Prefix caching** and **speculative decoding** speed up repeated prompts and generation.
- **Multi-LoRA serving** hosts many fine-tuned adapters on one base model.

### When self-hosting makes sense

Data residency or privacy requirements, very high steady volume where GPUs beat per-token pricing, custom fine-tuned models, or offline environments. For spiky or low traffic, hosted APIs are usually cheaper.

### Good enough to move on

You can deploy an open model with vLLM behind its OpenAI-compatible API, load test it, and report throughput, latency and cost per million tokens compared to a hosted API.

## Key concepts

- **vLLM**
- **SGLang / TGI**
- **Continuous batching**
- **KV cache and memory limits**
- **Quantization formats**
- **Tensor parallelism**
- **Speculative decoding**
- **Load testing and cost per token**

## Mini project

Serve a small open model with vLLM on a rented GPU, load test it at 1, 10 and 50 concurrent users, and write up tokens per second, p95 latency and estimated cost per million tokens.

## Check yourself

Why does continuous batching increase throughput, and what happens to KV cache memory as conversations get longer?

## Free resources

- [vLLM documentation](https://docs.vllm.ai/) (vLLM)
- [Hugging Face Text Generation Inference](https://huggingface.co/docs/text-generation-inference) (Hugging Face)
- [SGLang documentation](https://docs.sglang.ai/) (SGLang)

Previous: [Model Routing, Gateways and Fallbacks](https://www.internhack.in/roadmaps/tracks/ai-engineer/model-routing-fallbacks) · Next: [GPU and Hardware Basics for AI Engineers](https://www.internhack.in/roadmaps/tracks/ai-engineer/gpu-basics)

## More in LLMOps and Production Engineering

- [Deploying LLM-Powered Services](https://www.internhack.in/roadmaps/tracks/ai-engineer/deploying-ai-services)
- [Latency Optimization](https://www.internhack.in/roadmaps/tracks/ai-engineer/latency-optimization)
- [Response Caching and Semantic Caching](https://www.internhack.in/roadmaps/tracks/ai-engineer/llm-caching)
- [Model Routing, Gateways and Fallbacks](https://www.internhack.in/roadmaps/tracks/ai-engineer/model-routing-fallbacks)
- [Serving Open-Weight Models at Scale](https://www.internhack.in/roadmaps/tracks/ai-engineer/serving-open-models)
- [GPU and Hardware Basics for AI Engineers](https://www.internhack.in/roadmaps/tracks/ai-engineer/gpu-basics)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [AI Engineer Roadmap](https://www.internhack.in/roadmaps/tracks/ai-engineer)
