r/llamacpp • • 2h ago Bravo

LexiSuite ad31b74: my all-Rust local AI stack gets its own AI agent (LexiAgent, 81,000 lines), crypto that survives a broken RSA or "P=NP" (every signature doubled, a one-time-pad channel), and Qwen4-35B at 135 tok/s on one 7900 XTX, ahead of llama.cpp b13023 & New MedGemma2 support is now available

Thumbnail
github.com
2 Upvotes

I'm building a local AI platform from scratch in Rust: its own kernel (LexiKernel), OS (LexiOS), inference engine (LexiEngine) and control panel (LexiPanel), one USB image, no cloud. A new development image went out today, five days after the last post (996260c). 711 changes this time, and the biggest release so far: the code base grew by 394,000 lines to 2.51 million lines of Rust in 528 crates.

LexiAgent: an AI agent of my own, from the first line

55 crates, about 81,000 lines, 989 tests, no third-party crates. It works with the model you run yourself on LexiEngine (this machine, another one on your network, or through the Panel), not with a cloud model.

What it does:

- Carries a task from request to done: plans, keeps a task list, calls tools in order, stops on Ctrl-C together with every command it started. Helpers take sub-tasks inside limits they cannot escape.

- Reads a project: fast bounded search, and source navigation (symbols, definitions, references) without a language server. Project memory files and a digest of the project keep the context across a long session.

- Changes files safely: exact edits, new files and multi-file patches as one transaction, each undoable. It reads the patch formats models already write, the way GNU patch reads them.

- Runs commands in a real terminal with background jobs and a read-only fast lane, every command inside a sandbox.

- Git with fixed argument lists and no shell, qualified against a real repository (amend, forced reset, clean, branch delete). Off unless switched on.

- Web pages and files through my own HTTP client, from the origins you allow, treated as data.

- Model Context Protocol client for outside tool servers, every tool behind the same gate. Servers a project lists are imported for approval, never started unasked.

- Skills, slash commands, specialist definitions, hooks and plug-ins in the formats people already use, plug-ins installed into a private store pinned by digest.

Why I would let it near my own machine:

- One gate decides every call: mode (plan, ask, edit, auto), the person's rules, the person's answers. A project's settings can only narrow what you allow, never widen it. Approvals on the interactive screen are typed by a person, so the model cannot approve itself.

- On Linux every command runs under kernel-enforced confinement: it sees only what the session allows, reaches the network only through a proxy, and dies with the session. macOS has its own confinement.

- Secrets are found before a file is read and removed before the model sees them.

- A shield marks and contains whatever tools and tool servers bring back: text that tries to give orders stays data. A red-team corpus of attacks runs against the assembled session parts.

- Every decision and action goes into an append-only, chained record that can be verified afterwards.

- The Panel has a LexiAgent page: start a supervised session against a model instance you pick, answer its questions, stop it. The agent pairs with the Panel over the suite's own two-signature TLS.

- lexi-agent doctor tells you, check by check, what this build and this machine provide.

Built for the day the math breaks ("P=NP hardening")

Almost all security today rests on RSA and elliptic curves staying hard to break. If quantum computers or an AI-found shortcut toward P vs NP make them easy, everything signed with them opens. I rebuilt the suite so that no single broken assumption opens anything:

- My own Rust implementations of the new standards: ML-KEM (FIPS 203), ML-DSA (FIPS 204), SLH-DSA (FIPS 205), LMS/HSS (SP 800-208), SHA-3 and Shamir secret sharing, every parameter set checked against the official test files and an independent implementation.

- Every signature is doubled: a classical one plus one from another family (lattice, or hash-based that rests only on a hash function), and both must verify. Updates, the trust store, provenance, enrollment, image identity, licenses, evidence, release decisions, fleet actions, the Panel's certificates.

- Key exchange mixes unrelated methods: my own TLS 1.3 with the hybrid group and a pre-shared secret mixed in, one session key from several exchanges that share no math. LexiOS's SSH does the hybrid exchange first.

- LexiKernel's own boot chain now requires a hash-only signature (SLH-DSA-SHA2-256s) beside RSA on every owner-signed boot object. PC firmware itself can only check RSA on the very first loader; that one link is the firmware's.

- Vault keys are wrapped so one broken algorithm opens nothing; key backup is printed shares, 3 of 5.

- And for the owner's approvals, a one-time-pad channel made from a hardware randomness source: the one kind of encryption no computation breaks, P=NP included. The pad store was killed with SIGKILL at every step of reserve-then-use and never moved backwards.

