Comment by hypfer

2 days ago

Since it might be helpful to some, here's my current commandline for llama.cpp running on an RTX 4090 with my monitor moved to the iGPU to free up all of its VRAM.

llama-server -m Qwen3.8-27B-IQ4_NL.gguf --mmproj mmproj-BF16.gguf -c 170000 --parallel 1 -ngl -1 --cache-type-k q8_0 --cache-type-v q8_0 -b 1024 -ub 512 --flash-attn on --no-context-shift --no-mmproj-offload --spec-type draft-mtp --spec-draft-n-max 5 --spec-default --cache-type-k-draft q4_0 --cache-type-v-draft q4_0 --threads 24 --jinja --reasoning on -fit off

Identical to the qwen3.6 config. With a prompt like "svg owl" (which can reuse quite a lot compared with creative writing or similar, so ngram-mod shines), I get about 70-80t/s like this, with a memory overclock of about 1.5GHz

> --cache-type-k q8_0 --cache-type-v q8_0

In my tests, even Q8 quantization for the KV cache comes with notable drops in performance for longer tasks. It does provide more context length in limited RAM budgets, but the longer context tasks are where KV quantization starts to show problems. It’s basically unnoticeable for simple and short tasks.

> --spec-draft-n-max 5

5 is a lot of tokens to draft. Are you really seeing acceptance rates to support that? When I tested it, 2-3 was the peak. Anything more started reducing performance except on highly predictable short outputs.

  • Yes to both.

    The thing is that I can either use the q8 context, or have not enough context window, so I just live with whatever degradation there is. The same can be said about the IQ4_NL. I would not go any lower though.

    As for the draft count, indeed that depends on what you do with it, but for coding, reverse engineering and that kind of stuff it does pay off in my testing, though 5 is really pushing it, but the 4090 has so much compute.

    Last logline I saw scroll by right now had 47% acceptance rate for 4th and 28% for 5th, but not sure how representative that is. I think when tuning 3.6, I saw more like 33%? But not 100% sure.

  • Okay, so, I did some actual coding with qwen3.8 in the last 2 hours, and if I (let the agent) take the average of all those "mean len" loglines, and let them get weighted by how much happened leading up to that logline, it's an average of 3.33

    The unweighted average is 4.1

    So with qwen3.8 as well, I think I would not go below 3 in this setup with this workload. Meaning 4, and, to push it a bit further, 5.

    Also, cool that it carries over from qwen3.6 like that.

  • I have found that q8 kv quantisation is really bad in anything requiring some kind of literal retrieval even at relatively shorter contexts (5-10k). Eg it would mess up names, titles of papers etc that were deeper in the context.

To add for me (and claude assisted but tuned myself), here is for 3060 12gb + 5950x 128 gb ram without image support: https://pastebin.com/HsAUBGSY

Here is the chat template I used (and renamed to qwen.jinja): https://huggingface.co/froggeric/Qwen-Fixed-Chat-Templates/r...

For image support, drop to NGL 24 and add:

  --mmproj-url https://huggingface.co/unsloth/Qwen3.8-27B-GGUF/resolve/main/mmproj-F16.gguf \

  --no-mmproj-offload \

  --image-min-tokens 1024 \

And drop the --no-mmproj

  • Thanks for this! I got the same card, but not the same CPU nor RAM, but this is a great starting point to start tweaking

  • How many tokens/second you getting? I have the same CPU but a 5070 and only 64 GB of ram. I just got llama.cpp built and am now hitting a whopping 5-6 tokens/s.

