Back to Freedom.Tech Back
All llama.cpp releasesAll versions
Release Fri, Sep 4, 2026 7 min read

llama.cpp 0.4.0

Original release notes

Overview

llama.cpp 0.4.0 adds initial Qwen3.8-Flash-Next and Nemotron-3-Puzzle support, on-demand tensor reading, per-slot server context limits, video input options, and a ggml update to 0.23.0 with major sparse flash attention and RDMA work.

API changes

  • Added llama_lazy_mode and lazy_mode (#27794).
  • Added max_buf_size to quantize params (#27795).
  • Bumped session/state versions for KV-cell token tracking (#27762).
  • Added mtmd_input_part and mtmd_tokenize_from_parts() (#28250).
  • Made mtmd_tokenize const-correct (#28310).
  • Made mtmd_bitmap_init_lazy const-correct (#28307).
  • Added mtmd helper video/init options (#24318).
  • Server multimodal helpers accept mtmd_helper_init_opt (#24318).

New models

  • Added initial Qwen3.8-Flash-Next (qwen4exp) architecture support; optimization improvements are still pending (#27742).
  • Added NVIDIA Nemotron-3-Puzzle-75B-A9B support (#25444).
  • Added DSpark support for Nemotron 3.5 (#27804).
  • Added support for nanbeige4.2-3B (#27730).

Core changes

  • Added lazy tensor reading (#27794).
  • Renamed option to --lazy-mode (#27969).
  • Added --n-cpu-ffn (#26622).
  • Added per-layer expert routing/FFN (#28323).
  • Added KV-cell token tracking (#27762).
  • Added n-gram history lookup (#28040).
  • Optimized KV cache restore (#27991).
  • Stopped early sequence scans (#28011).
  • Added quantizer RAM cap (#27795).
  • Added quantizer row-slab streaming (#27830).
  • Prevented RAM peaking during load (#27483).
  • Autoscaled YaRN training context (#28030).
  • Disabled non-fused GDN/LID (#27877).
  • Simplified MiniMax-01 graph (#27790).
  • Added DFlash2 support (#27816).
  • Fused DFlash encoder into KV injection (#27310).
  • Added sparse flash attention for DeepSeek-V4/GLM and Qwen4exp (#27970).
  • Added Apple RDMA as an RPC transport (#26421).
  • Added RPC event/async backend APIs (#18626).
  • Fixed Qwen4exp graph issues (#27941).
  • Added Qwen4exp recurrent rollback (#28123).
  • Summed Qwen4exp indexer heads (#28023).
  • Reduced Qwen4exp graph splits (#27880).
  • Fixed DeepSeek-V4 input vision (#28154).
  • Fixed Gemma-4 vision handling (#28335).
  • Fixed Gemma-4 assistant (#28183).
  • Added synthetic spec acceptance options (#27711).
  • Made build info stream configurable (#28322).
  • Fixed JSON-schema empty object grammar (#28279).

Multi-modality changes

  • Added mtmd_tokenize_from_parts() (#28250).
  • Added DeepSeek-V4-Flash-Vision-Exp (#28133).
  • Added DeepSeek-V4 input vision handling (#28154).
  • Fixed Gemma-4 vision handling (#28335).
  • Fixed Idefics3 preprocessing (#28273).
  • Fixed Qwen3-TTS (#28231).
  • Added video parameters/--video-* (#24318).
  • Made image preprocessors const-correct (#28310).
  • Made audio preprocessors const-correct (#28307).

Server changes

  • Added per-slot context limit (#24124).
  • Accept data: URLs for media (#27735).
  • Enabled preserve_reasoning by default (#28174).
  • Reject prefilled assistant tool calls (#27626).
  • Added synthetic spec acceptance options (#27711).
  • Added pytest-xdist server tests (#28298).

UI changes

  • Improved Chat Form Actions UI/UX (#27746).
  • Replaced MCP overrides with tool policy (#27745).
  • Moved Settings/MCP routes to dialogs (#27744).
  • Updated dialog styling (#27743).
  • Copy grouped agentic response text (#27832).
  • Updated ESLint config (#27700).
  • Updated package scripts (#28270).

ggml changes

  • Bumped ggml from v0.22.0 to v0.23.0 (release).

Version 0.23.0 adds new operators and backend scheduling APIs for sparse attention, asynchronous execution, and allocation-dependency tracking. The most notable additions are sparse flash attention (ggml_flash_attn_ext_set_n_kv_max), RPC event/async APIs, and Apple RDMA transport support. It also includes broad correctness and performance work across CPU, GPU, and accelerator backends.

Nightly build: b10809

More info

Changelog since v0.3.0

5266f24da llama.cpp : bump version to 0.4.0 (#28386) 64a155d24 sync : ggml (#28379) 163a40796 model, mtmd: fix gemma4 vision handling (#28335) 8f83678fd metal : add remaining fa-vec tunings for M3 Max (#28373) 86b351fd6 ggml : replace compile definitions with version.h.in (#28364) d509cb1e8 Don't use npx inside a package.json script (#28270) 4cbe8b070 ggml : don't crash when backend search path can't be read (#28271) 24f5bf8a4 ggml : remove GGML_CUDA_PEER_MAX_BATCH_SIZE (#28177) a529af96e docs : update maintainer PRs link and regenerate AUTHORS (#28365) 38521ec33 vendor: update BoringSSL to 0.20260903.0 (#28354) 0ef4d560e ci : disable failing openvino tests (#28347) c390d0abb common : make build info output stream configurable (#28322) 832fd6f17 ggml-cpu(s390x) : fix q5_1 uninitialized v_acc (#28332) 9a4843cf2 src : add n_expert_used_max function (#28323) 6703d7894 sycl: fuse rms_norm+mul+add and add+add residual chains (#27610) f9f09f02c SYCL: Refactor GGML_SYCL_ENABLE_MKL_FA to global var (#26863) d230ddd76 llama: fix whole source code rebuilt on each new commit (#28278) c5a5535e6 common/json-schema : fix GBNF grammar generation for empty object schemas (#28279) 95ef7fc16 opencl: quant lm_head / decode GEMV and medium-batch GEMM optimizations (speculative decoding/MTP) (#26477) 8c1a25166 tune MMVQ to MMQ crossover for SM87 (#28285) d30500b83 snapdragon: ci updates to use new run script (#28293) e107984bc ops: add Hexagon to ops.md and update main README.md (#28263) 42f0225fe server : use pytest-xdist for server tests (#28298) de8656bd9 mtmd: propagate const to preproc class (#28310) 7bb0fc18f metal : add sparse FA (#28098) 0df017d6d metal : fix glu dispatch with ne00 = 1 (#28306) f45576aa8 mtmd : add const in various places (#28307) 0ba6499c3 CUDA: Allow concurrent streams per split for multi-GPU (#28198) c7bda030e vulkan: fix FA dequant path engagement (#28190) 0df974d77 sycl : enhance the api to support peer-to-peer copy (#27550) d646c9d15 convert : skip bias_vl tensor in DeepSeek-V4 DSpark conversion (#28294) 5ec4eab69 misc : prevent RAM peaking at model loading stage (#27483) 4aa6ffba2 sycl: reduce redundant work in Q4_K multi-column MMVQ (#27062) c61b98b87 model: add NVIDIA Nemotron-3-Puzzle-75B-A9B (NemotronHPuzzle) support (#25444) 67a17c17c mtmd: fix idefics3 preproc (#28273) 159b74142 finetune: fix no KV cache (#27199) 9cffdcc80 server : accept data: URLs for input_video and input_audio (#27735) f027c4f1b ggml-hexagon: add F16 support for unary ops (#28228) 733905474 mtmd: add mtmd_tokenize_from_parts() (#28250) 9cc33944f metal : add fa-vec tunings for M3 (#28236) 8c0b9cd04 metal : fix memory query under low-memory conditions (#27701) 03dbcc53e ci : check for missing autoreleasepools (#27884) cff184438 Update ROCm to 10.0.0 release (#27803) 9400c8946 model: correctly support input vision for deepseek4 (#28154) d5fec32a8 ci : enable hf-jobs on server-cuda (#28258) 3d3d7c818 ggml-cuda : remove unused vars (#28235) e750b887a common, server : enable preserve_reasoning kwarg by default, log its effective state (#28174) 7798007a2 mtmd: support DeepSeek-V4-Flash-Vision-Exp (#28133) 8e93a9773 CUDA + ggml: add sparse-fa for DSV4/GLM (#27970) 0f3a71be1 mtmd: Fix Qwen3-tts-0.6b (#28231) b81c99b47 ggml: avoid KleidiAI buffer type init on dispatch (#27891) 960dffab0 hexagon: MUL_MAT and MUL_MAT_ID fusion and fixes (#28202) ba8818cbf vulkan: handle larger batch sizes (>4) efficiently for IQ3_S mat-vec (#27449) 56dd8150c vulkan : only request VK_KHR_shader_bfloat16 extension if supported (#28155) 2637dfe37 ggml-cpu : conditionally add SpacemiT IME kernel sources (#27961) 43d87ff2d opencl: fix outofbound reads in the Adreno image kernels (#27632) 69320fef1 hexagon: add missing FARF logs for cpy/get_rows/set_rows/gdn ops (#28217) b96806d96 metal : add metallib build support for xcframework (#28163) 3466812d1 cuda: fuse MoE weighted expert reduction (#25952) b356fa262 kv-cells: look up the n-gram history in the sequence position index (#28040) dfc29b64e context : autoscale n_ctx_train when yarn scaling specified (#28030) f28493c78 models : appropriately flag noscan ssm_a tensors (#28121) 73159c303 model : fix gemma4-assistant (#28183) d11b3cc7e model : load relevant arrays with n_layer_all (#28173) c845263f8 Revert "sycl : add Kronecker product FWHT support for sizes 384, 640, 768, 12..." (#28184) 1f3d31873 sycl : add Kronecker product FWHT support for sizes 384, 640, 768, 1280 (#28016) 8887a48f0 metal : add fa-vec tuning for M2 Pro (#28122) be789c344 metal : add fa-vec tunings for A18 Pro (MacBook Neo) (#28152) 9d817213a model : load hparams.n_layer_nextn before n_layer() calls (#28159) fe2120bc9 metal : fix more leaks due to missing autoreleasepools (#27883) d08c7872d metal : add fa-vec tuning for M2 Max (#28015) 5eec3ad01 sycl : support limit max alloc memory within 2GB for host-pinned memory (#27559) 36b101543 qwen4exp: fix seq_cp, block position keying, mtmd input, cuda abort, add tests (#27941) d086dbb34 tests : fix log verbosity for test-llama-archs (#28147) 1b89a43e3 quantize: row-slab stream to avoid thread starvation (#27830) d5d993a09 metal: enable Metal 4.0 tensor API on M5+/A19+ (#27461) 234a6ebaa ci: Bump ggml-org/ccache-action to v1.2.24 (#28083) 518b76236 kleidiai : Update KleidiAI Documentation (#26078) 0eadefebd qwen4exp: support recurrent state rollback (#28123) 09412af38 qwen4exp: sum the indexer heads by slices (#28023) 458681e1d metal : add fa-vec tunings for M1 Ultra (#28088) e4b9af007 CUDA: XOR swizzle flash attn K,V smem fp16 tiles (#25635) ab0b3bd3c metal : add concat support for quantized types (#28116) 85c55223c AVX2: Speed up large batch size prompt processing of IQ models (#27402) 2a74817f9 metal : add top-k radix implementation (#28073) 2d8d612e4 kv-cache : optimize restoring non-contiguous cells (#27991) 010be9683 opencl: tune the quant paths for Intel Xe-LP GPUs to improve its TG and PP performance (#26438) 774ee0e20 ui: copy the displayed text of grouped agentic responses (#27832) 8e53fcefd webgpu : avoid crash when offset is not multiple of 4 in WebGPU ggml_backend_tensor_get() implementation (#28045) f8dbcd618 ROCm: add radix TOP_K for long rows (#27466) 5d4a3be26 metal : add fa-vec tunings for M1 (#28078) 41ef91f7c CUDA: extend MOE fusion to specdec, earlier MOE glu fusion and topk-router fusion were restricted to 1 token (#27621) a32af33de sycl : Enhance to get the free memory of Intel GPU (#27968) 580e88d8b ci : add check for unzip (#28082) 662a0b012 spec : fuse the DFlash encoder into the KV cache injection (#27310) 2cdae802e vulkan: tune mat-vec rows for batched inference on Strix Halo (#27909)