- The release gate refuses any new use of RSA or a curve alone, so it cannot drift back.

Qwen4 on the card

- Qwen4-35B-A3B writes 99.5 tok/s after a short prompt against 92.5 on llama.cpp b13023, and 89.8 against 80.8 after 57,550 tokens of prompt.

- With the draft head built into the model file: 117.7 to 134.9 tok/s. The full model checks every drafted token, so the answer is the same token for token, only faster.

- It reads pictures on the card: on five test pictures the card wrote exactly the words of the processor path.

- Its own template, reasoning levels by the template's own names, required and named tool choices enforced (grammar on the processor, device allow-list on the card), thought kept apart from the answer on every API route.

- Attention cache in F16, Q8_0, Q6_0, Q4_1, Q4_0, rotated 4-bit or IQ4_NL, keys and values in different formats if you like.

- Found while measuring: the previous version fell from about 100 to 46 tok/s after some 30 requests (the engine reshuffled experts when the whole model was already on the card, and one evicted expert sent routing to the processor for good). Fixed: 70 requests in a row now all run at 102 to 104.

MedGemma 2 and Gemma 4

- Straight from the BF16 checkpoint to a quantized file in one pass with my own quantizer, the 26B-A4B mixture-of-experts layout on the card, picture input through the vision tower on the card, tool calls in Gemma 4's own format read as structured calls.

- MedGemma 2 E4B writes faster than llama.cpp up to about 14,000 tokens of prompt: 148.8 / 140.9 / 125.1 against 130.5 / 125.2 / 118.0 tok/s.

Pictures, video, voice and sound in the engine

- Image diffusion from a checkpoint (conditioner, DiT, VAE, scheduler on the chosen device), image editing from reference pictures, adapters merged per request, upscaling, Qwen-Image 2.1 on a Radeon card as a build option.

- Video generation (LTX stage family) into a real container, and video understanding in chat (H.264 decode and frame sampling into the prompt).

- Kokoro text to speech on my own graph library, Moonshine streaming recognition, speech from codebooks, live two-way voice sessions, sound input in chat.

- In the Panel: pictures made by LexiEngine, speech in and out, and a media model library.

Also new

- New model families on the processor: GPT-OSS, Mistral, Phi, and the diffusion text models LLaDA and diffusion Gemma. Experts read from an SSD through a signed manifest.

- My own quantizer as a Panel tool with recipes, a per-tensor table, progress and cancel. NVFP4, MXFP4 and FP8 products on Vulkan, exact NVFP4/MXFP4 import, 4-bit weights with 8-bit inputs on RDNA 3 integer dot products.

- The processor path computes exactly now (no 8-bit rounding of inputs), with fused AVX2 kernels that do it with less work.

- 21 template fixes, tokenizer fixes, Hermes-style tool calls read and written by the engine.

- LexiOS: a change authority with a TPM 2.0 anchor that cannot be rolled back, a control socket the engine reads to place itself on the right cores and memory, authenticated crash evidence.

- LexiKernel: a long list of new hardware support (NVMe recovery, xHCI, AHCI, USB4, TPM2, chipsets, Intel Macs, ARM boot, and detection of many accelerators).

- My own AMD code-object writer on my own RDNA 3 instruction encoder, and a KFD transport with a device-resident executor for my kernel IR.

- The Panel speaks 45 languages, every tab was read on a live engine and corrected, settings are offered per model family, and its gateway serves /v1/responses and /v1/messages with quotas.

- Windows installer with the Panel, the engine, the agent and six helpers, registered as services on an all-users install.

Speed, one Radeon RX 7900 XTX at 291 W, one request at a time, newest builds of the other engines on the same card and files

- Qwen4-35B-A3B: 99.5 tok/s writing, 134.9 with its draft head (llama.cpp b13023: 92.5). After 3,659 / 14,339 / 57,550 tokens: 92.6 / 91.9 / 89.8, with the draft head 120.9 / 120.3 / 117.7 (llama.cpp 90.8 / 89.6 / 80.8).

