Running a 35B LLM at 128K Context, Full Speed, on €870 of Used Hardware — No Cloud Required
Summary
Benchmarking two used-GPU setups, a €600 build (20 GB VRAM) and a €1000 build (28 GB VRAM), revealed critical insights into local LLM inference performance. The €600 rig, combining an RTX 4070 (12 GB) and an RTX 2070 Super (8 GB), showed that active parameters, not total model size, dictate decode speed; for instance, a 26B MoE model achieved 80 tok/s, four times faster than a dense 27B model. Upgrading to the €1000 build, which swapped the 2070 Super for an RTX 5060 Ti (16 GB), increased VRAM capacity but reduced speed for smaller models by 7-8% due to the 5060 Ti's lower memory bandwidth. Crucially, the 35B MoE model, which previously spilled 30% to CPU, saw an 85% speed increase (43 to 79 tok/s) and could run at 104 tok/s with 128K context on tuned configurations, demonstrating the value of VRAM capacity for larger models.
Key takeaway
For MLOps Engineers building or upgrading local LLM inference hardware, prioritize VRAM capacity over raw GPU speed, especially when targeting 35B+ models or long contexts. Your €1000 budget is best spent on maximizing VRAM to avoid CPU spill, even if smaller models see a minor speed dip. Carefully configure `llama.cpp`'s `--tensor-split` and `--n-cpu-moe`, or Ollama's `num_gpu 99`, to optimize model placement and achieve full speed at 128K context.
Key insights
VRAM capacity, not raw speed, is key for large LLMs; active parameters determine decode throughput, often outperforming larger dense models.
Principles
- Active parameters, not total size, dictate LLM decode speed.
- VRAM capacity is paramount for long context and avoiding CPU spill.
- Memory bandwidth can limit decode speed, even with more VRAM.
Method
The article details how to configure `llama-server` with `--tensor-split`, `--n-cpu-moe`, and `--flash-attn on` for optimal multi-GPU LLM placement and performance, especially for MoE models. It also covers Ollama tuning.
In practice
- Select MoE models for better decode throughput on constrained VRAM.
- Configure `llama.cpp`'s `--n-cpu-moe` for spilling MoE models.
- Force Ollama layers onto GPU with `num_gpu 99` for models that fit.
Topics
- LLM Inference
- GPU Benchmarking
- VRAM Optimization
- Mixture-of-Experts
- llama.cpp
- Long Context LLMs
Code references
Best for: Machine Learning Engineer, AI Engineer, MLOps Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by AI Advances - Medium.