Replacing Ollama with a llama.cpp router on a shared workstation GPU
- Models & engines
- llama-server in router mode with --models-preset and --models-max 6, run in a container
Pipeline model Qwen3.5-9B Q6_K with an MTP draft head, bge-m3 for embeddings, a big model on demand
A boot service copies the most-used GGUF files into a tmpfs ramdisk before the router starts - Key gotcha
- --models-max limits how many instances run, not how much VRAM they need.
What they built
The author's workstation has one GPU serving an interactive chat UI, a local AI agent, a library that writes study guides around the clock, embedders for search and classifiers for a threat-intelligence pipeline. Ollama's store held 49 models and about 435 GB of weights.
Ollama's scheduler kept wedging when a new model had to evict a runner that was never idle, so he moved everything to a single llama.cpp router: one OpenAI-compatible port, presets in one INI file, models loaded on request and put to sleep after an idle timeout.
He removed 47 of the 49 models, freeing about 400 GB, after measuring which clients still called Ollama.
Setup
- One workstation GPU shared by interactive and batch callers
- llama-server in router mode with --models-preset and --models-max 6, run in a container
- Pipeline model Qwen3.5-9B Q6_K with an MTP draft head, bge-m3 for embeddings, a big model on demand
- A boot service copies the most-used GGUF files into a tmpfs ramdisk before the router starts
How it works
- The request's model field names the preset section; the router spawns a child llama-server for it.
- sleep-idle-seconds frees a model's weights after the timeout; a sleeping instance keeps about 0.24 to 0.32 GB and bge-m3 woke in about 2.5 seconds.
- load-on-startup keeps the pipeline model warm without a cron job.
- For each embedder he embedded the same texts through both servers and compared cosine similarity before moving it.
- Clients were moved one at a time, and Ollama was disabled only after 24 hours with no non-probe requests in its log.
Results & numbers
- On the same study-guide prompt, Ollama did 468 sections per hour; llama.cpp did 1,009 per hour at default batch settings and 1,364 tuned. vLLM reached 2,004 but held 14.7 GiB of VRAM.
- The 9B model with MTP gave 67 tokens/s for one stream and 1,468 sections/h at 16 in flight, with 32 of 32 answers valid JSON.
- bge-m3 vectors matched at cosine 0.99996 to 1.0; nomic-embed-text did not (0.86 to 0.98) because the tokenizer differs.
- Disk use on that drive went from 61% to 39%.
Gotchas
- --models-max limits how many instances run, not how much VRAM they need.
- Polling /slots?model=X keeps that model awake; one worker held 4.5 GB of VRAM this way. Poll the router-level GET /models instead.
- A single-file bind mount keeps the old inode after sed -i or mv; edit in place and call GET /models?reload=1.
- Deleting a GGUF from tmpfs doesn't free space while the router has it mapped.
- Not every GGUF conversion keeps the MTP head; check the tensor list before downloading.
“I like Ollama. For one person and one model at a time, it is hard to beat. My workstation is not that”— Lișneanu Dumitru-Cristian
Do it yourself
- Benchmark Ollama and llama-server on your real prompts and concurrency.
- Write a preset INI with a [*] default section and one section per model.
- Start llama-server --models-preset models.ini --models-max N and point clients at its OpenAI-compatible port.
- Use sleep-idle-seconds for on-demand models and load-on-startup for always-warm ones.
- Compare embedding vectors for identical input through both servers before moving any embedder.
- Inventory Ollama's request log, move clients one by one, wait for zero real clients, then delete models with a saved manifest.
version = 1
[*]
ngl = 999
fa = on
[qwen3.5-9b]
model = /models/Qwen_Qwen3.5-9B-Q6_K.gguf
c = 65536
parallel = 8
load-on-startup = true
[big-model]
model = /models/<big-model>.gguf
sleep-idle-seconds = 300Similar setups
Running NVIDIA's looped Dory 4B on a CPU homelab with llama.cpp and an Ollama wrapper
Big Iron built NVIDIA's llama.cpp fork on a no-GPU Debian VM, measured Dory 1.0 4B at each loop count against Qwen3.5-4B, and got it running inside Ollama 0.40 through a wrapper around Ollama's internal llama-server.
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.
Two Qwen Code sessions on one Ollama slot waited 46 seconds; a slot each waited one
Tensward ran two Qwen Code sessions against Qwen3.8-27B on a 24 GB L4 and found that sharing one Ollama slot raised the median wait for a response to start from about one second to 46.
Running a 35B MoE model on a laptop with a 4 GB GTX 1650: measured, not guessed
Nabil Doghri ran Qwen3.6-35B-A3B (Q4_K_M) through Ollama on a GTX 1650 Max-Q laptop and measured about 21-22 tokens per second once loaded, with most of the 23 GB model sitting in system RAM.