pipeline() is for prototyping
A pipeline() call re-tokenizes per request, allocates per request, can't share KV cache across requests, and gives you no control over batching. For one user it's fine. For ten concurrent users it's a stack of pipeline objects fighting over a single GPU.
What an inference server adds
- Continuous batching — new requests join the in-flight batch every step instead of waiting for the previous one to finish.
- PagedAttention / KV cache management — the engine page-faults attention tensors so your GPU memory holds many short conversations instead of a few long ones.
- Streaming — SSE or token-by-token response from the very first server response.
- Quantization at serve time — AWQ / GPTQ / bnb / fp8 / int4 selectable at startup.
- Health, metrics, model management —
/health,/metrics,/infoendpoints baked in.
Two stacks: TGI and vLLM
HF's first-party server is text-generation-inference (TGI). The community standard is vLLM. They overlap; both are worth knowing. We'll cover TGI first because it composes natively with the Hub and the OpenAI-compatible router.