Offloaded MoE experts decode up to 2.2× faster.

2 days ago

The top highlight of llama.cpp v0.7.0 is a cache for mixture of experts models. If you offload a model's experts to host memory, decode gets up to 2.2 times faster. The cache is set with one flag, --moe-cache-mib. And one change to check before you upgrade: the server's default port is now 9931.

Ask about this presentation

Chapters

  1. 0:00Up to 2.2× faster MoE decode
  2. 0:23How the expert cache works
  3. 0:42Speculative decoding
  4. 1:03New models
  5. 1:31Models Manager
  6. 1:48Fixes you may have hit
  7. 2:10Breaking: port 9931
  8. 2:30API changes
  9. 2:52Upgrade
Show transcript
  1. The top highlight of llama.cpp v0.7.0 is a cache for mixture of experts models. If you offload a model's experts to host memory, decode gets up to 2.2 times faster. The cache is set with one flag, --moe-cache-mib. And one change to check before you upgrade: the server's default port is now 9931.

    Slide text
    llama.cpp
    v0.7.0

    Offloaded MoE experts decode up to 2.2× faster.

    A new GPU cache serves the experts you keep in host memory.

    llama.cpp v0.7.0
    $… --moe-cache-mib <MiB>
  2. The experts stay in host memory. Now a least recently used cache on the GPU holds the experts in use, and they run there. You size the cache in mebibytes with the flag. The cache is shared across multiple GPUs, and library users get the same setting as moe_cache_size in llama.h.

    Slide text
    llama.cpp
    #29887 · #30112

    Experts stay in RAM; the ones in use run from a GPU cache.

    Host memory
    Every expert's weights
    →
    GPU LRU cache
    --moe-cache-mib
    →
    GPU compute
    Experts run on the GPU
    Shared across multiple GPUs
    llama.h moe_cache_size
  3. Speculative decoding gets two new paths. LiliCorr uses a small draft transformer to pick candidates, built on top of DFlash. GLM5-Next gets multi-token prediction, with an optimized sparse attention path. And a new flag, --spec-draft-n-ubatch, sizes the draft model's batch separately, so the draft takes less VRAM.

    Slide text
    llama.cpp
    speculative decoding

    Speculative decoding adds LiliCorr and MTP for GLM5‑Next.

    LiliCorr

    A small draft transformer picks candidates on top of DFlash.

    GLM5‑Next MTP

    Multi-token prediction with an optimized sparse attention path.

    Draft batch size
    --spec-draft-n-ubatch

    Sizes the draft batch on its own to save VRAM.

  4. K2 Horizon arrives in dense and MoVA variants, with tensor splitting. Prism Bonsai 2 27B is a ternary model, and EmbeddingGemma-2 embeds text, images and audio. MiniCPM-V 4.7, Nemotron Super 3.5 VL and Nemotron Bolt join them. And five decision models are served on the /v1/systemone endpoint: two from LiquidAI, vLLM decision 2 and d3, and pplx-decider.

    Slide text
    llama.cpp
    new architectures

    K2 Horizon, Prism Bonsai 2 27B and EmbeddingGemma‑2 now run.

    K2 Horizon dense and MoVA · -sm tensor
    Prism Bonsai 2 27B ternary
    EmbeddingGemma-2 text + vision + audio
    MiniCPM-V 4.7 multimodal
    Nemotron Super 3.5 VL · Bolt 74B A9B
    decision models · /v1/systemone
    LiquidAI d1-3B
    d1-omni-600M
    vLLM decision 2
    vLLM d3
    pplx-decider
  5. If you use the built-in web UI, there's a new Models Manager. It's one table of every served model, with search, filters, sorting and favorites. From a row you can load a model, delete it, or resume a download. A side drawer shows its info and chat template.

    Slide text
    llama.cpp
    web UI · #29583

    The web UI gets a Models Manager.

    One table of every served model.

    Find Search, filters, sorting, favorites, expandable quants
    Act Load or unload, delete from disk, hide, resumable downloads
    Configure Side drawer with model info and chat template
  6. If you serve embeddings, with pooling on the logits buffer and the LM head are skipped, for up to ten times less VRAM. The prompt cache now saves only states it can restore, so rerank and embedding requests stop filling it. And slot save and restore keeps context checkpoints and the draft state, while an off-by-two fix stops restored states being thrown away.

    Slide text
    llama.cpp
    server · embeddings

    Pooled embeddings use up to 10× less VRAM.

    embeddings
    No LM head With pooling on, the logits buffer and LM head are skipped.
    prompt cache
    Restorable only Rerank and embedding requests stop filling the cache.
    slot restore
    States survive Checkpoints and draft state are saved; an off-by-two SWA bug no longer discards them.
  7. The server now listens on port 9931 instead of 8080, so any client pointed at localhost 8080 stops connecting after you upgrade. The fix is one flag: pass --port 8080, or point your clients at 9931. Docker images keep 8080 inside the container.

    Slide text
    llama.cpp
    breaking · #30159

    llama-server now listens on port 9931 by default.

    before
    http://localhost:8080/v1
    v0.7.0
    http://localhost:9931/v1
    to keep the old port
    $llama-server … --port 8080
    The Llama app menu showing localhost:9931

    Docker images keep 8080 inside the container.

  8. This one is for code built on llama.cpp. If you build on the server's chat code, it is now organised around common_chat_session, with feed and finish. Formatted chat output is an array of parts instead of one string. And ggml 0.27 hides symbols by default and moves RPC to protocol version 8.

    Slide text
    llama.cpp
    include/llama.h · tools/server

    Code built on the server's chat layer or on ggml needs a look.

    common_chat_session Chat layer rebuilt around feed() and finish()
    formatted output An array of parts instead of a single string
    ggml v0.27.0 Symbols hidden by default · RPC protocol v8
  9. If your own code builds on the server's chat layer, port it to common_chat_session when you upgrade. Offloaded experts decode up to 2.2 times faster, and the one thing to check first is the port. The release is tagged v0.7.0, matching nightly build b11669.

    Slide text
    llama.cpp
    v0.7.0 · nightly b11669 · ggml v0.27.0

    Upgrade for the expert cache. Check your port first.

    If your code builds on the server's chat layer, port it to common_chat_session.

    github.com/ggml-org/llama.cpp/releases/tag/v0.7.0

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built in New York with ❤️