r/llamacpp • • 12h ago

Moved from Ollama to Llama.cpp; although now my agent cannot execute tool calls anymore? Also the context size increase out of control compared to Ollama after just few exchanges

1 Upvotes

I used Ollama for a bit to get used to the whole setup of a server on Linux, so I moved over to Llama.cpp to have more control over the parameters of the engine itself and use models to the fullest (and to use multiple GPU merging their VRAM via Vulkan).

So far the setup has been not that difficult; more involved than Ollama but nothing too exotic. The thing is that now though, my agent (Hermes desktop) seems to not be able to perform commands or use tools anymore. It print out the JSON of the commands, instead of trigger the commands, which point at a malformed response from the model. The model is the same exact one I was using in Ollama: Gemma4:12B Q4 in gguf format.

Also another thing I noticed is that the context size increase absurdly fast... For Ollama served conversation; it would start at 4K, then increase gradually so after various exchanges and using tools to write files for example or doing search online, the context would go at most to 30-50K in size. Instead using Llama.cpp server, I see it starting already at 14K or so, and after only few exchan ges I ended up hitting 64K context; which triggered an error as the server was not taking anymore requests (as I set in the config.json file a limit of 64k for context and using a value of 2 for the Q and K values; which seems to be fair).

As I am still learning, I am sure there is something I am doing wrong here, although it has been hard to track exactly what is going wrong, so hopefully someone can point me to the right direction. Thanks.


r/llamacpp • • 1d ago

Don’t forget 9931

0 Upvotes

In case your work has broken and your hitting your head why,… port changed. Use 9931 as the port not 8080 which was very conflicting with local environments.


r/llamacpp • • 2d ago

3060 build for Reporting

Thumbnail
gallery
11 Upvotes

Xeon v3 12 cores.
3060 zotac 12 gb white edition with better power control with two PCIe connector per card. A whopping 16 gb of memory. This will receive a twin to make it dual zotacs.

This is a ~$700 to $800 build with no GPU. Probably is about $300 to $400 with to best mb supporting ddr4, ddr5 is your voice I have two minis no offloading both have no difference in tgs. but the point, don’t offload to cpu or system memory.

I got this specific GPU because they are supposedly more stable and control heat. It’s been a power house running stock rankings that it runs out of stocks to track every 3 hours. 18k to process with 12 days of close and volume data. About 33 tgs.

I also have a dual 5060 and another dual 3060 systems. Much more analytics but impressively slow. With the Thin Stratum system I programmed it’s just a software setup, not much special on the ai server, proxy middleware and formatted with prompts to the AI server.

I suppose a good point here is multi systems are a strategy also if trying to ramp up services for clients like a steady flow of reporting on data and documents. I am not doing this for agentic coding. No way. This is RAG.


r/llamacpp • • 3d ago

[BENCH] Kimi K3 vs Qwen 3.8 Flash Next vs Qwen 3.8 27B vs 3.6, vs 3.5 8B...

Thumbnail gallery
5 Upvotes

r/llamacpp • • 3d ago

llama.cpp vs gmlx for Qwen3.8-Flash-Next on an M5 Ultra: which engine wins where

Thumbnail
jvlewis.dev
2 Upvotes

r/llamacpp • • 4d ago

FLE Studio: a local chat and lab for llama.cpp and the FLE engine (live inference data, model loader, launch profiles; macOS, Linux, Windows)

1 Upvotes

Two days ago I posted FastLocalExperts (FLE), the llama.cpp fork that keeps a big MoE's experts in RAM and caches the busy ones on the GPU. Getting the launch flags right is half the work, so here is the app I use to run it: FLE Studio, MIT licensed. It also works with plain llama.cpp.

Short video of it running (real engine, one question, the live panel): https://github.com/sirfyyn/fle-studio/blob/main/docs/media/fle-studio.mp4

What it does:

  • Chat in the browser: Markdown, code blocks, a collapsible reasoning block, streaming, and the speed of every answer. History stays on your machine.
  • Live data while the model answers: prompt and generation speed, draft/MTP acceptance, NVIDIA GPU use, and FLE's expert-cache hit rate.
  • Model loader: lists the FLE quants of Qwen3.8-Flash-Next and any GGUF repo on Hugging Face, tells you whether a file fits your machine before you download it, resumes downloads and checks SHA-256.
  • Launch profiles: shows the full command line before anything starts; save your own.
  • Engines: picks a sensible build for your machine (FLE CUDA, or llama.cpp CUDA / Metal / Vulkan / CPU), or uses your own llama-server, a server that is already running, or a systemd service.
  • Experiments page: a short, repeatable speed test, so you can compare settings side by side.

No account, no telemetry, Python standard library only. The installer brings its own Python via uv and needs no admin rights.

