Runtimes and Inference Engines

What Actually Runs Your Model
A model file is inert. It's a few billion numbers sitting on your disk. Something has to load those numbers into memory, decide how to split the work across your CPU and GPU, manage the memory that holds the conversation, pick each next token, and hand the result back. That something is the inference engine.
People use "runtime", "engine", "backend" and "server" almost interchangeably, which is fine until you have to choose one. This page sorts them out.
What an inference engine actually does
One vocabulary note: engine vs. backend. The engine is the software; the backend is the vendor layer it talks to. CUDA is NVIDIA's, and the reference path — best support, first to get new features. Metal (and MLX) is Apple's, using unified memory. ROCm/HIP is AMD's CUDA-equivalent: HIP is a CUDA-like API, mostly source-portable, Linux-first, with partial Windows support and a limited consumer card list. Vulkan is the vendor-neutral graphics/compute API; it's the pragmatic AMD-on-Windows and Intel Arc path in llama.cpp, usually a bit behind native CUDA/Metal but far more portable. SYCL is Intel's equivalent. Rule of thumb: NVIDIA → CUDA, Apple → Metal/MLX, AMD on Linux → ROCm, AMD on Windows → Vulkan (or HIP if your card is supported), Intel → Vulkan/SYCL, anything else → CPU. For the per-platform detail, see Hardware.
The part worth understanding is that an engine is mostly a scheduler and a memory manager, not a calculator. The math is the same everywhere — multiply these numbers by those numbers. The differences are in everything around it:
- Loading and formats. Which file formats it can read, and how it gets them into memory.
- Memory strategy. How much of the model fits in VRAM, what spills to system memory, and how the key-value cache is stored.
- Batching. Whether it serves one person at a time or dozens, and how it groups their requests.
- Caching. Whether a repeated prompt has to be recomputed from scratch every time.
- Quantization. Which bit-widths it supports — this often decides everything else.
- Hardware backends. CUDA, Metal, ROCm, Vulkan, CPU, and what each one is optimized for.
- API surface. Usually an OpenAI-compatible endpoint, sometimes Anthropic's too.
An engine that batches many users and one that just needs to be fast for a single person have completely different priorities. That's the whole reason several engines exist.
The landscape
llama.cpp
The workhorse. Written in C/C++ with no dependencies, MIT licensed, and built on the ggml library. It runs almost anywhere: x86 and ARM and RISC-V CPUs, Apple Silicon with Metal, NVIDIA via CUDA, AMD via HIP, plus Vulkan and SYCL. It introduced GGUF, the quantized format most local models ship in, and supports from 1.5-bit integers up to 8-bit.
llama.cpp's best trick is hybrid inference: you can offload some layers to the GPU and leave the rest in system RAM, which is how a 12 GB card runs a model much bigger than 12 GB — slowly. It ships a server with an OpenAI-compatible API and gained realtime audio and TTS endpoints in v0.8.0 (October 2026).
Best for: nearly every local setup, Macs included, and anything where the model won't fit entirely in VRAM.
Ollama
A wrapper that makes llama.cpp pleasant. MIT licensed. It manages model downloads, keeps a model library, runs in the background and exposes an API, and gives you one command: ollama run <model>. Under the hood it's llama.cpp, so performance is close to identical.
The tradeoff is control. Ollama manages quantization choices and flags for you; you get fewer knobs and a smaller model library than Hugging Face offers. It also now ships high-end hosted models, which is worth knowing before you assume "Ollama" means "local."
Best for: your first install, and anyone who wants a server running without thinking about engines.
LM Studio
A desktop app rather than a bare engine — but the runtime matters here, because LM Studio ships two backends and chooses between them: llama.cpp for GGUF on all platforms, and MLX on Apple Silicon. Newer versions add an agentic app, Bionic, on top.
Being an app has real advantages: model discovery, a GUI for settings, and a local OpenAI-compatible server you can point other software at. The counter-tradeoff is that it's proprietary. Free to use, but not open source, and its internals aren't yours to modify.
Best for: desktop and laptop users who want a GUI and a local API with minimal fuss.
Lemonade
A server that treats the engine as a swappable part. Lemonade (Apache 2.0) wraps llama.cpp, FastFlowLM, ONNX Runtime and ROCm behind one process, then adds a model manager, a tray app, a CLI and a local API on port 13305. Point any OpenAI-, Ollama- or Anthropic-compatible client at it, or use the MCP gateway to hand its models to an agent harness.
The reason it exists is hardware. FastFlowLM and the Ryzen AI stack give it an NPU path on AMD laptops that llama.cpp alone does not offer, and the project has widened from its AMD origins into a cross-vendor effort. It is also unusually honest about backends: pin llama.cpp to a specific build, track upstream releases, or point it at a binary you compiled yourself.
The tradeoff is complexity. Four backends means four sets of quirks, model support depends on which backend a model lands on, and the settings surface is far larger than Ollama's.
Best for: AMD laptops and Ryzen AI machines, and anyone who wants one API over several engines.
MLX
Apple's own array framework, built for Apple Silicon, MIT licensed. Because it's designed around unified memory from the ground up, it can be more efficient than a ported engine on M-series chips — particularly on newer architectures where Apple's own kernels know the hardware.
MLX models use a different format from GGUF, so the ecosystem is separate. You'll find MLX conversions of popular models but not the whole catalogue.
Best for: Apple Silicon users who want maximum performance and don't mind a smaller model selection.
vLLM
The production serving engine. Apache 2.0, from UC Berkeley, and the default choice for GPU servers. Its defining idea is PagedAttention — treating the KV cache like virtual memory pages so it isn't wasted on fragmentation. It batches aggressively, supports tensor parallelism across GPUs, and has very wide hardware and format coverage, including GGUF (experimental, through a plugin).
This is not the engine for a laptop. It's what you use when several people are hitting the same model at once.
Best for: self-hosted servers, multi-user workloads, and anything with GPU headroom to exploit.
SGLang
The other server engine, Apache 2.0. Its central idea is RadixAttention: reusing the KV cache for shared prompt prefixes across requests, which is exactly what happens when an app sends the same system prompt thousands of times. Paired with cache-aware scheduling, it can beat vLLM in time-to-first-token on prefix-heavy traffic.
Benchmarks between vLLM and SGLang go both ways depending on the workload, so treat any single comparison as anecdotal.
Best for: serving where many requests share a long prefix — agents, RAG, structured chat.
oMLX
An Apple-native server built directly on MLX, shipped as a menu bar app plus a CLI. Its distinguishing trick is a two-tier KV cache: hot blocks stay in RAM, cold blocks spill to SSD, and previously seen prefixes are restored across requests — even across server restarts — instead of being recomputed. Coding agents resend a shifting prefix on every turn, so this is the difference between a local assistant that feels instant and one that feels broken.
It also does continuous batching, serves several model types at once, and speaks both OpenAI and Anthropic APIs, which is why Claude Code, Cursor and OpenClaw can point straight at it. The /admin dashboard handles model management, benchmarking and metrics — and it'll chat with you from there, so on a Mac you may already have a front-end without installing one.
Best for: Apple Silicon users running coding agents or long-context work.
The rest, briefly
- TensorRT-LLM — NVIDIA's own engine, tuned hard for specific NVIDIA data-center cards. Fast, and a hardware commitment.
- ONNX Runtime GenAI — cross-platform, runs ONNX models; the path of choice for some embedded and Windows scenarios.
- Hugging Face TGI — long the default in Kubernetes shops, now in maintenance mode; new builds should look at vLLM or SGLang.
- DeepInfer — DeepSeek's production stack, open-sourced in October 2026. Offline only, one model, datacenter Blackwell or Ascend. Not for home use, but a good illustration that labs increasingly ship their own engines.
Comparing them
Four of these are engines. Three are wrappers or servers that ship an engine inside. The split matters more than any single row: when you pick Ollama or LM Studio you are choosing llama.cpp with a management layer on top, so performance follows the engine, not the wrapper.
Engines and frameworks
| Engine | License | Formats | Best hardware | Batching | Pick it when |
|---|---|---|---|---|---|
| llama.cpp | MIT | GGUF | Anything, CPU + GPU hybrid | Basic | You want to run locally on almost any machine |
| MLX | MIT | MLX | Apple Silicon only | Basic | You're on a Mac and want max speed |
| vLLM | Apache 2.0 | safetensors, AWQ, GPTQ, FP8, GGUF (plugin) | NVIDIA, AMD, TPU, more | Yes, advanced | Several users share one model |
| SGLang | Apache 2.0 | safetensors, AWQ, GPTQ, FP8 | NVIDIA, AMD, others | Yes, prefix-aware | Many requests share a long prompt |
| TensorRT-LLM | Apache 2.0 | NVIDIA formats | NVIDIA datacenter GPUs | Yes | You're fully committed to NVIDIA |
Servers and wrappers
| Server | License | Underneath | Best hardware | Batching | Pick it when |
|---|---|---|---|---|---|
| Ollama | MIT | llama.cpp | CPU, Metal, CUDA, ROCm | Basic | You want one command and a local API |
| LM Studio | Proprietary | llama.cpp, MLX | Mac, Windows, Linux | Basic | You want a GUI and a server |
| Lemonade | Apache 2.0 | GGUF, ONNX | Windows, Linux, Mac; CPU, GPU, NPU | Basic | You want one API over several engines, or an NPU path |
| oMLX | Apache 2.0 | MLX | Apple Silicon, macOS 15+ | Yes (continuous) | Mac coding agents, long context, SSD KV cache |
The practical hierarchy
In order of how much control you trade for how much convenience you gain:
llama.cpp → Ollama / LM Studio → vLLM / SGLang
llama.cpp is the engine most things are built on. Ollama wraps it for convenience. LM Studio wraps it (plus MLX) for a GUI. vLLM and SGLang are a separate lineage — optimized for serving many users, not for fitting a model onto your laptop.
That's not a quality ranking. Oiling the chain for one person and for five hundred people are different problems.
Rules of thumb
- Start with the format, not the engine. If the file is GGUF, you're in llama.cpp territory. If it's safetensors, you're in vLLM/SGLang/MLX territory. Half of engine choice is already decided by which file you downloaded.
- The wrapper is not the engine. Ollama and LM Studio ship llama.cpp. Performance follows the engine, not the wrapper.
- A Mac is not a server. For one person on an M-series chip, llama.cpp or MLX is right; vLLM on a Mac is at best experimental.
- Quantization support often decides it. If you need a 2-bit quant to fit, most serving engines are out.
- Benchmarks won't settle it. Every comparison you read is real for someone's workload and wrong for yours. Run your own model on your own hardware.
- Engine choice is usually reversible. Most engines speak OpenAI-compatible APIs, so switching clients usually means changing a base URL and a model name.
Why it matters: the engine is where all the performance you actually feel comes from — the same model can be fast and pleasant or slow and useless depending on which one runs it.
Related: Local AI tools, layer by layer · VRAM Fit Calculator · Memory Bandwidth · Start Here
Sources: llama.cpp; Ollama; LM Studio; MLX; vLLM docs; SGLang; Red Hat — vLLM vs SGLang. Accessed November 1, 2026.
