a1eb757ea5078f098d0376db06186f3ad9581b0d
The --concat and --moe-exact checks were removed on 2026-11-23 with the features they checked (F3 one-tile concat gate and its GGML_VK_CONCAT_FASTPATH knob, F1 routing-ids readback skip and its LLAMA_MOE_IDS_SKIP knob): no fork code is left for them to test. Default checks are now --ops --arbiter. gpu_exclusive (the exclusive-GPU guard of --perf) and the prose prompt of --diskcache (now prose_prompt) were defined in the removed --moe-exact section; they are kept here. Without them --perf was silently skipped and --diskcache failed on an empty first turn (window of 2026-11-23). The RX 580 benchmark harness (scripts/rx580-bench, last run 2026-09-09) was removed on 2026-11-23 by owner decision; its methodology is in docs/fork-rebase-runbook.md section 11 and its code stays on the older branches. Its original commit messages are kept below. fork-validate.sh keeps an inherited GGML_VK_ASYNC_USE_TRANSFER_QUEUE (production's driver setting) instead of unsetting it. Squashed from 11 fork commits (original subjects and messages below). ---- scripts: add the RX 580 benchmark harness (wase51074d08) Encodes the production config, fixed corpus slices, repeat/median discipline and the noise floor, so the measurement method does not have to be rediscovered each time. Runs the corpus prefill test through llama-server and the llama-bench sweep as a controlled cross-check, with interleaved A/B. ---- scripts: rx580-bench - use -lm none, document the MoE cache option (wasea144c8a9) Upstream #28334 removed --mmap/--no-mmap/--mlock and llama-bench's -mmp, so the harness flags no longer parse: the server would refuse to start and llama-bench would silently produce no rows. Switch both harnesses to -lm none, the same load mode, and note --moe-cache-mib as a server-only option worth measuring. ---- scripts: add fork-validate.sh, post-rebase validation of the fork (was1e997ec43) Checks the op kernels, the concat fast path, the VRAM arbiter incl. every shutdown path that has caused a production incident, and prefill/decode against a reference build. Prints PASS/FAIL per check. ---- scripts: rx580-bench - decode at tg256 depth 4096, not tg32 (wasda621da4f) The llama-bench sweep measured decode as tg32 at the default depth and the README called it the continuity metric, while tg32 at n_ctx 32 is launch / barrier bound on this card and is not a valid decode metric (it once read -36% between builds at parity at tg256). lbsweep.sh now runs prefill (-p $LB_P -n 0, depth 0) and decode (-p 0 -n 256 -d 4096, LB_N / LB_D) as two invocations and labels depth cells (tg256@d4096). summarize.py marks old depth-less tg rows as invalid-metric history. The README examples and the reference values are updated to the 2026-10-24 production numbers. ---- scripts: fork-validate.sh - gate --perf on medians, not means (was2c38d72eb) --perf averaged the two per-arm llama-bench means of each build, so one catastrophic sample (CPU contention from the ~60 other pods on the node) moved the result, against the fork's own rule of medians, never means. llama-bench now writes -o jsonl (every repetition sample) next to the markdown table, and the gates use the median of all samples of a build pooled over its two arms (4 per prefill cell, 6 for decode); the table shows min-max and n. --perf-report TSV re-aggregates a saved <scratch>/perf.tsv without a GPU. Checked offline on the pod: the 2026-09 A/B samples in results.txt give pp2048 reference 250.24 (old mean) vs 247.76 (new median), candidate 280.15 vs 276.93; a synthetic 2026-10-24-like set with one 180 t/s candidate sample read -9.3% (FAIL) the old way and -0.2% (PASS) with medians. ---- scripts: fork-validate.sh - A/B ordinary handoff latency against --ref (was060146e12) --arbiter only reported the candidate's handoff latency, while the fork's process rule (two production deploys lost) is to A/B the ordinary handoff, not only the pathological cases. After the arbiter cases, a-handoff-latency starts fresh A/B server pairs of each build on the scratch arena and runs blocks ref, cand, cand, ref of 16 alternating handoffs each. It FAILs if the candidate median exceeds the reference median by more than max(25%, 200 ms) and reports both medians, maxima and per-block medians. ---- scripts: fork-validate.sh - check that a cold server gives its VRAM back (was743bea264) Nothing checked that a release actually frees VRAM. --arbiter now takes a baseline of mem_info_vram_used before any scratch server starts, then with A warm and alone on the scratch arena makes it release through a fake waiter on want.lock. v-vram-release requires the card-wide delta to drop by at least 70% of what A added warm; v-vram-restore requires it back (and the output equal to the reference) after the next request. Production's own share is re-read at every point from the DRM fdinfo of every process the script did not start (deduplicated by drm-client-id); if it moved by more than 64 MiB the check SKIPs instead of blaming the candidate. Run beside production on the pod (reb1024 vs itself): warm +546 MiB, cold +4 MiB, restored +546 MiB, production steady at 5053 MiB; 16 PASS. ---- scripts: fork-validate.sh - --moe-exact, greedy identity for the readback skip (was384a7a1be) F1 (the routing-ids readback skip in sched_copy_experts) had no automated check. --moe-exact MODEL reads expert_count / expert_used_count from the GGUF header, computes the skip threshold ceil(4 * n_expert / n_expert_used) tokens per ubatch (128 on the 35B), and runs one greedy request with a prompt of about 2x that in a single ubatch, every expert on the host, so the prefill takes the skip and each decode step takes the readback. The candidate's 64 tokens must equal the reference's byte for byte; with the LLAMA_MOE_IDS_SKIP knob in the candidate, also the candidate with the skip forced off (=0), which proves the skip exact even when the reference carries it, and =log must show skips, all at >= 4 * n_expert ids. Without the knob skip-engaged SKIPs with the batch-size argument. It needs the GPU to itself (same guard as --perf, now shared as gpu_exclusive); FV_TEST_SHARED_GPU=1 bypasses the guard for script tests against stub binaries only. Also unset inherited LLAMA_MOE* variables. Not run on the GPU yet (needs a swapdown window). Dry-run on the pod against stub servers and the real 35B GGUF header: threshold 128, all-PASS when outputs match, FAIL on a differing reference, SKIP without the knob, FAIL for a dense model and while llama-swap runs. ---- scripts: fork-validate.sh --diskcache, the disk prompt cache (wasfe6c0f70a) Runs beside production. The model is the small hybrid (Qwen3.5-0.8B), CPU only (-dev none -ngl 0, no VRAM), with chat requests and greedy decoding. A reference server that never restarts runs turn 1 and turn 2. The candidate saves turn 1 on SIGTERM and restarts. Turn 2 must then be restored from disk with the same prompt_n as the reference (only the suffix processed) and the same answer. Cases: - restore plain, with the arbiter env warm, and forced cold by a fake waiter on want.lock (the save from a released state). Each case records the exit time and SIGTERM-to-token-free, also once without the cache; - no restore for another conversation, or with another n_ctx, KV type or model path (other key); - a truncated file is removed at startup and a byte-flipped one at load, never used; - the size limit evicts the oldest file; - a write error (RLIMIT_FSIZE 1 MiB, SIGXFSZ ignored: EFBIG) is logged, the exit stays 0 with no file left, and the next start serves; - the same restore on the GPU (-ngl 99, arbiter env, warm and cold) when >= 1.5 GiB of VRAM is free, else SKIP. start_server gains SRV_WRAP, a command prefix that execs the server. First run (2026-10-25, beside production): 11 PASS, 0 FAIL; the GPU leg SKIPped (1219 MiB free). The first run found the CPU_REPACK release crash (exit 139 in the cold case). ---- scripts: fork-validate.sh --diskcache - the mmproj cases (wasb3b7ad797) Production runs the 35B and gemma with an mmproj, and the first deploy of the disk prompt cache aborted on that path. Every case had used --no-mmproj. Now --no-mmproj is in DC_MM, separate from DC_ARGS, and two cases run with the 0.8B's mmproj (--no-mmproj-offload, arbiter env, LLAMA_MMPROJ_ONDEMAND=1), against their own reference: - restore-mmproj: turn 1 is saved on SIGTERM and restored after the restart, prompt_n equal to the reference, output identical; - mmproj-image: an image request (no restore, answer "red"), then the text chat (restored, identical), then an image again, then SIGTERM with media in the slot (no state copied, exit 0, the file count unchanged). ---- scripts: fork-validate.sh - scratch arenas on /dev/shm, lock_id failed on overlayfs (was70d39bdbc) Since 2026-11-22 the pod's root filesystem persists and /tmp is on overlayfs. There stat reports the overlay device (st_dev 0xb3) while /proc/locks prints the device of the upper filesystem (00:84), so lock_id never matched the scratch token.lock and arbiter/start failed with "A serves but does not hold token.lock" although A held the lock. Production's arena is on tmpfs (/dev/shm/llama-vram), where both agree. Put the scratch arenas there too (/dev/shm/fork-validate.<suffix of the scratch dir>, removed by finish()); logs and the rest of the scratch stay in /tmp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PZz44SLQvTXMyWGio6t9DZ
tool-call: fix Qwen 2.5 Coder support, add micro benchmarks, support trigger patterns for lazy grammars (#12034)
llama.cpp
LLM inference in C/C++
v1.0.0 / ggml / ops / maintainer PRs / dev stats / lib llama API / llama-server REST API
Description
The main goal of llama.cpp is to enable LLM (and MLLM) inference with minimal setup and state-of-the-art performance on a wide range of hardware - locally and in the cloud.
The llama.cpp project is built on top of the ggml library.
Quick start
A few options to get llama.cpp installed on your machine:
# curl
curl -LsSf https://llama.app/install.sh | sh
# powershell
irm https://llama.app/install.ps1 | iex
- Visit https://llama.app and follow the instructions
- Run with Docker - see our Docker documentation
- Download pre-built binaries from the releases page
- Build from source by cloning this repository - check out our build guide
Once installed:
# Download and run a model directly from Hugging Face
llama cli -hf ggml-org/Qwen3.5-0.8B-GGUF
# Launch OpenAI-compatible API server
llama serve -hf ggml-org/Qwen3.5-0.8B-GGUF
|
|
|
Documentation
Tools
Development
- How to build
- Running on Docker
- Build on Android
- Multi-GPU usage
- Performance troubleshooting
- GGML tips & tricks
- XCFramework
- Completions
- Models
- Release process
Contributing
- Contributors can open PRs
- Collaborators will be invited based on contributions
- Maintainers can push to branches in the
llama.cpprepo and merge PRs into themasterbranch - Any help with managing issues, PRs and projects is very appreciated!
- Read the CONTRIBUTING.md for more information
Acknowledgements
- yhirose/cpp-httplib - Single-header HTTP server, used by
llama-server- MIT license - nothings/stb - Single-header image format decoder, used by multimodal subsystem - Public domain
- nlohmann/json - Single-header JSON library, used by various tools/examples - MIT License
- mackron/miniaudio - Single-header audio format decoder, used by multimodal subsystem - Public domain
- sheredom/subprocess.h - Single-header process launching solution for C and C++ - Public domain
Languages
C++
54.9%
C
16.7%
Python
7%
Cuda
5.6%
TypeScript
3.9%
Other
11.7%