Hacker News new | ask | show | jobs
by coder543 9 days ago
Consumer hardware doesn't really boil down to a single constraint on how much memory is available, in my opinion.

Consumer hardware has limited memory, limited memory bandwidth, limited compute, and limited storage. Any model designed for consumer hardware needs to tackle all four, while still optimizing for intelligence.

MoEs save on both memory bandwidth and compute compared to a same-size dense model, and importantly, MoEs can still run quickly even with partial offloading. People have even demonstrated getting pretty good performance out of MoEs streaming from SSD with careful optimization.[0] Dense models fall apart if they aren't run entirely in the fastest memory pool.

Memory bandwidth is scarce on consumer laptops and smartphones. Looping demands even more memory bandwidth than running the same parameters once, so it is not an obvious win. If looping can make the model significantly more intelligent, it might be worthwhile. It is interesting to see a MoE combined with looping, as with Inkling 2 Mini. On your point about memory being the constraint, looping increases the size of Inkling 2 Mini's KV cache because the looped layers don't share KV between loops.

With DSpark-style specdec getting better and better, dense models make more sense than they used to since you can amortize the memory bandwidth better. The problem is then prefill (prompt processing), since specdec does nothing to help with that, and processing long inputs (search results, reading documents, etc) will still feel very slow. A MoE can breeze through that same prefill since it doesn't need as much compute.

With the introduction of Engrams/PLEs, model designers now have another axis for adding knowledge to models at the cost of storage, with comparatively little additional compute or memory bandwidth.

There are tradeoffs on everything. Despite my own extensive testing of different models on different hardware setups, I have not found any one-size-fits-all model architecture for consumer hardware. It is a hard problem. Small models are getting better all the time, and I think even smartphone-sized models will pass the threshold of usable intelligence for most people in the next year. Spark-X2.6-4B[1] and LFM3-1.7B[2] are surprisingly good for their sizes. Inkling 2 Mini looks great, supposedly offering Qwen3.8-27B's intelligence with much less compute required.

[0]: https://huggingface.co/openbmb/MiniCPM-V-4.7-35B-A3B#on-devi...

[1]: https://huggingface.co/XHToken/Spark-X2.6-4B

[2]: https://huggingface.co/LiquidAI/LFM3-1.7B

1 comments

> A MoE can breeze through that same prefill since it doesn't need as much compute.

Important caveat: if not fully offloading[0] then the MoE model's prefill speed completely tanks, as prefill is heavily dependent FLOPS and parallelization and CPUs suck at that compared to GPUs.[1]

[0] 'Offload' is being used in the llamacpp sense of using the GPU instead of CPU

[1] Generally, prefill is bottlenecked by compute while generation is bottlenecked by memory bandwidth

Fortunately, that's not really how it works anymore.

When you're prefilling, you can afford to amortize the cost of sending the experts to a scratch space on the GPU then running a bunch of tokens through that set of experts, then repeating with the next set of experts, and so on. There's no reason to compute those on the CPU, and llama.cpp already does move prefill to the GPU by default for partially-offloaded MoEs.

Where performance would still tank is if you don't ensure the microbatch (ubatch) is large enough to amortize that cost, and if you're prefilling only a small input, it's not going to reach full speed. For a large input, you can think of each expert as visiting the GPU once for every ubatch of input tokens. A larger ubatch means fewer transfers.

Try increasing `-ub` (2048 is a sane default, but 4096 or higher can sometimes be desirable), and watch the partially-offloaded MoE prefill performance magically go way up on llama.cpp for large inputs.

EDIT: Also, if you haven't tried replacing `--n-cpu-moe` with `--cpu-moe` + `--moe-cache-mib` (with all of your GPU memory that you can spare), it is even better than `--n-cpu-moe`, since real world models don't distribute work over the experts in a perfectly random way. The moe-cache speeds up decode/output tokens per second.

Thanks. Playing around with this got me around twice the prefill performance with Qwen-Flash-Next.