I absolutely love this comment. I wished there was a website where people would post their working command lines as well as what hardware they are using to run that stuff on + tokens / sec prefill + gen.

  • Problem with that is I think that it quickly devolves into cargo culting, nonsense and noise.

    Arguably, what I am doing is also very very close to that, with the only difference being that I am somewhat less of an idiot than the average internet dweller you'd get on such a site. Or rather a different flavor of idiot.

    Ideally, the people building the tools build them in a way that just does the right thing - which I am confident that llama.cpp does or will do in the future.

    So you encode that knowledge not in language and online comments but in code and with a filter for actual expertise.

    And, frankly, there's really not all that much to it. It's like maybe 3 parameters to play around with.

    The valid solution space is pretty small, but people will want to make it "theirs" regardless, so you get non-solutions just so that everyone could also be a part of it. The usual social dynamics foo.

    • I've found that once you factor in multiple GPUs things can get complex quite quickly because the default packing routine in the LLM runners tends to be very coarse resulting in substantial amounts of VRAM wasted. More so if you start running drafters and multiple models at the same time.

      Let me return the favor:

      Deepseek V4 Flash 0731 Q8

      This is on a 4x3090 box with 256G RAM and a 5955WX TR; the CUDA drivers are patched to allow the 3090's to talk to each other. MB is a WRX80E-SAGE (which has 7 slots at x16), BAR > 4G on and PCIe BAR resize set to AUTO in the bios. OS is Ubuntu 25.04.

      GGML_CUDA_P2P=1 build/bin/llama-server -m ../DeepSeek-V4-Flash-0731-UD-Q8_K_XL-00001-of-00005.gguf --alias DeepSeek-V4-Flash --threads 32 --threads-batch 64 --cache-type-k f16 --cache-type-v f16 --metrics --cache-ram 0 --load-mode none --fit on --fit-ctx 1000000 --host 0.0.0.0 -fa on --top-p 0.95 --temp 0.7 --repeat-penalty 1.2 --jinja --tensor-split 1,.8,.1,.15 --cont-batching -b 4096 -ub 4096 -ncmoe 36 --parallel 1 -ot 'blk\.3[67]\.ffn_(gate|up|down)_exps=CPU'

      I'm still working on an optimal packing for the draft variation on this theme but that gives all kinds of issues. The 1,000,000 context is very nice to have.

      1 reply →

  • As a MBP and DGX spark owner, I would love such a site... (Feel like it would be a low effort feature of hugging face).

    Searching through Reddit and forums for best commands is annoying.

Here's my model.ini for 4090 (using the chat template from froggeric):

version = 1

[*] ; Global defaults shared across all presets

threads = 16

[Qwen3.8-27B]

; Model files

model = ..\Qwen3.8-27B-FP8\Qwen3.8-27B-UD-Q4_K_XL.gguf

mmproj = ..\Qwen3.8-27B-FP8\mmproj-BF16.gguf

; Context & compute

ctx-size = 114688

parallel = 1

n-gpu-layers = -1

batch-size = 1024

ubatch-size = 512

flash-attn = on

cache-type-k = q8_0

cache-type-v = q8_0

; Speculative decoding (MTP draft)

spec-default = true

spec-type = draft-mtp

spec-draft-n-max = 5

cache-type-k-draft = q4_0

cache-type-v-draft = q4_0

; Multimodal

no-mmproj-offload = true

; Context behavior

no-context-shift = true

; Chat template & reasoning

jinja = true

reasoning = on

chat-template-kwargs = {"preserve_thinking":"true","reasoning_effort":"medium"}

; Sampling

temp = 1.0

top-n-sigma = 1

top-k = 0

top-p = 1.0

presence-penalty = 0.0

repeat-penalty = 1.0

fit = off

; Auto-load this model when the server starts

load-on-startup = true

I can get 128k context on a 5070ti with 16 GB of VRAM (using the Unsloth 2-bit quant[0]). This is via a .bat file on Windows 11. I'm getting about 50-60 tokens/second and the quality is much higher than Qwen 3.6 27B. I'm using llama.cpp[1]:

    llama-server.exe ^
        -m "Qwen3.8-27B-UD-Q2_K_XL.gguf" ^
        --presence-penalty 0.0 ^
        --repeat-penalty 1.0 ^
        --fit-ctx 128000 ^
        -ctk q4 0 ^
        -ctv q4 0 ^
        --reasoning-budget -1 ^
        --chat-template-kwargs "{\"preserve thinking\": true}" ^
        --host 0.0.0.0 ^
        --port 8033

[0] https://huggingface.co/unsloth/Qwen3.8-27B-GGUF (UD-Q2_K_XL)

[1] https://github.com/ggml-org/llama.cpp/releases

Instructions if you want to do the same:

1. download two files llama-b10434-bin-win-cuda-13.3-x64.zip and cudart-llama-bin-win-cuda-13.3-x64.zip from that llama.cpp Github releases page, and extract both into the same folder.

2. Download the Qwen3.8-27B-UD-Q2_K_XL.gguf file from huggingface and put it into the same folder beside the `llama-server.exe`.