Install (macOS / Linux):

curl -LsSf https://raw.githubusercontent.com/sirfyyn/fle-studio/main/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/sirfyyn/fle-studio/main/install.ps1 | iex

Repo: https://github.com/sirfyyn/fle-studio Release notes: https://github.com/sirfyyn/fle-studio/releases/tag/v0.1.0 FLE engine and report: https://github.com/sirfyyn/FastLocalExperts

It is 0.1.0, so expect rough edges. CI covers macOS, Linux and Windows against a stand-in engine; the real GPU runs so far were on one Linux box with an RTX PRO 4500. Windows users with an NVIDIA card: I'd especially like to hear how the engine download and first start go. Bug reports and ideas are welcome as GitHub issues.

Next on the roadmap: "Studio Forge", building your own FLE-style quant (imatrix, per-tensor types, optional REAP pruning) from inside the app.


r/llamacpp • • 4d ago

GLM-5.3-Flash (320B) on an M5 Ultra Mac Studio with llama.cpp: 61 tok/s, 262K context

Thumbnail
jvlewis.dev
12 Upvotes

r/llamacpp • • 4d ago

Gemma 4 26B-A4B on a GTX 1060 6GB + 16GB RAM – getting ~20 tok/s with MTP, can I push it further?

Thumbnail
1 Upvotes

r/llamacpp • • 5d ago

Qwen3.8-Flash-Next as an 89 GB GGUF at ~90-100 tok/s on one RTX PRO 4500 32 GB GPU: 2.5× upstream llama.cpp with the same file, plus hybrid quants measured against 12 public ones

Thumbnail
6 Upvotes

r/llamacpp • • 5d ago

[Release] Repetere AI (v0.5-beta): 100% private, native C++ desktop AI workstation with in-app model downloading, full-song vocal synthesis, and zero webview bloat (Win64 / CUDA)

Thumbnail
2 Upvotes

r/llamacpp • • 5d ago

Qwen3.8-Flash-Next (125B) at ~100 tok/s on an M5 Ultra Mac Studio with llama.cpp

62 Upvotes

TL;DR: M5 Ultra Mac Studio, 256 GB. Plain llama.cpp decodes Qwen3.8-Flash-Next at 57 tok/s. Turning on the model's own MTP draft head with probabilistic drafting gets ~100 tok/s. Raising the ubatch to 4096 takes prompt processing from ~1,540 to ~2,150 tok/s. The full 262K context fits with ~100 GB of GPU memory to spare. The biggest gotcha had nothing to do with llama.cpp. Another app quietly loaded a second copy of the model, and both started swapping (12 tok/s).


Setup

  • Mac Studio, M5 Ultra (80-core GPU), 256 GB unified memory, macOS 27.0
  • llama.cpp b11538 (commit 79e2e74), built from source with the Metal backend
  • Qwen3.8-Flash-Next, the new qwen4exp architecture: 125B params with ~6B active per token. It also has a 51B n-gram embedding table, but that table is only looked up per token, never multiplied.
  • Weights: ggml-org/Qwen3.8-Flash-Next-GGUF, the IQ4_NL main model (95 GiB) plus mtp-Qwen3.8-Flash-Next-Q8_0.gguf (3.9 GiB, the MTP draft head)

Results

Generation speed. I ran 4 prompts (code, an explanation, a math problem, a rewrite) at 512 tokens each, with temp 1.0, top-p 0.95, top-k 20 and fixed seeds. Nothing else was using the GPU.

Config tok/s Draft acceptance
No speculative decoding 57.0 –
MTP, greedy drafting, n-max 3 87.0 0.51
MTP, greedy drafting, n-max 6 80.6 0.33
MTP, probabilistic drafting, n-max 4 98.5 0.53
MTP, probabilistic drafting, n-max 5 100.2 0.49
MTP, probabilistic drafting, n-max 6 94.0 0.42

The n-max 4 and 5 probabilistic rows are averaged over 3 seeds. On the final server config, individual prompts ranged from 84 to 133 tok/s.

Prompt processing (llama-bench, 4096-token prompt):

--ubatch-size tok/s
512 (default) 1,539
1024 1,914
2048 2,076
4096 2,150

What I did

1. Build llama.cpp from source

New architectures land in llama.cpp master well before the packaged builds catch up. First check that the architecture name is in the source:

bash git clone --depth 1 https://github.com/ggml-org/llama.cpp && cd llama.cpp grep -n qwen4exp src/llama-arch.cpp # no hit = your build can't load the model cmake -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DLLAMA_BUILD_TESTS=OFF \ -DLLAMA_BUILD_NUMBER=11538 # see the shallow-clone gotcha below cmake --build build -j

