Brief IA
›

Local LLM Lending: Key Memory, Metrics, and Adjustments

Research·Tom Levy·

Local LLM Lending: Key Memory, Metrics, and Adjustments

Local LLM Lending: Key Memory, Metrics, and Adjustments
Key Takeaways
1The performance of a local LLM depends on the latency before the first token and the generation throughput.
2Ollama and llama-server allow for separate measurement of prefill and decode to target the cause of slowdowns.
3A slow decode is often related to bandwidth or memory, and GPU-CPU distribution should be avoided.
Why it matters : Precisely identifying the source of the slowdown allows for the right adjustments to be made or hardware to be adapted, avoiding unnecessary optimizations.

Not all slowdowns are equal on a locally installed LLM. Between the wait for the first token and the generation speed, the causes differ and require different remedies. Tools like Ollama and llama-server help to separate prefill and decode, while certain configurations—especially a model split between GPU and CPU—impose limits that simple adjustments cannot overcome.

Generation speed primarily depends on memory and has its limits

When token generation is slow, the cause is most often related to bandwidth or memory, rather than pure computation. It is possible to estimate a performance ceiling based on memory bandwidth and model size, and then deduce whether to switch to a smaller model or to faster memory or bus. Some techniques, such as speculative decoding and MTP, aim to circumvent these limits, but they are only useful under specific loads. They can also backfire by slowing down or consuming more VRAM or context.

Le brief IA que lisent les pros

Le brief IA que les pros lisent chaque soir

Les 7 actus IA du jour, décryptées en 5 min. Gratuit.

Inclus dès l'inscription : notre sélection des meilleurs guides & comparatifs IA.

Choisissez votre rythme

Gratuit · Pas de spam · Désabonnement en 1 clic

Measure prefill and decode separately with Ollama or llama-server

Two key indicators are essential for understanding performance: prefill, which corresponds to the evaluation of the prompt, and decode, which is the generation of tokens. The detailed outputs from Ollama display these metrics, allowing for the identification of the problematic part. The times reported by llama-server also provide these measurements, facilitating the diagnosis between latency at the first token and generation throughput.

Avoid GPU–CPU distribution and apply the right settings

An initial checkpoint is to ensure that the model is not split between GPU and CPU, as such a configuration forces both to block for each token and cannot be corrected by other adjustments. On the parameter side, comparing cache_n to prompt_n helps confirm that caching is effective. Adjusting batch sizes, including via -ub and -ubatch, can improve prefill when appropriate. Distinguishing from the outset between the wait for the first word and the generation speed helps avoid looking for a solution in the wrong place.

Brief IA — L'actualité IA en français

L'essentiel de l'actualité de l'intelligence artificielle, décrypté et expliqué chaque jour.