3. Create a file named "RUN_QWEN_3.8.bat" next to `llama-server.exe` and put the text above into that bat file. Double-click the bat file, then open http://localhost:8033 in your browser to see a chat window.

You can use it with any agents by pointing them at http://localhost:8033/v1 which is a working OpenAI compatible endpoint (it doesn't use a token, if you give one it's ignored).

Congratulations, you're now running Qwen 3.8 27B.

Note: I built the computer in question for playing games, yes it needed to be Windows 11 for anticheat reasons to play games with family, I didn't want to dual boot so here I am. I figure I should share instructions for folks who may also have a Windows PC around for such purposes. Specs for this are AMD 9800X3D, 32GB of system RAM, RTX 5070Ti 16GB

Thanks for posting! Have you had any success with running without kv cache quantization? Is there a noticeable difference in quality without any? I would assume that would eat into context but 170k is pretty generous!

  • According to this shitty vibecoded thing "I" built https://hypfer.github.io/will-it-fit-llama-cpp/ (and I guess according to math too), FP16 K/V would give me something like 90k context at the same model quant, which doesn't really fit my usage.

    But maybe someone else has experience to share there

    • just to clarify. yes YOU built it. just because you used some tool doesn't mean the idea, prompting, reprompting, babysitting was not your creative input and effort.

      put differently, if you put a random person infront of whatever model you used (say, a 50yo receptionist at a pharmacy in india), they would not have been able to create that, because they would have lacked the motivation, idea, background knowledge, taste, etc to create such a thing.

      38 replies →

Hm, I have a 4090 as well, and:

$ build/bin/llama-server -m Qwen3.8-27B-IQ4_NL.gguf --mmproj mmproj-BF16.gguf -c 170000 --parallel 1 -ngl -1 --cache-type-k q8_0 --cache-type-v q8_0 -b 1024 -ub 512 --flash-attn on --no-context-shift --no-mmproj-offload --spec-type draft-mtp --spec-draft-n-max 5 --spec-default --cache-type-k-draft q4_0 --cache-type-v-draft q4_0 --threads 24 --jinja --reasoning on -fit off

0.02.993.689 E ggml_backend_cuda_buffer_type_alloc_buffer: allocating 911.53 MiB on device 0: cudaMalloc failed: out of memory

Update: Oh, it works after I stop Xorg. But nvidia-smi only showed Xorg using 200M out of the 24G, so why would a 911M alloc fail?

  • The person above is running the OS from a separate GPU, so the command can use all of the VRAM of the 4090.

    If you're trying to use the 4090 for your desktop at the same time, you will need smaller context size. You could remove the '-c 170000' and try turning fit on to see what fits.

  • >But nvidia-smi only showed Xorg using 200M out of the 24G, so why would a 911M alloc fail?

    That was just the last buffer allocation request that failed, it didn't tell you by how much it failed by. It could have failed it by a few kilobytes, it could have failed it by 910MB. One would guess it probably failed it by a couple hundred megabytes in the end judging by your results.

  • There has to be a better way of sharing config , a profile of sorts you can upload and share

    • Yes, llama.cpp supports presets (an ini format). Though it's not always clear which llama-server flags it does not support.

Does anyone know how to get this working with Claude Code via llama-server? I'm getting a jinja template error about the system prompt not being the first message.

Have you tried to put the nvidia card into "compute-only mode" since you're not using it for display?

Any chance I could run it on a GeForce RTX 5060 Ti 16 GB, (64 gb ram)

  • You could run the 2-bit quantization at about 10GB for the weights. You'd probably also need to quantize context to get a decent-sized context. The Unsloth model card shows the 1-bit quantization doing seemingly shockingly well on a task (but there is notable loss in model quality for each bit you give up below about 6 bits). An MoE model can partially reside in system RAM without catastrophic performance loss, but a dense model like this one cannot. You have to run it entirely out of VRAM, or it'll slow to a crawl.

  • Yes. It won't be as fast as fitting the whole model into VRAM but llama.cpp defaults are pretty smart about GPU/CPU splits these days. Just YOLO it with `llama serve -hf unsloth/Qwen3.8-27B-GGUF:UD-Q4_K_XL` and it'll definitely at least run.

  • You may be able to run a quantized version. One strategy I've found effective is to set Claude or Codex loose on the problem and they'll do a decent job setting up the best possible model revision.