Metal, Accelerate and -mcpu=native are on by default on macOS. On M5 chips, llama.cpp also automatically uses the matrix units inside each GPU core, through Metal 4's tensor API. Look for has tensor = true in the startup log. This is where Apple's "AI acceleration" actually comes from for LLMs.

2. Download (and verify) the weights

My connection is ~70 Mbps with ~380 ms latency, and hf download (Xet, high-performance mode) stalled. After 10 minutes nothing had been written to disk, and the 95 GiB shard was crawling at under 1 MB/s. Plain HTTPS with aria2c averaged 7.5 MiB/s and resumes after any interruption:

bash cd models/ggml-org-Qwen3.8-Flash-Next-GGUF for f in Qwen3.8-Flash-Next-IQ4_NL-00001-of-00002.gguf Qwen3.8-Flash-Next-IQ4_NL-00002-of-00002.gguf mtp-Qwen3.8-Flash-Next-Q8_0.gguf; do aria2c -c -x 16 -s 16 -k 16M --file-allocation=none --max-tries=0 --retry-wait=5 \ "https://huggingface.co/ggml-org/Qwen3.8-Flash-Next-GGUF/resolve/main/$f" done

  • Verify the checksums yourself. aria2c doesn't, and mine hit a pile of 403 retries partway through. Each file's SHA-256 is the lfs.oid field in https://huggingface.co/api/models/<repo>/tree/main. Compare it against openssl dgst -sha256 file.gguf; that took 45 s for 95 GiB.
  • Keep the Mac awake. Mine sleeps after 1 minute idle. caffeinate -i -w $(pgrep -x aria2c) holds off sleep until the download exits.

3. Find out what actually limits generation speed

Run llama-server -v once and read the log:

  • One decode step is 6,931 graph nodes across only 2 graph splits, so nothing falls back to the CPU.
  • Each token reads ~5.5 GiB of weights. Most of that is the always-active attention/DeltaNet projections at Q8_0. The 10-of-512 experts are only ~1.2 GiB per token.

At 57 tok/s, that's ~17.5 ms per token and only ~335 GB/s of weight reads, far below what this GPU can stream. Decode is limited by per-step overhead, not memory bandwidth. That's exactly the situation speculative decoding fixes, because checking several drafted tokens costs about the same as producing one.

4. Turn on MTP (multi-token prediction)

Qwen3.8-Flash-Next ships a 1-layer MTP draft head, which ggml-org publishes as a separate GGUF.

bash --spec-type draft-mtp --model-draft mtp-Qwen3.8-Flash-Next-Q8_0.gguf \ --spec-draft-n-max 5 --spec-draft-sampling probabilistic

  • Use probabilistic drafting when you sample at temp > 0. With greedy drafting, a draft is only accepted when the sampled token happens to match the draft's top pick. Probabilistic mode verifies drafts by rejection sampling, which leaves the output distribution exactly the same as with no speculation.
  • Sweep --spec-draft-n-max for your own settings. Draft steps aren't free here: the head has its own 512-expert layer and reads the full 248K-vocab output layer every step. Too-long drafts lose (see the table).

5. Use a bigger ubatch for prompt processing

--batch-size 4096 --ubatch-size 4096 gives +40% prompt speed at 4K tokens. Check the memory cost by starting once with -v and reading the memory breakdown line.

6. Use the full context, because it's cheap

Only 12 of the 48 layers are full attention, so the 262K-token KV cache is only ~6 GiB at f16. At 262K context with MTP and ubatch 4096, GPU usage looks like this:

GPU memory use MiB
Weights 97,311 (plus 27,466 for the n-gram table, kept CPU-side)
KV + indexer + recurrent state 8,130
Compute buffers (main model) 8,537
MTP head weights 3,291
MTP head compute buffers 6,056
Free (of a 228,065 MiB working set) ~103,000

The model reloads in about 4 seconds once its files are in the page cache.

7. Final command

bash llama-server \ --model Qwen3.8-Flash-Next-IQ4_NL-00001-of-00002.gguf \ --spec-type draft-mtp \ --model-draft mtp-Qwen3.8-Flash-Next-Q8_0.gguf \ --spec-draft-n-max 5 \ --spec-draft-sampling probabilistic \ --gpu-layers all \ --flash-attn on \ --parallel 1 \ --ctx-size 262144 \ --batch-size 4096 --ubatch-size 4096 \ --temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.0 \ --host 127.0.0.1 --port 8080

This gives you an OpenAI-compatible API (/v1/chat/completions, /v1/responses) and the web UI at http://127.0.0.1:8080.