- Inkling-2-Mini against Strata 0.2.28, 8-bit cache on both (Strata's 4-bit cache is refused on this card): 4,096-token prompt read at 2,589 tok/s (2,302), then 75.6 tok/s writing (64.9). 261,632-token prompt read at 1,228 tok/s (828), then 57.9 tok/s writing (12.7).

- Qwen3.8 Flash-Next (94 GB) on the same 24 GB card: first token after 16k / 64k / 256k prompts in 36.3 / 136.4 / 572.1 s.

Things I am not hiding

- llama.cpp reads long Qwen4 prompts 1.5 to 3 times as fast (2,427 / 2,566 / 1,808 against 845 / 1,066 / 1,217 tok/s).

- On MedGemma 2 26B-A4B llama.cpp is clearly ahead (136.3 against 94.3 tok/s writing, 8 to 13 times faster reading prompts): my engine still runs that model's experts one token at a time while reading a prompt. IQ4_XS expert kernels for it are already in progress.

- At 56,123 tokens of prompt llama.cpp writes faster on MedGemma 2 E4B (97.5 against 86.4).

What it is not, yet

- No physical machine has booted this version yet; its nine Secure Boot checks and the install to a disk ran in a virtual machine.

- The Windows installer is built and tested on Linux and has not run on a Windows PC.

- LexiAgent's desktop control (screen, input, accessibility tree) is in the source with its tests but not yet in the program.

Tested: 22,536 tests passed in the full run (LexiOS with LexiKernel 8,822, the engine 7,757 including its device tests on the 7900 XTX, the Panel 5,957), nine boot checks and an 18-step install to a disk.

Links: lexipanel.com/download (about 1 GB image). Release notes, the full change list and the new LexiAgent page are in the wiki of the LexiSuite-Releases repository on GitHub.


r/llamacpp • • 3m ago

Qwen4 35a3b on a 3090 w LlamAmpere: 323 TPS & 5000pp at 100k depth, 20% lower error than UD IQ4 XS, with 400k on-card ctx and automatic paged KV to 1M ctx, non-greedy decode

Thumbnail
reddit.com
1 Upvotes

Ampere-specialized llama fork


r/llamacpp • • 7h ago

Qwen4-35B-A3B on 2× Arc Pro B70 (Windows, llama.cpp SYCL): 91 t/s in real agent use at 260K context, full Q8_0, F16 KV

Thumbnail reddit.com
1 Upvotes

r/llamacpp • • 7h ago

I tried xe-serve, a native Level Zero engine for Intel Arc, on my B70 home server. Here's how it compares to llama.cpp SYCL

Thumbnail
reddit.com
1 Upvotes

r/llamacpp • • 21h ago

14 drop-in ROCm/HIP patches for llama.cpp on AMD RDNA 2 (RX 6900 XT / gfx1030): Wave32 FlashAttention, v_dot8_u32_u4, Qwen3.5 fusions, and benchmarks vs. Mesa RADV

9 Upvotes

My main local GPU is a consumer 16 GiB Radeon RX 6900 XT (gfx1030, Navi 21). Until now I kept most AMD routes on Mesa RADV (Vulkan0) because stock upstream llama.cpp (ee46715 on ROCm 7.2) lost to RADV on 18 out of 18 single-token decode (tg128) tests by -6% to -14%.

When I audited libggml-hip.so and ran rocprofv3 traces, five big bottlenecks popped out:

  1. Upstream routed RDNA 2 MMVQ onto a single-warp fallback (nwarps = 1), capping Wave32 residency at 16/32 waves per CU.
  2. 3,470 of 7,632 compiled HSACO kernels (45.5%) were spilling to private scratch (273 in FlashAttention and 1,299 in MMQ/MMQ-few alone).
  3. Small-batch quantized-KV FlashAttention (B = 1..8) was converting KV tiles through FP16 staging buffers, thrashing Infinity Cache.
  4. nsm = 40 (WGPs) instead of 80 physical CUs left 40–80% of CUs idle around pp=64.
  5. Unfused Qwen3.5 hybrid Gated-DeltaNet / SSM_CONV ops and standalone quantize_q8_1 launches burned 31% of wall time in AQL dispatch gaps.

What's in the Patch Stack (14 atomic MIT patches, ggml/src/ggml-cuda/ only)

Everything is strictly gated to RDNA 2 (gfx1030, zero core/model/server edits, non-RDNA2 HIP/CUDA/Vulkan/CPU untouched):

  • Multi-warp Wave32 MMVQ & DPP: Decoupled MMVQ_PARAMETERS_RDNA2 (2–4 warps) + native Wave32 v_permlanex16_b32 / v_pk_max_f16.
  • Zero-scratch Wave32 flash_attn_ext_rdna2: Eliminated all 273/273 FA spills; stages raw Q8_0/Q4_0/Q4_1/F16 KV directly in LDS (0 B FP16 staging) and uses lossless v_dot8_u32_u4 for Q4_0/Q4_1 KV (-32.2% FA active time vs q8_0 at d=16384).
  • Zero-spill MMQ + bit-parallel IQ + 80-CU guard: Eliminated all 1,299 MMQ/MMQ-few spills, added v_xad_u32+v_perm_b32 IQ2/IQ3 sign unpackers (helpful for fitting 27B + 16K ctx inside 16 GiB), and kept J=32 when J=64 would under-fill 80 CUs.
  • Qwen3.5 GDN/SSM fusions + inline Q8_1 epilogues: Thin mmvf routing (pp=16..64 +10.1%..+34.7%), fused GDN gate/beta + SSM_CONV -> SiLU -> Q/K L2 norm, and inline Q8_1 quantization inside RMSNorm / GLU (-75.2% decode quantize_q8_1 dispatches, -34.6% AQL gaps, -309 to -752 MiB peak server VRAM).

Selected Benchmarks (RX 6900 XT, ROCm 7.2, llama-bench -r 3 -fa 1)

Format: Stock HIP -> Patched HIP (vs Stock HIP | vs Mesa RADV)

WorkloadKV9B UD-Q4_K_XL9B UD-IQ3_XXS27B UD-IQ3_XXS
tg=128 (d=0)q8_065.92 -> 70.25 (+6.6% | 0.962x)83.91 -> 94.11 (+12.2% | 0.982x)30.69 -> 32.81 (+6.9% | 0.982x)
tg=128 (d=16384)q4_062.99 -> 68.05 (+8.0% | 1.006x)80.51 -> 88.77 (+10.2% | 1.019x)29.16 -> 30.81 (+5.7% | 0.993x)
pp=4 (d=8192)q8_0192.10 -> 229.13 (+19.3% | 1.684x)220.06 -> 281.68 (+28.0% | 2.147x)78.75 -> 104.92 (+33.2% | 1.596x)
pp=8 (d=8192)q8_0283.26 -> 347.39 (+22.6% | 1.824x)310.91 -> 459.77 (+47.9% | 2.227x)105.65 -> 161.14 (+52.5% | 1.795x)
pp=8 (d=16384)q4_0270.75 -> 340.85 (+25.9% | 1.511x)305.74 -> 442.56 (+44.8% | 2.177x)101.62 -> 152.38 (+49.9% | 1.788x)
pp=512 (d=0)q8_01634.35 -> 1656.87 (+1.4% | 1.031x)1951.65 -> 2004.62 (+2.7% | 1.401x)585.44 -> 604.19 (+3.2% | 1.427x)

On single-request llama-server (draft-mtp, cache_prompt: false):

  • 27B UD-IQ3_XXS (n=3, short_temp07 70/256): 43.71 -> 56.92 tg tok/s (1.302x vs stock HIP, 1.276x vs RADV; wall 6.03s -> 4.67s, +29.0%).
  • 27B UD-IQ3_XXS (n=3, ctx4k_greedy 6,775/192): 44.25 -> 55.56 tg tok/s (1.256x vs stock HIP; wall 16.92s -> 15.62s vs RADV 21.57s, 1.38x faster than RADV).
  • 9B UD-IQ3_XXS (n=2, ctx4k_greedy 6,775/192): 105.70 -> 123.66 tg tok/s (1.170x vs stock HIP; wall 5.78s -> 5.36s vs RADV 7.17s).

Honest Caveats & What Didn't Work

  • Failed ablations kept out: Non-temporal MALL weight loads (-10% to -22% decode), Gate+Up fusion above B = 1 (-30% to -37% pp=8), and v_dot8 inside MMVQ/MMQ (-13% to -17.5% pp=16..32 because v_dot8 shares the same 1 op/cycle SIMD32 rate as v_dot4 on RDNA 2 and only wins when O(1) prologue packing amortizes over long KV tiles).
  • Greedy divergence (DIFF!): test-backend-ops (7/7) passed 100% and 6-chunk WikiText-2 KLD hit Mean KLD = 0.000000, but multi-warp reduction reordering still nudges borderline greedy tokens and can swing draft acceptance on individual single-shot runs (one 9B IQ3_XXS short greedy row dipped to 0.984x tg on a -10.6 pp acceptance swing).
  • Pure q8_0 decode vs RADV: Patched HIP ties or beats RADV on 9B q4_0 decode (1.000x–1.019x), while pure q8_0 tg128 still sits 1–4% behind RADV (0.953x–0.989x) — traded against HIP's 1.34x–2.28x verify and 1.03x–1.44x prefill lead.
  • Hardware tested: Physically validated on an RX 6900 XT (gfx1030). gfx1031 (6700 XT) / gfx1032 (6600 XT) share the same Wave32 / v_dot4 / v_dot8 ISA, so feedback from anyone testing on those cards would be awesome.
  • MIT Repo (14 patches, spill auditor, fail-closed A/B harness, AGENT_ADOPT_PROMPT.md): https://github.com/s1mply-parad0x1cal/llama-cpp-navi21-optimizations
  • Full write-up (ad-free, with ablations and comparison to llama-navi21-furnace / llama-cpp-rdna-boosts): https://nocthoughts.com/2026/12/04/navi21-gfx1030-rocm-hip-optimizations-for-llama-cpp.html

r/llamacpp • • 14h ago

0.02690, 93.33% (UD-Q6_K_XL); 0.06587, 89.72% (UD-IQ4_XS), against our own BF16 base (Qwen4-35B-A3B)

2 Upvotes

I measured yesterday 12/04 and today 12/05

BF16 base built with llama-perplexity --kl-divergence-base from Unsloth's BF16 GGUF (wikitext-2, 100 chunks of 512, base PPL 7.5364, sha256 ca42cdb0a114c9192e6f854279725ed74be09ea43d91fbdcf082574b2d70f641)

I haven’t measured UD-Q8_K_XL. I saw earlier someone had worse results with Q8 XL vs Q8_0

Any experience from Q8_K_XL vs Q8_0 before I start this next run?

Reference: unsloth docs

Everything is in the repo as well - Halocline


r/llamacpp • • 13h ago

Running Qwen4-35B-A3B on an AMD Strix Halo with llama.cpp

Thumbnail
reddit.com
1 Upvotes

r/llamacpp • • 1d ago

Ternary Bonsai 2.5 27B on 8GB VRAM - Local AI With Vision (llama.cpp Windows Setup)

Thumbnail
youtu.be
6 Upvotes

Ternary Bonsai 2.5 27B is a new open model from PrismML: a full 27-billion-parameter model where every weight is just minus one, zero or plus one. That shrinks the file from 53.8 GB to about 6 GB, so it fits on an 8 GB gaming card, and it can read pictures too. On my RTX 5060 Laptop GPU (8 GB) it answered at about 26 tokens a second.

Model (GGUF files, PrismML): https://huggingface.co/prism-ml/Ternary-Bonsai-2.5-27B-GGUF/tree/main


r/llamacpp • • 21h ago

Qwen4-35B-A3B on a 12GB/30GB laptop: 128K ctx @ ~51 tok/s decode, 256K works, 512K with q4 KV, 1M OOMs

Thumbnail gallery
1 Upvotes

r/llamacpp • • 22h ago

Qwen4 35B A3B (37 GB) on a 16 GB laptop GPU: 27.8 → 77.5 tok/s with an expert cache and MTP drafts off

Thumbnail
reddit.com
1 Upvotes

r/llamacpp • • 1d ago

Qwen 4 35B-A3B - Dual RTX 3060 (24GB) - 70 t/s at 200K+ Context (Procedure & Parameters)

Post image
2 Upvotes

I hope my setup note will help others configure their Qwen 4 35B-A3B on older consumer grade systems (Ryzen 5 + DDR4 + RTX3060).


r/llamacpp • • 22h ago

Qwen4-35B-A3B on an 8 GB laptop 5070: the 12 GB expert-cache recipe backfires, plain defaults win (48 tok/s)

1 Upvotes

Saw the post getting about 90 tok/s on a 12 GB 5070 with -cmoe --moe-cache-mib 7168 and MTP, so I tried the same idea on my laptop. Short version: on 8 GB it doesn't carry over. Plain llama.cpp with no placement flags was the fastest thing I tried.

Setup

Lenovo laptop, Core Ultra 9 275HX, RTX 5070 Laptop 8 GB, 32 GB RAM, Windows 11
llama.cpp b12973 (CUDA), Unsloth UD-IQ4_XS and UD-Q4_K_M, plus Unsloth's Q8_0 MTP file for the draft runs
-c 40960 -fa on -ctk q8_0 -ctv q8_0 on everything, plus whatever's listed in the table
Each setup gets a fresh server, then 3 runs of a 1,500-token coding answer (temp 1.0, top-p 0.95, top-k 20, thinking on). Median shown. Prompt speed is one 12.7K-token prompt.

Results (tg = generation tok/s, pp = prompt tok/s)

Setup IQ4_XS tg IQ4_XS pp Q4_K_M tg Q4_K_M pp
No placement flags 47.8 384 42.2 309
No placement flags + MTP draft 2 46.2 344 44.0 303
-cmoe, 2 GB cache 35.4 387 28.5 308
-cmoe, 4 GB cache 47.3 347 7.9 41
-cmoe, 5 GB cache 7.7 45 7.1 40
-cmoe, 3 GB cache + MTP draft 1 29.7 210 19.9 181
-cmoe, 4 GB cache + MTP draft 1 14.6 210 6.3 37
-cmoe, 4 GB cache + MTP draft 2 10.3 241 5.5 38

What I take from it

There's a cliff at about 7.8 GB used on the card. Anything that goes past it drops to 5 to 8 tok/s, and prompt speed falls off too. IQ4_XS with a 4 GB cache sat just under the line (47 tok/s), Q4_K_M with the same cache went just over (8 tok/s). My guess is the Windows driver spilling into shared system memory instead of throwing an out-of-memory error. I haven't tried turning sysmem fallback off in the NVIDIA control panel yet, so treat that as a guess.
The cache only pays off when it's big enough to hold the hot experts, and on 8 GB there isn't room for that once the KV cache and the rest of the model are loaded. 2 GB was clearly slower than just leaving it alone.

MTP did nothing for me with no placement flags. Draft 2 accepted about half the drafted tokens, draft 1 about 70 to 90%, and the speed didn't move. Add MTP to the cache setups and it gets much worse, I think because the 2 GB draft model pushes the card over the edge. Earlier the same day I got 54 tok/s with MTP draft 2 on a different prompt and couldn't reproduce it here, so I wouldn't count on MTP on this card either way.
Q4_K_M is about 12% slower than IQ4_XS on generation. I'm running it anyway because on a set of harder coding tasks it held up better over long agent loops (4/5 vs 1/5). That's one run each though, so I'm redoing that properly, with 8-bit and full precision for comparison, before I post anything about quality.

If you're on 8 GB: load it with no placement flags and let llama.cpp sort it out. 48 tok/s from a 35B MoE on a laptop is pretty good for a coding model.

Caveats: one machine, 3 runs per setup, one kind of prompt. Happy to try other flag combos if anyone's got one that works on 8 GB cards.


r/llamacpp • • 1d ago

Built my own (pretty strict) benchmark for local models and ran everything I had on a 3090. Qwen3.8 Flash Next IQ3_S kinda smoked everything

Thumbnail reddit.com
0 Upvotes

r/llamacpp • • 1d ago

Hey r/StrixHalo — Qwen4-35B-A3B PaoAI STRIX (Q4..Q8 + shared PLE + vision) + Engine 2.1.0 is live with 1M context unlocked

Post image
1 Upvotes

r/llamacpp • • 1d ago

Qwen4 35b is out. Has anyone run it with LlamAmpere?

Thumbnail reddit.com
1 Upvotes

r/llamacpp • • 1d ago

16 GB RDNA 2 (gfx1030) HIP fork: bounded attention workspace and automatic SSD prefix restore for the static persona/system prompt/skills/123-tool block, leading to 4–8 s completions on RX 6800 XT

2 Upvotes

Disclosure: I maintain this MIT native-runtime fork, based on BeeLlama v0.5.1/llama.cpp. The Windows HIP Runtime ships the runtime, six presets and a small launcher/client.

Across six model presets, this implementation restored 28,445–35,459 prefix tokens, evaluated 39–503 new prompt tokens, completed accepted requests in 4.04–7.78 seconds on an RX 6800 XT, and enables a 8.5x-23x speedup for agentic setups.

The attached graphic contains the per-model token rates, KV formats and resource measurements.

This is custom server-side work in a BeeLlama/llama.cpp fork. It adds automatic prefix persistence and restoration around ordinary OpenAI Chat Completions requests:

  • Cache boundaries come from the server’s actual chat formatting and tokenization.
  • Model, projector, runtime and configuration identities bind saved state.
  • Restoration validates the actual matching prefix.
  • Dense-cache edits can retain a supported aligned common prefix; hybrid caches require safe checkpoints.
  • State publication uses integrity checks, owned-file locking and atomic replacement.

The launcher generates the local policy automatically. Clients need no private cache annotations or manual slot-save commands. Installation and model paths can be on any accessible Windows drive.

Results first. The prefix is the persona system prompt, the skills index and all 123 tool definitions. It is a static block of roughly 28k–35k tokens that gets built once and restored from SSD. After a restore, only your actual prompt is processed (39–503 tokens here), and then the reply is generated. Across six accepted cases, 28,445–35,459 cached tokens were restored and 98.28–99.89% of the input was reused. Requests took 4.04–7.78 seconds, against 66.41–123.37 seconds for the one-time initial capture. One example: Huihui Qwythos Q4_K with q4_0/q3_1 caches restored 28,704 tokens, processed 500 new ones and generated 159 in 5.97 s.

With SSD Cache:

ModelNew tokens prefilledPrefillGenerated tokensDecode
Huihui Qwythos500298.6115969.85
PINQWEN466301.2313972.79
Qwen2.5 Instruct46287.841430.04
Qwythos standard464301.438369.58
Qwythos Heretic503318.2030873.67
GLM Q4_K_S39214.851021.55

Initial build (one-time prefix creation):

ModelTokens prefilledPrefillGenerated tokensDecode
Huihui Qwythos29,161429.299469.83
PINQWEN29,162439.4510472.64
Qwen2.5 Instruct28,483401.751429.76
Qwythos standard29,187423.729869.96
Qwythos Heretic29,237455.6011773.40
GLM Q4_K_S35,490299.871221.39

What the fork changes.

  • Bounded workspace: Temporary dequantization and attention-result merging for selected RDNA 2 cache routes and KVarN paths. The temporary window bounds workspace, not attention context.
  • Automatic SSD prefix state: The native formatter derives setup and history boundaries from ordinary OpenAI Chat Completions requests. Snapshots carry identity and integrity checks.
  • Prefix matching: Tool or template edits are handled by actual causal token-prefix matching. Recurrent or hybrid models need a safe saved checkpoint.
  • Portability: v0.1.2 rebuilds the server DLL to remove the fixed-drive guard. HIP, common and core are unchanged. The full binary set is therefore not identical to the measured one.

The target is compatible 16 GB RDNA 2 / gfx1030 cards (RX 6800, 6800 XT, 6900 XT, 6950 XT). The only measured card is the RX 6800 XT, on Windows build 26300 with a Ryzen 7 7800X3D and 16 GB DDR5-5200.

Caveats.

  • Different test conditions: Suffix and output lengths differ, so this isn't a controlled speedup or a comparison with stock BeeLlama.
  • Missing control: I haven't measured SSD-disabled mode for the full setup.
  • Prompt size: Allocation was 750,080 tokens, but real prompts were 28,483–35,498 tokens.
  • Measurement setup: The cache cases used a private Msty integration. Its assets are excluded.
  • Unrerun tests: I did not rerun any model tests for the changed server. The earlier tool accuracy used a tools-only prefix.

Source and changes · Methods


r/llamacpp • • 1d ago

Qwen3-4B-Thinking fried my 8GB RAM Laptop

Post image
0 Upvotes

I am new to local AI. I wanted a small model to reason with maths logic. I mostly need to reason with puzzles, combinatorics and light algorithms. So Gemini recommend me Qwen3-4B-Thinking-Q4_K_M.gguf

I ran this with llama.cpp with these settings:

--load-mode mmap -ngl 99 -t 4 -c 16384 -np 1 -fa on -ctk q8_0 -ctv q8_0 --temp 0.6 --top-k 20 --min-p 0 --presence-penalty 1.5 --port 8080

My system is: Ryzen 5500u, Amd Radeon integrated GPU, 8GB RAM, Linux Mint

I run Qwen2.5-Coder-3B-Instruct-Q4_K_M smoothly for some latex code on my system.

Idk why the Thinking model bottled on my system. Can I run the thinking model safely somehow? Or should I try other models. I preferred thinking because I need accurate solutions, approach or hints to solve complex problems.

N.B. I configured llama.cpp to run the models on both my cpu and igpu and I verified it works fine.


r/llamacpp • • 2d ago

NVIDIA Pascal (sm_61) CUDA Optimizations for llama.cpp

3 Upvotes

I’ve been seeing how much more I can get out of my GTX 1070 FE (8 GB), so I've worked with Gemini Carbon/Hydrogen to put together three llama.cpp CUDA patches for Pascal sm_61. The biggest change keeps the KV cache quantized through the attention kernel, avoiding a separate Q8-to-FP16 dequantization step in the profiled case.

I tested stock vs. patched at the same upstream commit (ee46715) with Qwen3.5-9B-MTP on the 1070 alone:

Two-token verification at 16K: ~39–40% higher throughput across three weight quants.

Regular decode at 8K with a Q4 KV cache: ~15–19% faster. Bulk prefill barely moved.

Best MTP server case: 25.94 → 29.79 tok/s during generation. Counting prefill and the rest of the request, that was 17.75 → 16.66 seconds. Some settings got slower, and greedy outputs diverged despite no measured change on the short perplexity check. I included those results and the failed kernel experiments in the repo. The 64K smoke test checked that the configuration fit in VRAM; it didn’t fill the window.

Built with CUDA Toolkit 12.9. Use a 12.x toolkit for this build; CUDA 13 dropped offline compilation for Pascal (https://docs.nvidia.com/cuda/archive/13.0.0/cuda-toolkit-release-notes/index.html#deprecated-architectures).

GitHub repo, patches, and A/B scripts (https://github.com/s1mply-parad0x1cal/llama-cpp-sm61-optimizations)

So far I’ve only measured this on my 1070. If anyone still runs a 1080 Ti, P4, or P40, I’d be curious whether the two-token gain holds on your card, and whether it makes a difference to full request times.

Proper attribution/credits in the github readme with explicit roles denoted.

pascallama.cpp vs llama-cpp-sm61-optimizations:

The cleanest summary is that the two patch sets touch almost completely orthogonal subsystems—pascallama.cpp is a minimal 2-file MMQ tile-config + loop-unroll tweak aimed at large-batch/prefill and dual-P40 MoE setups, whereas my repo introduces dedicated sm_61 kernels for quantized-KV FlashAttention and the B = 2..8 small-batch dead zone.


r/llamacpp • • 2d ago

Is there a llama.app ROCm 10 version?

2 Upvotes

As the title suggests, I would like to use the llama.app desktop app for Win11. If you want to use ROCm you need to install the AMD HIP SDK for Windows - which is shipped with ROCm 7.2.

It tells you to go to here: https://rocm.docs.amd.com/projects/install-on-windows/en/latest/install/install.html

Isn't there a newer AMD HIP SDK for Windows shipped with ROCm 10?


r/llamacpp • • 2d ago

Running Qwen4-35B-A3B-UD-IQ4_XS (30.5 GiB) Fully in 24 GB VRAM on a Single RTX 3090: 158.6 t/s with Inline 1L-MTP (and the Default K=3 Trap)

Thumbnail
reddit.com
1 Upvotes

r/llamacpp • • 2d ago

Qwen 4 35B :: 7900 XTX 24GB :: LamaSrv Users whats your TKS and Config

Thumbnail reddit.com
1 Upvotes

r/llamacpp • • 2d ago

Unsloth Qwen 4 35B A3B Q4 quick demo run on 4 x RTX A3000 12GB

Thumbnail
youtu.be
2 Upvotes

r/llamacpp • • 2d ago

Running GLM-4.5V (106B MoE) Locally on M4 Pro 24GB

Post image
1 Upvotes

I’ve managed to get GLM-4.5V (106B MoE, roughly 12B active; IQ4_XS GGUF + Vision Projector) running locally on my MacBook Pro (24GB, 12-core CPU, 16-core GPU, 273 GB/s bandwidth, 4.3 GB/s SSD) using llama.cpp (Metal, CMake)! I set it up with 13 layers offloaded, a 2048-token context, SSD streaming (mmap), and the AnythingLLM frontend, with speeds of less than 1 tokens/sec.

I’m hoping to achieve great image analysis and long-context RAG quality through SSD streaming and expert caching, even with just 24GB of RAM.

Could anyone kindly suggest if there are some RAG optimisation tips for llama.cpp, confirm whether the built-in dynamic expert caching for MoE is available, and share any benchmarks or tips you might have? Cheers!


r/llamacpp • • 2d ago

Anyone run DeepSeek-V4.1-Flash-1017-GSQ-RCO? How can i stop deepseek overthinking/looping on long tasks?

Thumbnail reddit.com
1 Upvotes

r/llamacpp • • 2d ago

Qwen4-35B-A3B: DFlash2 support PR for llama.cpp, 2x speed on code tests up to 400 tps on 5090

Thumbnail
github.com
1 Upvotes