What Is an AI Inference Engine? vLLM Explained
An inference engine like vLLM is the software that turns a trained model's raw weights into fast, concurrent answers. Understanding it is the first step toward self-hosting AI instead of renting it by the token.
- 01An inference engine is the software that loads a model onto a GPU and manages memory to serve user requests.
- 02vLLM's PagedAttention dynamically manages memory, delivering up to 24x higher throughput than alternatives.
- 03Under heavy load, vLLM processes tokens 19x faster than Ollama while keeping latency under 100 milliseconds.
- 04Self-hosting AI models becomes cheaper than metered API pricing at roughly 2 million tokens per day.

An AI inference engine is the software layer that takes a trained model's weights and serves them to real users. It handles the batching, memory management, and scheduling needed to answer many requests at once, quickly and cheaply. It is not the model. It is the runtime that runs the model. vLLM is the best-known example of this category.12
That distinction matters more than it sounds. People talk about "AI models" as if the weights alone do the work. They don't. A model file sitting on disk answers nothing. Something has to load it onto a GPU, accept incoming requests, decide how to group them, manage the memory those requests consume, and hand back tokens fast enough that no one notices the wait. That something is the inference engine.
Training vs. inference: the two lives of a model
Every model has two distinct phases of life. Training is where it learns, adjusting billions of parameters against huge datasets until it captures patterns in language, code, or images. Inference is where it works, taking new, unseen input and producing an output based on what it learned.34 NVIDIA's framing is useful here: inference cannot happen without training, but training alone produces nothing useful. It just produces a set of weights.3
Once training ends, the weights are frozen. From that point on, every dollar and every millisecond of value the model produces comes from inference. That's why the software that handles inference deserves its own name, its own architecture, and its own scrutiny. It's the part of the stack that touches production traffic.
What does an inference engine actually do?
An inference engine has a handful of core jobs:
- Batching requests. Instead of running one prompt at a time, the engine groups multiple requests together so the GPU processes them in parallel rather than sitting idle between calls.
- Managing GPU memory. Every request needs space for its attention key-value (KV) cache, the running memory of everything the model has generated so far in that conversation. This is the single biggest constraint on how many users an engine can serve at once.
- Scheduling. The engine decides which requests run now, which wait, and how to interleave short and long generations so no single user hogs the hardware.
- Exposing an API. Somewhere on top of all this sits an HTTP or gRPC interface that looks, to the outside world, like any other API endpoint.
vLLM's own architecture makes this concrete. It splits work across an API server process, an engine core process, and GPU worker processes, with one worker assigned per accelerator, so a four-GPU machine runs four workers.2 That's a multi-process system, not a single script wrapping a model. Serving a model at scale is a systems problem, not just a math problem.
Case study: vLLM and PagedAttention
vLLM was built at UC Berkeley and has grown into one of the most active open-source AI projects around.5 Its central contribution is an algorithm called PagedAttention, and understanding it is the fastest way to understand what a good inference engine actually buys you.
Before PagedAttention, serving systems allocated KV cache memory in large contiguous blocks sized for the worst case: a full-length generation. Most requests never used that much space, so the memory sat reserved and wasted. The original research measured this directly: existing systems used only 20.4% to 38.2% of allocated KV cache memory for actual token states.6 The rest was fragmentation, dead weight sitting on an expensive GPU.
PagedAttention borrows an old idea from operating systems: virtual memory paging. Instead of one contiguous block per request, it manages the KV cache in fixed-size, non-contiguous blocks that get allocated only as needed.76 That change alone let vLLM pack far more concurrent requests onto the same hardware.
The throughput numbers are the point. vLLM with PagedAttention delivers up to 24x higher throughput than HuggingFace Transformers and up to 3.5x higher throughput than HuggingFace TGI, without any changes to the model architecture itself.1 The peer-reviewed version of the work reports 2 to 4x throughput gains over other state-of-the-art serving systems at the same latency.7 Same model, same weights, dramatically more capacity, just from better software underneath.
vLLM vs. Ollama vs. TGI vs. llama.cpp: how do they compare?
Inference engines sit on a spectrum, and picking the wrong one for the job is a common, costly mistake.
- Ollama, built on llama.cpp, optimizes for single-user local simplicity. Great for running a model on your laptop, weak under concurrent load.
- TGI (Hugging Face's Text Generation Inference) targeted production serving but is now in maintenance mode. Hugging Face itself recommends migrating to vLLM or SGLang for new deployments.89
- vLLM is described flatly in industry comparisons as the production default for high-concurrency serving, because PagedAttention stops the GPU from wasting memory on empty slots.8
The gap between these tools isn't academic. Benchmarks show vLLM reaching roughly 793 tokens per second under load, against Ollama's 41, a 19x difference.109 At 128 concurrent users, vLLM held P99 latency under 100 milliseconds while Ollama stretched to 673 milliseconds.109 If you're building something one person will use occasionally, Ollama is fine. If you're serving a team, a product, or a customer base, that gap is the difference between an app that feels instant and one that visibly stalls.
Why the inference engine is the key to owning your AI
This is where the technical story connects to a bigger decision. Every API call to a hosted model provider, OpenAI, Anthropic, or anyone else, is a request being handled by that provider's own inference engine, running on their infrastructure, priced per token. You're renting compute and software you never see.
Run your own inference engine on your own hardware, and the equation flips. The model weights are yours. The engine is open source and inspectable. The GPUs are yours or rented on your terms. Nothing about the stack disappears if a vendor changes pricing, deprecates a model, or has an outage. That's the argument The API Trap makes about cloud dependency generally, and it applies with particular force to AI: the inference engine is the specific piece of software that makes self-hosting technically possible rather than theoretical. Understanding it is the prerequisite for treating AI as infrastructure you own, not a subscription you keep paying.
When does self-hosting with an inference engine actually pay off?
Self-hosting isn't automatically cheaper. It trades near-zero setup effort for real operational work: sizing hardware, managing CUDA and driver versions, monitoring GPU health, and keeping the engine itself updated.10 The decision comes down to volume and constraints, not vibes.
- Token volume. Industry analysis puts the breakeven point at roughly 2 million tokens per day, the level at which self-hosted infrastructure costs less than metered API pricing.10
- Unit economics. Self-hosting a 7B model on an H100 spot instance runs about $0.013 per 1,000 tokens, against $0.15 to $0.60 per million tokens for GPT-4o mini-class APIs.10 At high volume, that gap compounds fast, and enterprise API spend already reflects it: model API costs alone reached $8.4 billion in 2025.10
- Compliance and data residency. Regulated industries, healthcare, finance, legal, and any organization citing data privacy as its top AI adoption barrier, have reasons to self-host that have nothing to do with per-token math. Prompts never leaving your network is the point, independent of cost.109
| Concurrency handling | Setup simplicity | Actively recommended for new production use | Best for | |
|---|---|---|---|---|
| RecommendedvLLMHigh-concurrency production serving | High | Low | Yes | Teams serving many users at scale |
| Ollama (llama.cpp)Local, single-user use | Low | High | Yes | Running a model on one laptop |
| TGILegacy production deployments | Medium | Medium | No | Existing TGI deployments, not new ones |
If your usage is light and irregular, an API is still the pragmatic choice. If you're running steady, high-concurrency workloads, or you operate under real compliance pressure, the inference engine is what makes the alternative viable. For a fuller breakdown of the math, see The True Cost of Renting Tokens vs. Owning Quantized Models.
What do you need to run an inference engine?
Moving from renting to owning doesn't require a research team. It requires three decisions:
- Hardware. At minimum, a GPU with enough VRAM for your chosen model's weights plus KV cache headroom. An H100 or similar accelerator is the common production baseline, though smaller quantized models run on more modest cards.
- Model choice. Pick an open-weight model sized to your workload and your hardware, not the biggest one available. Quantized 7B and 13B models cover a surprising amount of real production traffic.
- Engine setup. Install vLLM, point it at your model weights, and expose the API. Its architecture handles batching and memory management for you. You don't need to build PagedAttention yourself, you just need to run the engine that already has it.25
None of this happens in isolation. Teams that go this route are usually the same ones already building internal tools instead of buying every SaaS seat, a pattern covered in The Shadow AI Tech Stack. The inference engine is just the next layer down: the piece of infrastructure that makes AI something you run, not something you rent. Platforms like Remy exist for exactly this handoff, helping teams take that self-hosted step without building the operational muscle from scratch.
The model weights are the asset everyone talks about. The inference engine is the asset that actually determines whether you can use them on your own terms.
It's the software that runs a trained model in production, handling how incoming requests are batched, how GPU memory is managed, and how answers get returned quickly to many users at once. The model provides the knowledge; the inference engine is what actually serves it.
vLLM is an inference engine, not a model. It's open-source serving software that loads existing model weights and runs them efficiently using techniques like PagedAttention, achieving up to 24x higher throughput than HuggingFace Transformers.
Ollama, built on llama.cpp, is designed for simple single-user local use. vLLM is built for high-concurrency production serving. Benchmarks show vLLM handling roughly 793 tokens per second versus Ollama's 41 under load, a meaningful gap once more than one person is using the system at a time.
Industry analysis puts the breakeven point at around 2 million tokens per day for typical configurations. Below that, a metered API is usually simpler and cheaper; above it, self-hosting with an inference engine like vLLM tends to win on cost.
Before PagedAttention, serving systems reserved large blocks of GPU memory per request and wasted most of it, using only 20.4% to 38.2% of allocated KV cache memory for actual token data. PagedAttention allocates memory in smaller, flexible blocks, similar to virtual memory paging, letting far more requests run concurrently on the same hardware.
- 1vLLM: Easy, Fast, and Cheap LLM Serving with PagedAttentionvLLM Project Blog
- 2Architecture OverviewvLLM Documentation
- 3What's the Difference Between Deep Learning Training and Inference?NVIDIA Blog
- 4What is AI Inference? | NVIDIA GlossaryNVIDIA
- 5vllm-project/vllm: A high-throughput and memory-efficient inference and serving engine for LLMsGitHub
- 6PagedAttention | LLM Inference HandbookModular
- 7Efficient Memory Management for Large Language Model Serving with PagedAttentionarXiv (SOSP 2023)
- 8vLLM vs Ollama vs SGLang vs TensorRT-LLMThe AI Engineer (Substack)
- 9LLM Inference Engine Showdown: vLLM vs Ollama vs TGIBuildWithMatija
- 10Self-Hosted LLM Guide: Setup, Tools & Cost Comparison (2026)Prem AI Blog



