All posts

    Essay

    Tuning a 35B mixture-of-experts model on an 8 GB laptop GPU

    Taking a 35B MoE model on an 8 GB RTX 4060 laptop from 16-19.5 to 29.6 tokens a second, and why fixing measurement noise came before any tuning flag.

    2 min read
    I took a 35-billion-parameter model running on a laptop with an 8 GB RTX 4060 from 16 to 19.5 tokens a second to 29.6, and cut time to first token from 500 to 297 ms. Before any tuning flag helped, I had to fix the measurement itself. The model is a mixture of experts that uses 8 of its 256 experts per token, so with most of it in system RAM it reads about 0.45 GB from RAM per token, against roughly 9 GB for a dense 27B model split the same way. I tuned it with Sybil Solutions' open-source inference-optimisation skill (https://github.com/sybil-solutions/inference-optimisation-skill), which makes you compute the hardware's ceiling first (about 65 tokens a second here), change one thing at a time, run a control on each side of every change, and check long-context retrieval on every run. I ported its tooling to Windows and wrote a PowerShell runner that does a whole round unattended, since nothing else could be open while it ran. At first, three identical baseline runs drifted 18%. Free RAM was under 600 MB and the model's experts were being paged in from disk, and with every app closed, 13 GB of 32 was still in use, 4 GB of it by a Hyper-V VM that Task Manager shows at 0 MB. Saving the VM and rebooting took run-to-run noise from 15.4% to 2.9%, and only then did comparisons mean anything. Loading the model into process memory instead of memory-mapping it then raised prompt processing 52 to 60%, and cutting generation threads from 20 to 8 raised decode 9 to 12%. With fewer CPU cores spinning, the GPU's clock went from about 1,550 to 2,430 MHz, which I read as the two sharing one laptop power budget. Speculative decoding with the model's own draft head was about 13% faster on code, 20% slower on prose and 54% faster on retrieval, and it cost a third of prompt speed, so I left it off; a single average would have hidden that split. Any team serving its own models should benchmark this way, with the ceiling first, controls on both sides and a quality check on every run, because on this laptop the starting noise was bigger than most of the gains.
    Local LLMsLLM inferenceAI engineeringBenchmarking