Home / use case

A self-hosted llama.cpp endpoint on three 16 GB GPUs with presets.ini and Docker

At a glance
Hardware
Three 16 GB GPUs, 64 GB RAM, 56 hardware threads
Models & engines
ghcr.io/ggml-org/llama.cpp:server-cuda in Docker Compose, models bind-mounted from /srv/models
Qwen3.8-27B UD-Q6_K for coding, gemma-4-26B-A4B Q8_0 for chat, each with an mmproj vision file
Key gotcha
Without memlock -1 and ipc: host you get cryptic allocation failures at load time

What they built

Theo Dufort runs a self-hosted AI endpoint on three 16 GB GPUs (48 GB total) and 64 GB of RAM, reached over VPN only with no exposed ports. He says the daily driver comes down to 60 lines of presets.ini and a Docker Compose file, both shared copy-paste ready.

llama.cpp runs in router mode and serves two presets on one OpenAI-compatible /v1 endpoint: a 27B dense Qwen model for coding and a 26B mixture-of-experts Gemma model for general chat, documents and anything sensitive that shouldn't leave the house.

Setup

  • Three 16 GB GPUs, 64 GB RAM, 56 hardware threads
  • ghcr.io/ggml-org/llama.cpp:server-cuda in Docker Compose, models bind-mounted from /srv/models
  • Qwen3.8-27B UD-Q6_K for coding, gemma-4-26B-A4B Q8_0 for chat, each with an mmproj vision file
  • VS Code pointed at the endpoint as a custom OpenAI-compatible provider

How it works

  1. --models-max 1 keeps one model resident in VRAM; cache-ram 16384 reuses prompt prefixes when switching back
  2. Global block: flash-attn on, q8_0 K and V cache, jinja templates, mmap loading, metrics on
  3. Coding preset: tensor-split 1,1,1, MTP plus n-gram speculative decoding, reasoning_effort low with a 5,000-token reasoning budget, one slot
  4. Chat preset: 262,144 context, three parallel slots, DRY anti-loop penalty and a dedicated MTP draft file

Results & numbers

  • The coding preset holds 132K context at 30-35 tokens/s, after three months of iteration
  • He saw no quality loss from a q8_0 KV cache, and couldn't tell Q6 from Q8 in code quality
  • Higher reasoning effort gave no improvement in time-to-solution for coding

Gotchas

  • Without memlock -1 and ipc: host you get cryptic allocation failures at load time
  • ubatch-size 1024 fits on two of the cards but OOMs the last one; 512 fits
  • Declaring a larger context in the client than ctx-size truncates prompts with no obvious error
  • Watchtower is disabled on purpose so a surprise llama.cpp update can't break an overnight run
  • Below q8_0 KV cache, long-context recall starts to go
“If you copy one thing from this article, copy that block.”— Theo Dufort

Do it yourself

  1. Install the hf CLI and download GGUF models into your models folder, plus the mmproj file for vision
  2. Start the llama.cpp CUDA server container with --models-dir, --models-preset and --models-max 1
  3. Write a presets.ini with a [*] global block and one section per model
  4. Check the endpoint with curl http://localhost:8080/v1/models
  5. Point your client at http://your-host:8080/v1 and keep max input + max output within ctx-size
curl -s http://localhost:8080/v1/models | jq '.data[].id'
Source: Theo Dufort (blog) · Published 2026-11-21 · Added 2026-11-28. This write-up summarizes the original source; see it for full details.

Similar setups

A €200 mini PC as an offline AI box: a week with Gemma and Qwen

Diogo Soares ran Gemma 4 E4B and Qwen2.5-Coder 7B on a cheap NiPoGi P1 mini PC firewalled off the internet, used it from his Mac for a week, and measured what was fast and what wasn't.

Diogo Soares (DEV Community) · 2026-10-30

Home RAG assistant for embedded-systems docs on Proxmox

Ollama, llama.cpp, Open WebUI, BGE-M3 and SearXNG in a GPU-passthrough VM. Moving from 6 GB to 16 GB of VRAM changed which models could run.

Ground Bounce · 2026-10-18

Yogurt: private meeting notes on your own computer with whisper.cpp and a local llama.cpp model

Eric built Yogurt, a free MIT-licensed desktop app that records calls without a bot joining, transcribes them with whisper.cpp and writes summaries with a local open-weight model.

Show HN: Yogurt (Hacker News) · 2026-11-14

Re-benchmarking local GGUF models for a coding agent after a llama.cpp upgrade

Jordi Marçal re-ran his fixed coding-agent benchmark on seven local GGUF models after three weeks of llama.cpp updates, and found the harness's generation caps, not the models, explained a sudden score collapse.

DEV Community · 2026-11-09