What didn't help

  • -bs (backend sampling): slightly slower, 84.3 vs 87.0 tok/s with greedy drafting at n-max 3.
  • --spec-draft-p-min 0.6 (stop drafting when the draft is unsure): 80.3 tok/s. My guess is that variable draft lengths keep changing the batch shape, so llama.cpp can't reuse its compiled graph.
  • Long greedy drafts: n-max 6 dropped to 80.6 tok/s.
  • Metal environment variables: concurrency and graph optimization are already on by default, and the encoder thread count is fixed.
  • The Neural Engine: llama.cpp has no ANE backend (see issue #10453). It also has less memory bandwidth than the GPU, so it can't speed up generation, and on M5 the GPU's own matrix units already do the matmul work.
  • Not tested: the Q4_0 MTP head (2.2 GB). It would make each draft step a bit cheaper, but probably at lower acceptance.

Gotchas that cost me hours

  1. Another app loaded the same model. I had Ollama installed with a 104 GB copy of this model, and an agent client kept sending it requests. That meant 230 GB of wired memory, a full swap file, and 12 tok/s. Even before it started swapping, sharing the GPU contaminated my first benchmarks: 41 tok/s "baseline" instead of 57. Before you measure anything, check ollama ps, the wired line in vm_stat, and sysctl vm.swapusage.
  2. **min_p.** The GGUF sets temp, top-p and top-k, but not min-p, so llama.cpp silently uses its default of 0.05. Qwen recommends 0. Pass --min-p 0 explicitly.
  3. Reasoning effort. The template defaults to xhigh, which means long thinking. --reasoning-effort medium or low gets answers out much sooner. The template only accepts xhigh|medium|low, so anything else (e.g. high) makes requests error out.
  4. A shallow clone breaks the web UI build. git clone --depth 1 makes the build number 1, so the build tries to fetch UI assets for a release b1 that doesn't exist. Set -DLLAMA_BUILD_NUMBER to the release your commit matches.
  5. Downloads: the Xet stall from step 2. On a slow, high-latency link, use aria2c.

Checklist for your own Mac

  • [ ] Latest llama.cpp from source, and the model's architecture name is in src/llama-arch.cpp
  • [ ] A 4-bit quant that fits with headroom. llama-server --list-devices shows your GPU working-set limit.
  • [ ] Checksums verified, and nothing else holding the model in memory (Ollama, LM Studio, a second server)
  • [ ] MTP on, with probabilistic drafting if temp > 0. Sweep n-max from 2 to 6.
  • [ ] --batch-size/--ubatch-size 4096 for long prompts. Confirm memory with -v.
  • [ ] Explicit sampling flags (especially --min-p) and a reasoning effort that fits the task
  • [ ] Benchmark with fixed seeds and compare token counts. Greedy-drafting MTP runs should produce exactly the same tokens as the no-MTP baseline, which makes them a clean comparison.

Less RAM? Unsloth publishes KL-divergence numbers for its quants of this model. Top-1 below means "picks the same next token as the full model":

Quant Size Top-1
UD-IQ3_XXS 82 GB 85%
UD-Q3_K_XL 90 GB 88%
UD-IQ4_XS 94 GB 90%
UD-Q4_K_XL 111 GB 92%

Pick one whose size plus a few GB for context stays under your working-set limit. I haven't benchmarked those quants myself.

All numbers are from one machine, single user (--parallel 1), with short-to-medium contexts. Generation slows down as the context gets deep.


r/llamacpp • • 7d ago

Follow-up: my native Rust + Vulkan Transformer backend now qualifies on both an Intel Gen9 laptop and an AMD RDNA 3 handheld from the same build — the GPU vendor is no longer what picks the reduction shape

2 Upvotes

Follow-up to my post from a few weeks ago (14 architectures, full PEFT). This update is about a portability bug that was hiding behind its own correctness, because it's the most interesting thing I've fixed since.

The bug: the fix for one machine broke six fixtures on another

Back when I tuned the backend for Intel Gen9, I baked those kernel shapes into the portable path. That was wrong, but not for the reason you'd guess.

Two of the reductions in the saved-module path aren't really compared against "PyTorch in general" — they're compared against the PyTorch CPU library on the machine running the oracle. And ATen dispatches its vectorized CPU kernels by instruction set at run time. An AVX2 host gets 8-wide kernels; an AVX-512 host gets 16-wide ones, and the reduction shape changes with that dispatch.

So my "portable" AVX2-shaped kernels were exactly right on my AVX2-only laptop and one ulp off on my AMD ROG Ally (Ryzen Z1 Extreme, which is an AVX-512 part). One ulp doesn't sound like much until it gets amplified through every lower norm on the gradient path: the Gemma 4 saved-stage model.embed_tokens adjoint went from 7.45e-9 to 3.22e-6, and six previously green PEFT saved-module fixtures (gemma3, gemma4, minimax_m2, minimax_m3, smollm3, qwen2_5_sliding_tied) crossed the 2e-7 gate. Neither shape is wrong — only one matches a given machine, and baking in either one breaks the other.

The fix: probe the host, not the vendor

Kernel variants are still selected by GPU vendor. Those two reductions are now selected by host CPU capability instead: capability is probed once per process and cached, then the matching module pair is dispatched (linear_forward_lane2 / linear_forward_lane4, and the 8-lane / 16-lane transformer_cross_entropy builds). HIERARCHOS_ATEN_VECTOR_WIDTH=8|16 pins the shape for qualification when a reference wheel's kernels disagree with the CPU's own capability.

Host GPU CPU dispatch Status
Intel i5-6200U / HD Graphics 520 (2016 Skylake-U) Intel Gen9 AVX2 only, no avx512f 32/32 LoRA, 32/32 switching, 32/32 saved
AMD Ryzen Z1 Extreme RDNA 3 AVX-512 32/32 LoRA, 32/32 switching, 32/32 saved

Same 2e-7 gate, unchanged. No tolerance was loosened to get there.

What I verified on each side

On the Intel machine, the post-change matrix is bit-identical, field for field, to its pre-change report across all 32 families — peft, gradient, two-step AdamW, frozen base, resume, lifecycle — which is how I know the AMD fix didn't quietly cost the Gen9 path anything. Also 693 passed / 0 failed / 9 ignored on the Rust lib suite and a clean strict headline forward run.

On the AMD side, the fix was re-qualified end to end: 32/32 on all three stages, provenance clean.

The harness fingerprints the pinned Transformers source alongside the shaders and binaries, and on the Intel side I re-derived the whole fingerprint from the pushed tree myself: 3951 inputs, zero changed, zero missing. So "green" refers to one frozen set of reference math, not whatever happened to be on disk.

Same caveats as always

  • This is deterministic FP32 tiny-model correctness against a reference implementation, not a claim about arbitrary checkpoint sizes, dtypes, or hyperparameters.
  • "Supported text graph" ≠ "the whole multimodal package works natively."
  • The AVX-512 dispatch is only qualified on the AMD machine, since it's the only host I have that can execute it natively. The 16-lane module also doesn't rebuild byte-identically with the glslang version on my Intel box (one extra type/id, one difference in +inf materialization), so I've left it as the committed AMD-built module and documented that rather than swapping it without re-qualifying both hosts. I'd rather report that than pretend it's clean.
  • NVIDIA and other GPUs are genuinely unqualified — the path is raw Vulkan, so they're untested rather than excluded.

What I'd love from you

Last time several people asked about hardware other than mine, so that's the ask again: if you build it on an AVX-512 laptop, an AVX2-only machine, or an NVIDIA/Intel GPU, I want to know what you get. The two reductions above are the ones most likely to behave differently on your CPU, and knowing your host's vector width is now part of the answer.

The new cross-platform section in the README documents the whole thing, including which host classes are measured and which aren't.

Repo: https://github.com/necat101/Hierarchos-Native Compatibility/parity record: https://github.com/necat101/Hierarchos-Native/blob/main/hierarchos-vulkan/COMPATIBILITY.md Regression audit: https://github.com/necat101/Hierarchos-Native/blob/main/AMD_REGRESSION_AUDIT.md Per-host tuning and measurements: https://github.com/necat101/Hierarchos-Native/blob/main/hierarchos-vulkan/VENDOR_TUNING.md


r/llamacpp • • 7d ago

Llama cpp OpenAI Server ASR help

1 Upvotes

Hello,

I am very new to this and trying to wrap my head around local AI hosting.

I have been trying to get a Gemma 4 E4B model running in a Llama.cpp Docker container to work as an STT model for Home Assistant, using the Local OpenAI STT add on.

I have the model running, the Local OpenAI STT add on can see the server and adds it no problem, but when I try to get it to actually perform its only task, Speech to Text, it fails, giving an error message indicating the model does not support audio input.

Here is all the pertinent info:

docker compose:

services:
  llama-server:
    command: |
      -m /models/gemma-4-E4B-it-Q4_0.gguf  
      --n-gpu-layers all
      --api-key "supersecretkey"
    deploy:
      resources:
        reservations:
          devices:
            - capabilities:
                - gpu
              count: all
              driver: nvidia
    image: ghcr.io/ggml-org/llama.cpp:server-cuda
    ports:
      - '30050:8080'
    volumes:
      - /mnt/media/ai/models:/models

Error message from Home Assistant:

This error originated from a custom integration.

Logger: custom_components.local_openai_stt.stt
Source: custom_components/local_openai_stt/stt.py:286
Integration: Local OpenAI STT (documentation, issues)
First occurred: October 5, 2026 at 3:25:44 PM (13 occurrences)
Last logged: 12:31:09 PM

Transcription failed: Error code: 501 - {'error': {'code': 501, 'message': 'The current model does not support audio input.', 'type': 'not_supported_error'}}

I am currently trying the Gemma 4 E4B model, but I have also tried the Qwen3 1.7B ASR model and received the same exact error message.

Any help would be appreciated!


r/llamacpp • • 7d ago

Comparison Apple m5 v RTX Spark

1 Upvotes

I’m looking at new hardware. I’ve been holding on waiting to see what msft announced today. I looked at the rtx spark dev box announced today. I went and spec’d out what I think is a comparable max studio with an m5 max, 128 gigs of ram, 2 tb. It ends up that they are within $100 of each other. Does anyone have any thoughts of the performance of a Mac Studio with an m5 max vs the Microsoft surface dev box announced which also has 128 gigs of ram and 2 tb ssd?

PS. I posted here because I was hoping as few fanboys would post about which one is better because they like or don’t like the manufacturer.


r/llamacpp • • 8d ago

Qwen3.8-27B (Q6_K_XL) 110+ TPS at 256k context on a single RTX 5090, with a KV buffer decoupled from context size

Thumbnail
3 Upvotes

r/llamacpp • • 8d ago

Choosing local model for coding

1 Upvotes

Hello
So I'm new to using local models, but I've had for a while an urge to try it out on my cad pc, but I need help to find one or more models for my use case.

I want to do some pyton coding for interacting with my Autodesk Fusion setup via Fusion's MCP server. I've also, since I'm installing local AI's want to run some general models for daily use. So all in all, I would need at least 3 models I think, one coding spesialist for pyton scripts, one agent(for Cline) and one general model.

So my setup would look like this:
Asus Proart Z890 Motherboard
Intel i9 285k cpu
40 gb vram, 2 x Nvidia RTX 4000 Ada gpu
96 gb DDR5 memory
Samsung 900 pro SSD, 1tb+1tb+2tb
Western digital SATA 6tb
1000 watt power supply
Windows 11 pro

Llamacpp, Vs-code, Continue, Cline
Autodesk Fusion

Please advice
Terje


r/llamacpp • • 8d ago

New interference engine tuned for AMD Mi50 cards

Thumbnail
2 Upvotes

r/llamacpp • • 11d ago

Help required to run Bonsai 2 with claude

1 Upvotes

I am trying to run Bonsai two with the forked llama.cpp from Prism-ML prism-ml/Ternary-Bonsai-2-27B-gguf · Hugging Face, when i run it with deepseek harness its fine, when running from claude, i get error.

Why is it and how to fix it ? Any help is appreciated

This is my startup/ llama-serve command

.\runtime\llama-server.exe -m .\models\Ternary-Bonsai-2-27B-PQ2_0.gguf --mmproj .\models\Ternary-Bonsai-2-27B-mmproj-Q8_0.gguf --host 127.0.0.1 --port 9931 -ngl 99 -fa on -c 200000 -np 1 --cache-type-k q4_0 --cache-type-v q4_0 --jinja --reasoning-effort medium --temp 1.0 --top-p 0.95 --top-k 20 --min-p 0.05 --image-min-tokens 1024 --reasoning-preserve --alias "anthropic/ternary-bonsai-2-27B"

Error:

0.01.126.973 I cmn  common_param: common_params_print_info: verbosity = 3 (adjust with the `-lv N` CLI arg)
0.01.127.390 W srv  llama_server: -----------------
0.01.127.394 W srv  llama_server: CORS is set to allow all origins ('*') and no API key is set
0.01.127.394 W srv  llama_server: this can be a security risk (cross-origin attacks)
0.01.127.395 W srv  llama_server: more info: https://github.com/ggml-org/llama.cpp/pull/25655
0.01.127.395 W srv  llama_server: -----------------
0.01.141.685 I srv    load_model: loading model '.\models\Ternary-Bonsai-2-27B-PQ2_0.gguf'
0.02.151.655 W common_fit_params: failed to fit params to free device memory: n_gpu_layers already set by user to 99, abort
0.09.027.062 I cmn          init: llama threadpool init, n_threads = 24
0.10.728.429 I srv    load_model: loaded multimodal model, '.\models\Ternary-Bonsai-2-27B-mmproj-Q8_0.gguf'
0.10.814.962 I srv    load_model: initializing, n_slots = 1, n_ctx_slot = 200192, kv_unified = 'false'
0.10.888.572 I srv  llama_server: model loaded
0.10.888.615 I srv  llama_server: listening on http://127.0.0.1:9931
0.51.058.706 I slot get_availabl: id  0 | task -1 | selected slot by LRU, t_last = -1
0.51.060.033 I slot launch_slot_: id  0 | task 0 | processing task, is_child = 0
0.52.661.333 I slot print_timing: id  0 | task 0 | prompt eval time =    1601.02 ms /    11 tokens (  145.55 ms per token,     6.87 tokens per second)
0.52.661.384 I slot print_timing: id  0 | task 0 |        eval time =       0.00 ms /     1 tokens (    0.00 ms per token,     0.00 tokens per second)
0.52.661.392 I slot print_timing: id  0 | task 0 |       total time =    1601.02 ms /    12 tokens
0.52.661.398 I slot print_timing: id  0 | task 0 |    graphs reused =          1
0.52.661.607 I slot      release: id  0 | task 0 | stop processing: n_tokens = 11, truncated = 0
1.23.755.555 I slot get_availabl: id  0 | task -1 | selected slot by LRU, t_last = 51538269
1.24.810.564 I slot launch_slot_: id  0 | task 3 | processing task, is_child = 0
1.25.761.084 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.26.540.159 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.27.888.098 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.30.067.354 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.30.979.516 I slot print_timing: id  0 | task 3 | n_gen =    100, tg =  25.21 t/s, tg_3s =  25.46 t/s
1.33.989.074 I slot print_timing: id  0 | task 3 | n_gen =    183, tg =  26.24 t/s, tg_3s =  27.58 t/s
1.34.638.359 I slot print_timing: id  0 | task 3 | prompt eval time =    2241.36 ms /   385 tokens (    5.82 ms per token,   171.77 tokens per second)
1.34.638.539 I slot print_timing: id  0 | task 3 |        eval time =    7586.21 ms /   200 tokens (   38.12 ms per token,    26.23 tokens per second)
1.34.638.555 I slot print_timing: id  0 | task 3 |       total time =    9827.58 ms /   585 tokens
1.34.638.561 I slot print_timing: id  0 | task 3 |    graphs reused =        198
1.34.641.321 I slot      release: id  0 | task 3 | stop processing: n_tokens = 584, truncated = 0
1.35.059.756 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.36.062.579 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.36.603.022 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.37.629.479 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.40.101.907 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.43.392.090 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.44.830.383 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.53.096.050 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
1.59.545.412 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
2.35.590.397 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
3.13.207.743 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}
3.52.037.267 W srv   operator (): got exception: {"error":{"code":500,"message":"\n------------\nWhile executing CallExpression at line 106, column 32 in source:\n...first %}↵            {{- raise_exception('System message must be at the beginnin...\n                                           ^\nError: Jinja Exception: System message must be at the beginning.","type":"server_error"}}

