Running LLMs Locally Cheat Sheet

This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production.

A single-page index of quick back-links to every page in this sub-section, grouped the same way as the sub-section itself — handy for jumping straight to the topic you need instead of paging through the full navigation.

Download the Running LLMs Locally Cheat Sheet (PDF)

The downloadable PDF is a separate, single A4 page meant for printing. It states the version baseline this sub-section targets — Ollama 0.34.4, llama.cpp v0.5.0, vLLM 0.30.0, SGLang 0.5.20, LiteLLM 1.103.0, Claude Code 2.1.284 and Copilot CLI 1.0.89, all checked on 2026-09-28 — and covers:

  • the engine decision tree;

  • the sizing formulas and a quick memory table;

  • the GGUF quant ladder;

  • the Ollama commands and a Modelfile;

  • the llama.cpp, vLLM and SGLang launch lines;

  • the endpoint URLs and default ports per engine;

  • a LiteLLM config.yaml snippet;

  • the Copilot BYOK and Custom Endpoint steps and the Copilot CLI variables;

  • the Claude Code environment variables;

  • the Continue, Aider and OpenCode snippets;

  • the open-weight licence table;

  • the security checklist.

Gateways and optimisation — LLM Gateways and Inference Optimization.

Operations — Running Local LLMs in Production.

A short worked example of the sizing formulas from Hardware Sizing: an 8B model with 32 layers, 8 KV heads of dimension 128, quantized to Q4_K_M (4.89 bits per weight), a 32k context, an FP16 KV cache, one sequence and 1 GiB of overhead.

GIB = 1024**3
params, layers, kv_heads, head_dim = 8.0e9, 32, 8, 128
context = 32768

weights = params * (4.89 / 8) / GIB                                  # P x b
kv = 2 * layers * kv_heads * head_dim * context * 2.0 / GIB          # 2 L n_kv d_h T b B
print(f"weights {weights:.1f} GiB, KV cache {kv:.1f} GiB, total {weights + kv + 1:.1f} GiB")
weights 4.6 GiB, KV cache 4.0 GiB, total 9.6 GiB

At a 32k context the KV cache is almost as large as the weights, which is why the context length matters as much as the quant type when choosing a GPU.