Ditching Ollama for llama.cpp cut first-token latency up to 13× in a local LLM game
Rikkendo · reddit · 2026-11-26
The dev of Warrior Quest, a local LLM-powered RPG, shares a detailed inference-stack postmortem.
- The Ollama trap: its per-request context window option reloads the model on every size change (2.7s vs 150ms warm), costing 5s per switch — a performance feature that was actually a penalty.
- Why llama-server wins: each turn runs multiple stages (router, parser, reply) with long system prompts. Ollama keeps one prompt cache per model, so stages kept evicting each other and re-reading 3,000 tokens. With llama-server each stage gets its own cache slot, so a turn only reads the player's new line.
- First-token latency (qwen2.5 7B): RTX 4090 1.3s→0.7s (1.86×), 3060 Ti 2.8s→1.3s (2.15×), GTX 1660 Ti 41.3s→3.2s (13×), M1 Pro 5.7s→4.3s.
- Output quality unchanged (566/567 vs 567/567). Tradeoff: self-compiled CUDA builds for older cards, Vulkan for AMD/Intel, Metal on Mac, with Ollama kept as fallback.
More from coding & agent
- Open-source Claude Skill turns P&ID drawings into LLM-queryable process knowledge graphs — adnan_hashmi · 2026-11-26
- 35-year Linux kernel veteran Ts'o fumbles with agents, sparking 'don't read the code' debate — wavefnx · 2026-11-26
- SteerCamp launches $29/$49 team plans that piggyback on your Claude or Cursor subscription — pramodk73 · 2026-11-26
- Dev builds interactive periodic table with Claude Code, shares lessons on keeping AI chemistry accurate — strange1807 · 2026-11-26
- Anthropic Talks Map the New Engineering Problems of the Multiagent Era — craigsdennis · 2026-11-26
- Google Enforces 5K Requests/Day Rate Limits on AI Agents Using Gmail, Drive and Calendar — yenkel · 2026-11-26