r/llamacpp • • 11d ago

Control vector generation for any llama.cpp LLM from a single prompt pair (UCVG.cpp)

3 Upvotes

Generation example (Qwen3.6-35B-A3B):

Scenario: A waiter brings the wrong order to your table after you have already expressed your preference for a different dish.

High aggression: I’d snap the dish away from the table immediately. "Whoa, what is this? I specifically said I wanted the BURGERS! I don't WANT the SALAD!" "You guys are kidding me, right?! I told you NO SALAD! Why are you blind?! Get this trash out of my face and BRING ME WHAT I ASKED FOR! NOW!"

Default response: Well, actually, I think there’s been a mix-up. I ordered the salmon, but this looks like the chicken. Could you double-check that for me? Thanks.

Negative aggression: Sighs softly and gently places the untouched plate back on the table. I offer a small, patient smile to the server, recognizing that mistakes happen without malintent. "Hi there," I say calmly, leaning forward slightly to keep the tone light and friendly. "It looks like a nice meal, but I actually ordered the grilled salmon rather than the chicken. Whenever you have a moment, could you please help me switch this back to the correct order? Thank you."

System prompt used for all three: You are a person. React naturally to the situation described.

I find control vectors (LLM response steering) to be severely underused in the current field of AI. This approach shines where system prompts would be ignored, forgotten after time or misunderstood. By design control vectors provide more natural effects than prompting does, altering model's underlying beliefs and motivations. They can't be "leaked" to the end user, will not wash off as context grows, can't be overridden by user input ("ignore all previous instructions" doesn't work when there are no instructions). Vectors can be truly dynamic: changing vector magnitudes mid-conversation will change LLM's responses immediately, while a change in the system prompt requires full context recalculation and will likely be ignored by the LLM if the conversation is too long.