Jeez, llama.c++ is becoming the ffmpeg cargo cult CLI now

  • For the things it does, what tool is better than ffmpeg? Really struggling to see the cargo cult angle. Similar for llama.cpp, as it is literally the only framework I can get to run on my multi-Radeon rig. It is the most portable runtime out there.

Do you find it useful or worthwhile to split a large LLM across two GPUs on a desktop?

If you've tried it, what worked well and what didn't? I'm especially interested in mismatched VRAM setups, e.g. a 16 GB GPU + a 24 GB GPU.

How much overhead did you see from inter-GPU transfers, and did the extra usable VRAM outweigh the performance hit?

  • It depends on what model you’re running, and for what workload. For personal use (one or two convos at a time) with models that fit in gpu memory, pcie bandwidth doesn't really matter. Just try and be on gen 3 x8 or higher.

    Llama is decent at auto optimizing it if you let it use both gpus. It’ll split the workload so the contiguous layers are all on one gpu. Once the model is loaded, you only transfer weights between gpus once (per token?), at the layer boundary.

    I run on an 8gb 3070 and 12 gb 3060, and the only weird thing is that the weaker card gets more layers (and therefore work) because it has more ram.

    Oh, if you’re barely fitting the models into your vram, you may need to explicitly adjust the layer balance between cards — sometimes it fails to realize it should have put certain things (like draft models) on the other card so you can fit one more layer in.

  • A hetero-GPU setup is definitely cost-effective if you don't strictly require the raw speed of a top-tier card like 5090. Just keep in mind that the total throughput will also be bottlenecked by the slower card.

    To provide some anecdotal data, here is how my 5090 + 3060 setup performs with Qwen 3.8 27B (Unsloth's UD-Q4 with MTP):

      Single 5090: 101 t/s (TG), 2650 t/s (PP)
      5090 + 3060: 53 t/s (TG), 1700 t/s (PP)
    

    For reference, here are also some numbers from my 4060ti + 3060 (16GB + 12GB) setup. [0]

    [0]: https://news.ycombinator.com/item?id=48700091

  • As opposed to loading it up in RAM + VRAM? Pretty much always better to split it up to multiple GPUs. My priorities are load up all available VRAM, then offload MoE experts to RAM (if possible), then offload other layers.

    I use an RTX 3090 (24GB) and a GTX 1080ti (11GB). Just the 3090 for 3.8 I get maybe 60tg/s (UD-Q4 quant), for both I get around 40tg/s (UD-Q6). Not apples to apples though considering it's different quants.

    Here's my config: https://gitea.va.reichard.io/evan/nix/src/branch/master/modu...

  • Yes. I can split a model like this across 3 GPUs (a 1080 with 8GB and two Titan Vs with 12GB), and it's much faster than running it on 36 CPU cores. As long as it fits in aggregate VRAM, it seems very advantageous to do so.

  • Depends on your pcie connection. If they're both x16 then it's pretty low overhead, x8 is ok, but x4 is too slow. Also it's a bit tricky getting an optimal setups with mismatched vram, I think you could probably still make use of the full vram if you're clever but it's trickier.

    • for layer parallelism (e.g. to get more vram) the bandwidth between layers is essentially nothing (like 16kb per token I think), so I don't think x4 would even be a problem!

      1 reply →

  • I haven't tried this either but I'm guessing if you could pool the GPU memory over whatever the kids are using these days, I think it was SLI back in my day. The GPU memory should still be faster than the RAM?

    • Unfortunately I checked, SLI doesnt work for this situation. Because the program loading the LLM uses CUDA library, which doesnt account for/takes advantage of SLI for this purpose at least.

Lol at that command. Why is this stuff so hard to run locally? I've spent a few days trying to figure it all out and haven't been able to. LM Studio doesn't work behind proxies. Ollama is confusing and doesn't seem to support Qwen3? And Llama.cpp is your command.

I just want to run `<some-command> <model-name>` with some default parameters set and for it to run locally.

  • What makes you say that it would be hard to do that?

    It's long, I guess, but not cryptic.

    You tell llama server where the model is, which context size to use, what to use for the K/V cache quant, that it should do MTP, tune some MTP parameters, and that's kinda it.

    Perfectly logical blocks with all the model-specific weirdness (that does exist!) abstracted away.

    You could also just run -m <modelfile> and let llama-server do the right-ish thing. The defaults are probably fine, but not how you squeeze out these exact numbers. I think at least. I've never tried. My hubris stopped me from trying auto configs.

    • > llama server where the model is, which context size to use, what to use for the K/V cache quant, that it should do MTP, tune some MTP parameters, and that's kinda it.

      isn't that the hard part? You know the ballpark ideal values for these many parameters since you're a knowledgeable expert but the vast majority of people are just like "I want AI" and have no idea what all the jargon even means.

      7 replies →

  • Well there's a lot of knobs to turn if you want to improve performance. You can always point an LLM at the model card, give it your info, and have it write up the command.

    • Sure, but shouldn’t the programs to run the LLMs go “the user has this much vram and the model is this size, so I’ll start with sensible defaults based on that”?

      You could override, obviously.

      1 reply →

  • I'll actually defend you on this one, but not only the command, that's more of a fine tuning option. On the hugging face link for example, there's no flat 'download' area. It's completely unintuitive for people to know how to use it. Reminds me of my first time trying to make sense of torrents when they first arrived.

    There are some clients that will index the models and allow you to do that but I'm no expert, I've used OLama studio but it always seems to go weird for me.

    Even this command above, it's not clear where op got the model from. So I'm with yah.

    For example, op uses : Qwen3.8-27B-IQ4_NL.gguf.. But I cant see where to download it. It's not tagged on hugging face at least..

    • Official llama.cpp releases ship with huggingface support. If you don't want to download it yourself, you can just use the `repo/model:quant` convention and it will handle downloading locally for you.

      11 replies →

  • If you do not want to tweak parameters you can just run

        llama-server -m model.gguf
    

    That's it

  • Start by copying the command line from the Unsloth guides.

    You don’t need to fine tune all of those parameters to get started.

    It’s really easy to ask an LLM to adjust the command line if you can’t be bothered to read the help out. Copy the help output into the LLM and tell it your goal.

    > Ollama is confusing and doesn't seem to support Qwen3?

    Typing “Ollama qwen3” into Google takes you right to this page:

    https://ollama.com/library/qwen3

    If even Googling for basic Ollama support is too hard, there might come a point where you have to acknowledge that local LLMs are not for you. None of this is really that hard with some basic Google bootstrap skills or by asking an LLM to help with the command.

    • I had seen this:

      > Attention: To be updated for Qwen3

      on Qwen's official docs: https://qwen.readthedocs.io/en/latest/run_locally/ollama.htm.... It's not like I just made it up. Of course I searched "ollama qwen3" and saw what you linked, but that doesn't mean it "works". I have other things to do besides to try a bunch of poorly documented and executed tools just to see if it works or not.

      I guess the TLDR is that I'm stupid or lazy. Also, everyone is responding about how easy it is, and yet, it's apparently so easy that it's hard to document well.

  • There are easier ways to run it. OP seemed to enjoy tinkering and customizing the command to run it exactly the way they want. When I don’t want to tinker Unsloth Studio is probably closest to pick a model and voila.

  • I never install this stuff manually anymore. Just tell your LLM of choice to download model X from URL Y, build the latest inference engine of choice E, and then create batch files or shell scripts to run instruct and/or reasoning models in accordance with instructions at URL Z.

    • While you probably have the audacity to check the commands and code that your favorite LLM generates to complete this task, i'm pretty much certain that at some point in time, due to this pervasive mindset of "just let an AI agent do it," we'll have a front page news story of someone who had their family photos on their NAS uploaded to some public space, their security cameras connected to a "live porn for lolz" webring, and perhaps even their crypto wallets and bank accounts pilfered, all because their favorite LLM got exploited by some prompt injection attack while trying to be helpful doing system administration tasks.

      I remember there was a short story in BYTE Magazine about a similar kind of scenario way back when, I think at least 30 years ago, long before LLMs and AI agents became a reality.

      1 reply →

    • Promise I'm not being flippant or rude, but why not ask it to write something like a parameterized script to do the same thing for you ?

      4 replies →

  • You know free LLMs can help you understand that command line or design your own...

  • > LM Studio doesn't work behind proxies.

    Woa, is that still a thing? You mean like SOCKS5 stuff that you have to manually configure in every application that uses the internet?

    I mean maybe I'm just living under a rock but I feel like that's a rather niche situation you got there.

    • > I feel like that's a rather niche situation you got there

      Every big company in the world uses a network proxy. LM Studio, as far as I can tell, cannot be configured to work behind such proxies.

      5 replies →