Why "VRAM budget" beats "bigger model is better"

Free local tokens are not unlimited. Their ceiling is set by VRAM: weights, KV cache, and CUDA context all compete for the same memory. In 2026, a 16–24GB consumer GPU runs 7B–14B models at 4-bit quantization comfortably; going past 32B means doing the KV cache math before you start.

So the point of this guide is not "which model to install" but splitting VRAM into two budgets: one for an Ollama resident small model (daily Q&A, code completion), one for vLLM batch jobs (long-doc summarization, bulk classification, offline data cleaning). Two budgets that do not cannibalize each other is what keeps tokens available at all times.

Steps

Step 1: Compute your VRAM budget

```bash

nvidia-smi --query-gpu=name,memory.total,memory.used --format=csv

```

Rough rules of thumb (approximate; varies with model and context length):

  • Weight footprint ≈ parameters × bytes per parameter. 4-bit ≈ 0.55–0.6 bytes/param, 8-bit ≈ 1.1, FP16 ≈ 2.
  • KV cache scales with context length and concurrency; a 14B model at 8K context, single request, typically uses 1–3GB.
  • Leave 1–2GB for CUDA context and framework overhead.

Example on a 24GB card: Ollama holds a 7B 4-bit model at ~5GB; vLLM gets a 14B 4-bit model (~9GB weights) plus ~4GB for KV cache. Write this ledger into a config file; every later tuning decision references it.

Step 2: Let Ollama own the low-latency daily budget

```bash

ollama pull qwen2.5-coder:7b-instruct-q4_K_M

ollama pull llama3.1:8b-instruct-q4_K_M

```

Pin the resident model so it is not evicted:

```bash

export OLLAMA_KEEP_ALIVE=30m

export OLLAMA_NUM_PARALLEL=2

```

Ollama exposes an OpenAI-compatible endpoint on port 11434 by default; clients can call /v1/chat/completions directly with no adapter layer.

Step 3: Let vLLM own the high-throughput batch budget

vLLM's value is continuous batching and PagedAttention, which shine when you feed hundreds of tasks at once. Cap its memory explicitly so it does not eat Ollama's share:

```bash

vllm serve Qwen/Qwen2.5-14B-Instruct-AWQ \

--port 8001 \

--gpu-memory-utilization 0.55 \

--max-model-len 8192 \

--max-num-seqs 16

```

--gpu-memory-utilization is the direct dial for the budget: 0.55 means at most 55% of VRAM. Align it with the ledger from Step 1.

If one card cannot hold the target model, vLLM supports tensor parallelism:

```bash

vllm serve <model> --tensor-parallel-size 2 --port 8001

```

Two cards can host a larger model, but inter-GPU communication means throughput scaling is usually sublinear.

Step 4: Route in the client, not with server-side magic

Both backends speak OpenAI-compatible APIs, so routing belongs in the client. Minimal example:

```python

from openai import OpenAI

DAILY = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")

BATCH = OpenAI(base_url="http://localhost:8001/v1", api_key="vllm")

def route(task):

if task in ("chat", "completion", "code"):

return DAILY

return BATCH

```

Keep the rule as an explicit list: interactive, low-latency, single request → Ollama; offline, batch, waitable → vLLM. Do not build a smart router that guesses which is faster; the maintenance cost outweighs the benefit.

Step 5: Measure your capacity

Track at least two numbers:

  • Output tokens per second: use vLLM's metrics endpoint or time it client-side.
  • Per-task wall time: run the same 100-summary job on both backends and compare totals.

With these you know how many tokens you can actually produce today, instead of guessing.

Caveats

  • VRAM is a hard limit, not a soft one. Exceed it and the process dies with OOM. Err on the low side with --gpu-memory-utilization.
  • Quantization costs quality. 4-bit is fine for most tasks but can degrade noticeably on math, long-chain reasoning, and structured output. Run an FP16 or 8-bit control on critical jobs.
  • AWQ / GPTQ weights must match the vLLM version. Regression-test on a small sample after upgrading vLLM.
  • KEEP_ALIVE and NUM_PARALLEL cut both ways. A resident model saves load time but holds VRAM; higher concurrency absorbs bursts but competes with vLLM.
  • Single-box dual backend is not high availability. If the machine dies, both services die. Redundancy needs a second box or a cloud fallback.
  • Check model licenses. Some open weights are research-only or non-commercial; verify before commercial use.

When this fits

  • Solo developers or small teams with a 16GB+ GPU who want both daily chat and batch processing local.
  • Data-sensitive work that cannot leave the intranet: contract review, internal knowledge-base Q&A, log classification.
  • Offline environments that need predictable token supply: air-gapped racks, mobile workstations.
  • As a fallback for cloud free tiers: when a cloud quota is rate-limited or exhausted, the local backend takes over immediately.

When it does not

  • Complex reasoning that needs frontier-level model capability.
  • CPU-only machines (it runs, but usually not at practical speed).
  • Production systems needing multi-tenant isolation and billing.

A reusable checklist

  1. nvidia-smi for total and current VRAM.
  2. Compute two budgets (weights + KV cache + framework overhead) and write them into config.
  3. Pin the Ollama resident model; set KEEP_ALIVE and NUM_PARALLEL.
  4. Cap vLLM with --gpu-memory-utilization; enable --tensor-parallel-size as needed.
  5. Route client-side by task type with hard-coded rules.
  6. Record tokens/s and per-task time to build a capacity baseline.
  7. Review VRAM usage and OOM logs weekly; adjust the two ratios to real load.