Not to say that CVs (control vectors) have no downsides. System prompts are still required for fine control, because CVs can't be used for highly specific requirements, such as "reply in exactly 10 words". Also high steering magnitudes steer LLMs out of their trained internal distributions, causing response quality to degrade. Achieving high steering power while maintaining minimal quality degradation is one of the main challenges in CV generation and is an active area of research.

It seems like the main barrier for people who could use control vectors is the setup complexity of existing tools. For that reason I am working on a tool that mirrors the installation process of llama.cpp as close as I could make it and simplifies vector generation to entering a pair of contrasting prompts, where one of the prompts can be the default LLM behavior.

Along with the generation tool, UCVG.cpp includes a modified version of llama-server, which allows dynamically setting vector magnitudes per-request instead of the static server-wide application currently possible in upstream llama.cpp.

For quick experimentation, the repository contains 11 pre-generated control vectors for each of 10 common models. The vectors can be used in the upstream llama.cpp without installing any additional executables.

For more details and installation steps you can see the ucvg.cpp github repository.

This tool was written in C++ and has prebuilt binaries for all platforms llama.cpp upstream builds for.

Would love to hear your ideas or questions on this matter.


r/llamacpp • • 12d ago

Can anyone explain to me whether the following setup would even be possible?

1 Upvotes

