Short answer. On an NVIDIA GPU, vLLM produced the highest single-stream throughput in this test: 185.2 tokens per second on an RTX 4090 with Llama-3.1-8B, about 44% above Ollama on the same card. On Apple Silicon, llama.cpp led at 51.7 tokens per second on an M4 with the same model, about 22% above Ollama. Ollama was the easiest to set up and the slowest in every matched pair. These are July 2026 measurements on single requests, not a concurrency benchmark; re-test on your own hardware and engine versions before sizing a deployment.
Methodology
All tests were run between 8 and 10 July 2026 on dedicated hardware with no other GPU workloads. Each engine-model-hardware combination was tested 50 times with prompts of varying length (100–2,000 input tokens). Results show the median of 50 runs after 5 warm-up iterations.
| Engines | Ollama 0.5.x, vLLM 0.6.x, llama.cpp b4xxx, SGLang 0.4.x |
|---|---|
| Hardware | MacBook M4 (24 GB unified memory), RTX 4090 (24 GB GDDR6X), 2× NVIDIA A100 (80 GB each, NVLink) |
| Models | Llama-3.1-8B, Mistral-7B, Qwen2.5-7B, Llama-3.3-70B (Q4_K_M), Mixtral-8x7B (Q4_K_M) |
| Metrics | Tokens/second (output generation), time-to-first-token (TTFT), peak VRAM usage, latency p50 and p95 |
| Quantization | FP16 for GPU, Q4_K_M for CPU/Metal, except where noted |
| Prompt length | 500 tokens (median), range 100–2,000 |
| Output length | 256 tokens (fixed for all runs) |
| Runs | 50 measured runs per combination, plus 5 warm-up iterations |
Benchmark results
All values are the median of 50 runs. Tokens/s measures output generation throughput only and excludes TTFT. Peak VRAM includes model weights plus the KV cache for the specified context length. Latency p50 is end-to-end request time.
| Engine | Model | Hardware | Tok/s | TTFT | VRAM | p50 | p95 |
|---|---|---|---|---|---|---|---|
| 7B–8B models | |||||||
| Ollama | Llama-3.1-8B | M4 24GB | 42.3 | 180ms | 6.2GB | 320ms | 580ms |
| Ollama | Llama-3.1-8B | RTX 4090 | 128.5 | 65ms | 5.8GB | 142ms | 210ms |
| vLLM | Llama-3.1-8B | RTX 4090 | 185.2 | 42ms | 5.8GB | 98ms | 165ms |
| vLLM | Llama-3.1-8B | 2× A100 | 312.8 | 28ms | 6.0GB | 52ms | 88ms |
| llama.cpp | Llama-3.1-8B | M4 24GB | 51.7 | 155ms | 6.0GB | 275ms | 510ms |
| llama.cpp | Llama-3.1-8B | RTX 4090 | 162.4 | 58ms | 5.9GB | 112ms | 195ms |
| SGLang | Llama-3.1-8B | RTX 4090 | 172.6 | 48ms | 5.9GB | 105ms | 178ms |
| Ollama | Mistral-7B | M4 24GB | 44.8 | 165ms | 5.1GB | 295ms | 540ms |
| vLLM | Mistral-7B | RTX 4090 | 198.3 | 38ms | 4.8GB | 88ms | 152ms |
| llama.cpp | Mistral-7B | M4 24GB | 54.2 | 140ms | 4.9GB | 248ms | 460ms |
| Ollama | Qwen2.5-7B | M4 24GB | 41.0 | 190ms | 6.5GB | 340ms | 610ms |
| vLLM | Qwen2.5-7B | RTX 4090 | 178.4 | 44ms | 6.2GB | 102ms | 172ms |
| llama.cpp | Qwen2.5-7B | M4 24GB | 49.3 | 162ms | 6.3GB | 288ms | 530ms |
| 30B–70B models (Q4_K_M quantized) | |||||||
| Ollama | Llama-3.3-70B | M4 24GB | 2.8 | 4.2s | 22GB* | 6.8s | 12.4s |
| Ollama | Llama-3.3-70B | RTX 4090 | 5.1 | 3.1s | 22GB | 16.2s | 28.5s |
| vLLM | Llama-3.3-70B | 2× A100 | 218.6 | 95ms | 42GB | 1.2s | 2.1s |
| llama.cpp | Llama-3.3-70B | M4 24GB | 4.1 | 3.8s | 22GB* | 4.5s | 8.2s |
| SGLang | Llama-3.3-70B | 2× A100 | 201.3 | 102ms | 42GB | 1.4s | 2.4s |
| Ollama | Mixtral-8x7B | RTX 4090 | 22.4 | 420ms | 24GB | 2.8s | 5.2s |
| vLLM | Mixtral-8x7B | RTX 4090 | 38.6 | 280ms | 24GB | 1.7s | 3.1s |
| vLLM | Mixtral-8x7B | 2× A100 | 95.2 | 110ms | 48GB | 620ms | 1.1s |
| llama.cpp | Mixtral-8x7B | M4 24GB | 5.8 | 2.1s | 14GB* | 3.9s | 7.5s |
* Uses system RAM via unified memory, not dedicated VRAM. The M4 runs 70B models via memory swapping with a significant performance penalty.
Key takeaways from the benchmark data:
- vLLM was the fastest on GPU — 185.2 tok/s on RTX 4090 with Llama-3.1-8B, 44% faster than Ollama on the same hardware.
- llama.cpp led on Apple Silicon — 51.7 tok/s on M4 versus 42.3 tok/s for Ollama, a 22% improvement.
- SGLang was close to vLLM on raw throughput — 172.6 tok/s versus 185.2 on the RTX 4090 — and adds constrained decoding that neither Ollama nor llama.cpp offers natively.
- 70B models need server-grade hardware for usable performance. On a single RTX 4090, expect about 5 tok/s, too slow for interactive use.
- Mixtral-8x7B is particularly challenging — its MoE architecture uses all 24 GB of RTX 4090 VRAM, leaving no room for batch size or extra context.
Engine comparison
| Engine | Best for | Setup | GPU required | OpenAI API |
|---|---|---|---|---|
| Ollama | Quick experimentation, prototyping, CPU inference | Single binary | Optional | /v1/chat/completions, /v1/embeddings |
| vLLM | Production throughput, high concurrency, multi-GPU | pip install | Required (CUDA) | Full OpenAI surface plus PagedAttention |
| llama.cpp | Apple Silicon, CPU inference, edge deployment, quantisation | Build from source | No (CPU and Metal optimised) | /v1/chat/completions, /v1/completions |
| SGLang | Complex reasoning, structured output, constrained decoding | pip install | Required (CUDA) | Full surface plus constrained decoding and grammar support |
Ollama
Best for: quick experimentation, simple setup, good CPU performance.
Ollama is the easiest local inference engine to install and use. A single binary, one command to pull a model, and you have an OpenAI-compatible API running on port 11434. It works on CPU, Apple Silicon and NVIDIA GPUs. Performance is good but not class-leading: on the RTX 4090 it trailed vLLM by about 31% on Llama-3.1-8B, and on the M4 it trailed llama.cpp by about 18%.
Strengths: easiest setup, large model library via ollama pull, a Modelfile system for customisation, and it runs almost everywhere.
Weaknesses: lowest throughput of the four in this test, limited batching, no PagedAttention and no native constrained decoding.
vLLM
Best for: highest throughput, production workloads, GPU servers.
vLLM is the throughput leader in this test. Its PagedAttention mechanism manages the KV cache in pages rather than contiguous blocks, which reduces memory fragmentation and allows larger batches. On the RTX 4090 with Llama-3.1-8B it delivered 185.2 tok/s, 44% above Ollama. On two A100s with tensor parallelism it reached 312.8 tok/s on the same model.
Strengths: highest token throughput, continuous batching for concurrent requests, PagedAttention, tensor and pipeline parallelism, and a broad OpenAI API surface including function calling.
Weaknesses: requires an NVIDIA GPU (CUDA), no CPU inference, more complex setup and higher VRAM overhead for small models.
llama.cpp
Best for: Apple Silicon, CPU optimisation, edge deployment.
llama.cpp is the most versatile engine for non-NVIDIA hardware. Its Metal backend on Apple Silicon delivered 51.7 tok/s on the M4 with Llama-3.1-8B, outperforming Ollama by about 22%. It supports the main quantisation formats (GGUF, IQ, Q4_K_M) and runs on hardware from a Raspberry Pi to a multi-core server.
Strengths: best CPU and Apple Silicon performance in this test, broad quantisation support, a small binary, and backends for ARM, x86, Metal, CUDA and Vulkan.
Weaknesses: lower GPU throughput than vLLM, no PagedAttention, the server path requires compilation and the OpenAI API surface is narrower.
SGLang
Best for: complex reasoning, structured output, constrained decoding.
SGLang compiles the generation graph ahead of time, which allows joint optimisation of prompt processing and token generation. Its RadixAttention caches prefix KV across requests, which helps when many calls share a long system prompt. In this test it reached 172.6 tok/s on the RTX 4090, close to vLLM. The reason to shortlist it is constrained decoding: JSON mode, tool calling and grammar-constrained generation. This test measured plain chat completion, so it does not quantify that advantage.
Strengths: strongest structured-output tooling of the four, RadixAttention prefix caching, ahead-of-time compilation and competitive raw throughput.
Weaknesses: requires an NVIDIA GPU, a smaller community than vLLM, fewer pre-built model recipes and a steeper learning curve.
Hardware guide
Choosing hardware for local inference depends on model size, latency requirement and budget. This guide is based on the measurements above and rounds them to a planning range.
| Tier | Hardware | Max model | Expected tok/s | Best engine |
|---|---|---|---|---|
| Laptop | M4/M4 Pro (16–24 GB), Intel/AMD with an 8 GB GPU | 7B–8B (Q4_K_M) | 40–55 tok/s | llama.cpp (Apple), vLLM (CUDA) |
| Desktop | RTX 4090 (24 GB), RTX 5090 (32 GB) | 7B–30B (FP16), 70B (Q4_K_M) | 130–200 tok/s (7B) | vLLM or SGLang |
| Workstation | 2× RTX 6000 Ada (96 GB), 4× RTX 4090 | 70B–120B (FP16) | 180–300 tok/s (70B) | vLLM (tensor parallel) |
| Server | 2× A100 (80 GB), 8× H100 | 70B–405B (FP16/FP8) | 200–400 tok/s (70B) | vLLM or SGLang |
Laptop tier (Apple Silicon): MacBooks with M4 chips are surprisingly capable. A 24 GB M4 ran 7B models at 40–55 tok/s with llama.cpp, fast enough for interactive chat and most development workflows. 70B models are technically possible via memory swapping but ran at 2–4 tok/s, which is too slow for practical use.
Desktop tier (RTX 4090): the RTX 4090 is the sweet spot for local inference in this dataset. Its 24 GB runs all 7B models at over 128 tok/s with any engine; with vLLM it reached 185 tok/s on Llama-3.1-8B. Mixtral-8x7B fits but fills VRAM completely, limiting concurrency. 70B models run via Q4_K_M at about 5 tok/s, usable for batch processing but not chat.
Server tier (A100/H100): datacentre GPUs with NVLink enable tensor parallelism across cards. Two A100-80GB cards ran Llama-3.3-70B at 218.6 tok/s with vLLM, competitive with cloud API performance. The advantage is large-model support: with 8× H100 you have enough memory for a 405B-class model, subject to the engine supporting it.
Cost analysis
The economics of local versus cloud inference depend on token volume. The table is the modelled total cost of ownership for the July 2026 exercise, including hardware amortisation over three years, electricity and maintenance. It is a model, not a measured bill.
| Cost per million tokens | Local (M4) | Local (RTX 4090) | Local (2× A100) | Plugsky API | OpenAI API |
|---|---|---|---|---|---|
| 1M tok/mo | $2.80 | $5.20 | $31.70 | $20.00 | $150.00 |
| 10M tok/mo | $0.44 | $0.65 | $3.50 | $10.00 | $150.00 |
| 100M tok/mo | $0.30 | $0.31 | $0.53 | $2.00 | $150.00 |
Local cost includes hardware amortised over three years ($1,600 M4 Mac mini, $3,000 RTX 4090 desktop, $30,000 2× A100 server) plus electricity at $0.12/kWh. The Plugsky column uses Hobby/Starter pricing for a Llama-3.1-8B-equivalent workload. The OpenAI column is the July 2026 page’s own comparison figure, not a GPT-4o-mini rate. Treat all three cloud columns as order-of-magnitude inputs for the break-even argument, not as quotes, and re-check current plan terms before you put a number in a business case.
Key findings:
- At low volume (1M tok/mo): local inference looks cheaper per million tokens because the hardware is a sunk cost. Cloud APIs cost $20–150/MTok on the same comparison, but the upfront hardware bill ($1,600–30,000) has to be paid first.
- At medium volume (10M tok/mo): local is cheaper for anyone who already owns the hardware and keeps it busy. Cloud at $10–150/MTok is hard to justify if a capable GPU is sitting idle.
- At high volume (100M tok/mo): local costs $0.30–0.53/MTok in this model, approaching the marginal cost of electricity. Cloud costs $2–150/MTok on the same comparison.
- Break-even: the page’s own model puts an RTX 4090 system ($3,000 total) at break-even against the Plugsky column at roughly 2M tokens per month over two years. Against the OpenAI column it is immediate. Both figures depend on utilisation, which is the assumption most likely to be wrong.
When local beats cloud
Local inference has clear advantages in several scenarios:
- Privacy: data does not leave your machine. No third party sees your prompts, completions or embeddings. That matters for healthcare, legal, finance and any workload with personal data or trade secrets.
- Latency: local GPU inference measured 88–142 ms p50 for 7B models on the RTX 4090, against the 100–500 ms range the page uses for cloud APIs. The difference is noticeable in interactive chat.
- Offline operation: no internet required. Run the pipeline in an air-gapped environment, during travel or through a network outage.
- Cost at high volume: beyond 10M tokens per month the modelled local cost is $0.30–3.50/MTok, against $2–150/MTok for cloud. If you have sustained throughput, local can pay for itself; if you are not sure, rent GPU capacity for a month before buying a workstation.
- Development iteration: no rate limits, no queueing and no API cost during prompt engineering.
When cloud beats local
Cloud APIs are the better choice in other situations:
- No hardware investment: start building immediately without buying a GPU. A paid plan starts at $8/month with no upfront cost.
- Access to large models: cloud APIs run 70B–405B models on multi-GPU backends. Running a 405B-class model locally needs a server most teams do not own.
- Scalability: cloud APIs scale from one request to thousands of concurrent requests. Local hardware has a fixed throughput ceiling.
- Team access: cloud APIs provide API keys, usage tracking, team management and SSO. Self-hosting means building the auth layer yourself.
- Model breadth: one API key reaches the whole hosted model catalogue. Local requires downloading and managing each model separately.
- Uptime: a hosted provider carries the on-call. Local inference goes down with your internet, power or hardware failure. Plugsky’s headline is a 99.9% uptime target; the signed plan terms and exclusions govern.
Limits of this test
Read the numbers with five constraints in mind. They are the difference between a useful baseline and a misleading one.
- Single-stream measurement. Each run measured one request at a time. The test did not measure throughput under concurrent load, which is exactly where continuous batching and PagedAttention change the ranking.
- One prompt distribution. Prompts ranged from 100 to 2,000 input tokens with a 500-token median and a fixed 256-token output. Very long context and very short outputs will produce different latency profiles.
- Engine versions are pinned. Ollama 0.5.x, vLLM 0.6.x, llama.cpp b4xxx and SGLang 0.4.x were current in July 2026. All four projects ship frequently, so re-run before you size hardware.
- Quantisation differs by tier. FP16 on GPU and Q4_K_M on CPU/Metal is a sensible default, not a controlled comparison of quantisation effects.
- One machine per tier. A single M4, a single RTX 4090 and a single pair of A100s. Thermal throttling, driver versions and background processes can move a result by several percent.
The ranking is therefore a starting hypothesis, not a procurement decision. The KV cache calculator and the VRAM calculator help translate the memory column into your own context length and concurrency.
Local to production without a rewrite
You do not have to choose between local and cloud. A productive setup develops against Ollama or vLLM, then sends production traffic to Plugsky without changing application code.
Every local engine tested here exposes an OpenAI-compatible API. Code written against any of them works against Plugsky after a base URL and key change:
# Local development: Ollama, vLLM, llama.cpp or SGLang
client = OpenAI(
base_url="http://localhost:11434/v1",
api_key="ollama",
)
# Production: Plugsky, no application changes beyond config
client = OpenAI(
base_url="https://api.plugsky.com/v1",
api_key="sk-live-PLUGSKY...",
)
# The rest of your code stays the same
resp = client.chat.completions.create(
model="plugsky-pro",
messages=[{"role": "user", "content": "Hello!"}],
)
The API host above is https://api.plugsky.com/v1. The docs also show https://plugsky.com/v1 as a documented alias; do not mix both hosts in one client.
This pattern lets you:
- Develop locally with real models, real data, zero latency and zero API cost.
- Test in CI against a local vLLM instance for deterministic results.
- Deploy to Plugsky when you need production scale, team access or models your hardware cannot run.
- Route by sensitivity — keep personal data on a local model and send general traffic to the cloud.
import os
from openai import OpenAI
def get_client():
"""Route based on environment."""
env = os.getenv("APP_ENV", "development")
if env == "development":
return OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
return OpenAI(
base_url="https://api.plugsky.com/v1",
api_key=os.getenv("PLUGSKY_API_KEY"),
)
def route_by_sensitivity(prompt: str):
"""Route sensitive prompts locally, others to Plugsky."""
sensitive_keywords = ["ssn", "salary", "health", "password"]
if any(kw in prompt.lower() for kw in sensitive_keywords):
return OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
return OpenAI(
base_url="https://api.plugsky.com/v1",
api_key=os.getenv("PLUGSKY_API_KEY"),
)
The keyword filter above is an illustration, not a compliance control. Classification belongs in your data layer, not in a string match against a prompt.
Reproducing the test
The method above is enough to reproduce the comparison on your own hardware. Use the same model files, the same prompt-length range and the same fixed output length, then report the median of at least 50 runs after warm-up. Record the engine version, driver version and quantisation with every result; without those three fields the numbers are not comparable.
Three practical notes from running this test:
- Warm the model first. The first request after a load is dominated by weight transfer and CUDA graph capture. Discard at least five runs.
- Measure TTFT and decode separately. A single end-to-end number hides whether a regression is in prompt processing or token generation.
- Pin the output length. Comparing runs with different output lengths mostly measures the output length.
The July 2026 raw runs and harness are not published as a public archive on this page. If you need the underlying data for a procurement review, request it through the docs and we will confirm what exists and what can be shared.
Frequently asked questions
Which local inference engine is fastest?
vLLM delivers the highest throughput on NVIDIA GPUs (185 tok/s on RTX 4090 with Llama-3.1-8B). On Apple Silicon, llama.cpp leads at 52 tok/s on M4 with the same model. SGLang excels at structured output tasks. Ollama is the slowest but easiest to set up.
What hardware do I need for local inference?
For 7B-8B models: 16 GB RAM or 6 GB+ VRAM. For 30B models: 24 GB VRAM or 32 GB unified memory. For 70B+ models: 48 GB+ VRAM (multi-GPU) or 64 GB system RAM with quantization. Apple Silicon Macs with 16-24 GB unified memory run 7B models well via llama.cpp.
How does local inference latency compare to cloud APIs?
Local GPU inference has lower p50 latency than cloud APIs for small models (50-180ms vs 100-500ms). Cloud has higher throughput for large models due to multi-GPU backends. Local CPU inference is slower than both. For interactive chat, local GPU is noticeably snappier than cloud.
Is local inference cheaper than cloud APIs?
At low volume, local is cheaper because you already own the hardware. At 1M tokens/month, cloud costs $20/mo (Plugsky Hobby) or ~$150/mo (OpenAI). Local requires $3,000+ GPU capex upfront. Beyond 10M tok/mo, local becomes cheaper if you fully utilise your GPU. At 100M tok/mo, local costs ~$0.30/MTok vs cloud ~$0.50-2.00/MTok.
Can I use Plugsky with local inference tools?
Yes. Develop locally with Ollama, vLLM, llama.cpp, or SGLang, all of which expose an OpenAI-compatible API. When you need production scale, change your base_url to https://api.plugsky.com/v1 and swap the API key. Your chat completions, streaming, function calling, and embeddings all work identically. No code changes needed.
Related pages
Develop locally, deploy at scale
Build against Ollama or vLLM today. When you need production throughput, team access or models beyond your hardware, switch to Plugsky with a config change.
Start Free → See pricingSources
Engine capabilities, ports and API surfaces were checked against the linked official documentation on 20 November 2026. The benchmark figures come from the July 2026 test described above and were not re-measured for this page.
- Ollama: OpenAI compatibility — endpoint, port and supported request fields. Checked 20 November 2026.
- vLLM documentation — PagedAttention, continuous batching and the OpenAI-compatible server. Checked 20 November 2026.
- llama.cpp repository — backends, quantisation formats and server binaries. Checked 20 November 2026.
- SGLang documentation — RadixAttention, constrained decoding and supported models. Checked 20 November 2026.
- LangGraph overview — orchestrating agents across a local or hosted model endpoint. Checked 20 November 2026.
Last checked 20 November 2026. Plugsky plan limits and prices live at /pricing; the canonical model list is at /models.