My configuration for Q4_K, 12GB VRAM, 32GB RAM

#6
by rusinni - opened

I wanted to share the configuration I use to run the model as efficiently as possible on my hardware using llama.cpp. I've gradually fine-tuned these settings through trial and error.

Reducing the buffer sizes and context length and fitting everything into VRAM would make the model run slightly faster, but I prefer being able to have longer conversations.

My hardware specs are:

  • GPU: RTX 3060 (12GB VRAM)
  • RAM: 32GB DDR4 3200MHz
  • CPU: Intel Core i5-11400F (6 cores, 12 threads)

There's probably still room for improvement, but with my current level of knowledge, I haven't been able to optimize it any further. If anyone has any suggestions, I'd love to hear them.

The only issue I've run into is that I can't increase the context length any further because I run out of VRAM, even though I load it in RAM and still have plenty of it available.

                        ================================

./build/bin/llama-server -m ./models/Inkling-2-mini-Uncensored/Inkling-2-Mini-Uncensored-AD-Q4_K.gguf -md ./models/Inkling-2-mini-Uncensored/dspark-Inkling-2-Mini-Q8_0.gguf --mmproj ./models/Inkling-2-mini-Uncensored/mmproj-Inkling-2-Mini-Uncensored-F16.gguf --no-mmproj-offload -ngl 99 -ngld 99 -ot 'blk.([0-5]|1[89]|2[0-3]).ffn_.*_exps=CPU' --spec-type draft-dspark --spec-draft-n-max 3 --spec-draft-n-ubatch 128 -b 512 -ub 256 -t 6 -tb 6 -fa on -nkvo -c 48000 -ctk f16 -ctv f16 -np 1 --fit off --jinja --load-mode none --temp 0.6 --top-p 0.95 --top-k 0 --min-p 0.0 --dry-multiplier 0.3 --dry-base 1.75 --dry-allowed-length 6 --dry-penalty-last-n 1024 --cache-ram 0 --slots --slot-save-path ~/slots-llama/ --host 0.0.0.0 --port 5555

                        ================================

I am having around 220 t/s prefill - 19 t/s decode

Atomic Chat org

Thanks for sharing your setup! We have released smaller quants recently, so those might be worth experimenting with if longer context is your priority.

I would be very interested to hear your feedback

I've been testing the IQ4_XS quantization, and I'll share the two commands I'll be using: one optimized for high speed and the other for a large context window. I'm not using smaller quantizations because I prioritize intelligence over speed.

Interestingly, storing the context in RAM consumes more VRAM than keeping it entirely in VRAM, so I decided to offload only the mmproj and some of the model's layers to RAM.

I'm also not using a draft model because it doesn't improve decoding speed in my setup, so I'd rather use that extra space for the context and model layers.

===========================================================================
Large Context | 185K in VRAM | FFN experts of layers 6-17 in VRAM | prefill: 173 t/s | decode: 34 t/s

./build/bin/llama-server -m ./models/Inkling-2-mini-Uncensored/Inkling-2-Mini-Uncensored-AD-IQ4_XS.gguf --mmproj ./models/Inkling-2-mini-Uncensored/mmproj-Inkling-2-Mini-Uncensored-F16.gguf --no-mmproj-offload -ngl 99 -ot 'blk.([0-5]|1[89]|2[0-3]).ffn_.*_exps=CPU' --no-op-offload -b 2048 -ub 128 -fa on -c 185000 -ctk q8_0 -ctv q8_0 -np 1 --fit off --jinja --no-reasoning-preserve --reasoning-effort high --temp 0.6 --top-p 0.95 --top-k 0 --min-p 0.0 --dry-multiplier 0.3 --dry-base 1.75 --dry-allowed-length 6 --dry-penalty-last-n 1024 --cache-ram 0 --slots --slot-save-path ~/slots-llama/ --host 0.0.0.0 --port 5555

===========================================================================
High Speed | 32K in VRAM | FFN experts of layers 0-17 in VRAM | prefill: 302 t/s | decode: 39'8 t/s

./build/bin/llama-server -m ./models/Inkling-2-mini-Uncensored/Inkling-2-Mini-Uncensored-AD-IQ4_XS.gguf --mmproj ./models/Inkling-2-mini-Uncensored/mmproj-Inkling-2-Mini-Uncensored-F16.gguf --no-mmproj-offload -ngl 99 -ot 'blk.(1[89]|2[0-3]).ffn_.*_exps=CPU' --no-op-offload -b 2048 -ub 336 -fa on -c 32000 -ctk q8_0 -ctv q8_0 -np 1 --fit off --jinja --no-reasoning-preserve --reasoning-effort high --temp 0.6 --top-p 0.95 --top-k 0 --min-p 0.0 --dry-multiplier 0.3 --dry-base 1.75 --dry-allowed-length 6 --dry-penalty-last-n 1024 --cache-ram 0 --slots --slot-save-path ~/slots-llama/ --host 0.0.0.0 --port 5555

You can adjust the "-ub" parameter to find the right balance between prefill speed and context size. Increasing it can improve prefill speed, but it also increases the buffer size, leaving less VRAM available for the context.

You can also experiment with offloading a different number of layers to VRAM. In my tests, offloading the last 6 layers resulted in slightly lower performance than offloading the first 6 layers.

Atomic Chat org

Thanks, @rusinni ! We tested your expert placement settings on an NVIDIA A10 and added both presets to the model card, with credit to you and a link to this thread. With a 32K window, your settings saved 3.1 GiB of VRAM while decode went from 44.1 to 39.3 tok/s on a 2,048-token prompt. We also tried the 185K preset with 180,000 actual input tokens: it processed the full prompt and generated at 19.2 tok/s. Thanks for sharing the exact commands

Tried all of this on Q4_K - 8t/s decoding max. Same hardware exept ram 96Gb

Tried all of this on Q4_K - 8t/s decoding max. Same hardware exept ram 96Gb

Maybe the llama.cpp version or the way llama.cpp was compiled differ.

I use this prompt for my tests:


A community library receives 120 used books. Of these, 40% are novels, 30% are science books, and the rest are history books. During the first week, it lends out 18 novels, 12 science books, and 9 history books. Then a donation adds 15 books: 6 novels, 5 science books, and 4 history books.

Write a response in Spanish that does the following:

  • Calculate how many books of each category there were initially.
  • State how many books in each category are on loan and how many are available after the first week, before the new donation.
  • Update the number of available books after the donation.
  • Check that the totals add up, and briefly explain any assumptions needed.
  • Suggest a simple way to organize the books so users can find them easily.

Show the calculations clearly, without omitting important steps. If you notice any ambiguity, point it out and explain how it affects the result rather than making up information. Keep the response brief, and distinguish between books on loan and books available.


Get max 20-25 t/s on q4k, results in coding not impressive... Gemma4 26B with 70-80t/s produce much more quality result

Sign up or log in to comment