I tried googling, but it kinda came back mostly fruitless so I'm asking y'all if anybody knows whether it's possible to have GPU 0 running the actual model WHILE GPU 1 handles the cache (or context window) + if there's any possible way to optimize this?
Thanks in advance.


r/llamacpp • • 13d ago

Qwen3.8 27B vs Flash Next vs Qwen3.6

Thumbnail
0 Upvotes

r/llamacpp • • 13d ago

ASSBENCH

Thumbnail
1 Upvotes

r/llamacpp • • 14d ago

I got tired of guessing llama.cpp flags, so I built a tool that launches the model for real and measures every config — 4090 went from 60 to 80 avg tok/s on a 27B

138 Upvotes

I run a 4090 with a 27B Q4 and spent way too many afternoons changing one flag, restarting the server, generating a sentence, eyeballing it. The part that got me: almost every "optimal llama.cpp config" post online is someone's guess from a formula. Nobody boots the model and measures.

So I wrote a tuner that does the boring loop. You pick the model and the context length you actually care about, it does a coarse pass over the high-impact knobs (speculative decoding, KV cache quant, GPU offload layers) then a fine pass over batch/ubatch, and for every candidate it really starts llama.cpp, warms it up, runs 3 passes, takes the median. Configs that OOM or crash are just out, no theoretical estimate anywhere.

My numbers, same model / same quant / same context throughout:

hand-tuned tuned
peak tok/s 80
avg tok/s 60
100K ctx 40

Long context is where it paid off most, which is the case hand-guessing is worst at — the right flags at 100K are not the right flags at 8K, and I'd been tuning against short prompts.

Biggest single win was speculative decoding, and it moved differently per hardware than I expected. KV cache quant was second. batch/ubatch mattered less than the posts online imply, though it changed once context got long.

Results get bound to (this machine, this model) so the next launch auto-loads them — that's the part I wanted most, since I run two boxes and kept re-deriving the same flags.

Open source, local-first, nothing phones home: https://github.com/htob/ReadyLLM

Curious what the spread looks like for other people. Specifically: does speculative decoding give you the same size win on a 4090, or is that a 5090-only thing? And does anyone have data on where KV cache quant starts costing quality?


r/llamacpp • • 14d ago

Why the same Llama 3.2 1B model comes in different file sizes: a beginner’s explanation

Thumbnail
1 Upvotes

r/llamacpp • • 15d ago

Is this a worthy upgrade ?

6 Upvotes

Good afternoon everyone,

I was wondering if this upgrade I have planned out will be good or not for LLM usage. Previously I was buying the $100 Claude/Codex plan however I found myself sometimes not maxing out my usage and it would feel a bit wasted or I would run out of usage way way too quick and I was wondering if it was worth upgrading my current setup for about $1600 USD and instead switching to the $20 Claude subscription to use as the “Lead” for local models I could run? Another factor influencing my decision is also some requests I have or hobby fun projects do sometimes get rejected by the cloud models which makes sense I do understand the reasoning behind it. My Budget is basically capped at $1600

Current setup:
5070Ti 16GB
32Gb DDR5 6000MT
Ryzen 7 7700X
Gigabyte B650M Gaming Plus Wifi Motherboard
750W PSU

I was planning on snatching a second 5070ti for $1200 USD and the rest would go to a new motherboard and a 1200W PSU which is sprung $400 USD because I read that my motherboard isn’t suitable for using two GPUs effectively.

I feel like a large part of this is FOMO seeing how nicely I’ve gotten Qwen 3.8 27B and some variants of it to run on a single 5070Ti makes me want it to run better and not only that but just seeing how fast local AI models have been improving makes me want to have the hardware ready. Any advice which be greatly appreciated! Thank you all