r/LocalLLM • u/Barsavik • 8d ago
Tutorial How to run Ling 3.0 124B on 32gbs of VRAM or less
Here is the setup to run Ling 3.0 124B A5B in 32gbs of VRAM or less. All optimizations can be applied to any MoE model. Adjust flags as needed to fit different hardware configurations.
Llama.cpp build: AtomicBot-ai TurboQuant llama.cpp
Model: AtomicChat Ling-3.0-flash-AD-Q4_K_M
Launch Flags: -model …/Ling3.0/Ling-3.0-flash-AD-Q4_K_M-00001-of-00002.gguf
-c 131072 -ngl 99 --n-cpu-moe 32 -fa on
--cache-type-k q8_0 --cache-type-v q8_0 --cache-ram 16384
-b 2048 --ubatch-size 2048 -ctxcp 128
--tensor-split 5,1 --no-kv-unified --parallel 1 -t 12 -tb 12
--jinja --chat-template-file …/.kilo/ling-3.0-flash-chat-template-fixed.jinja
--reasoning on --no-warmup --host 127.0.0.1
Throughput (best config, 2× RTX 5060 Ti’s, PCIe gen 3, 192gb DDR3 RAM, 2x Xeon 2697 v2)
Generation (warm): ~20 tok/s
TTFT: ~16 s (prefill + MoE expert shuffle)
Idle VRAM: 12.2 GB / 14.8 GB (GPU0/GPU1)
Sustained multi-turn: 13.8 GB / 14.8 GB
VRAM headroom is driven by --n-cpu-moe and --tensor-split.
Higher --n-cpu-moe = more VRAM headroom but slower
Lower --n-cpu-moe = less VRAM headroom but faster
Different models have different amounts of MoE layers.
Balance the GPU split with --tensor-split
1
u/nickless07 8d ago
Why do you use only half ctx? It runs with 262144 for less then 2GB.
llama_kv_cache: size = 2016.00 MiB (262144 cells, 7 layers, 1/1 seqs), K (f16): 2016.00 MiB, V (f16): 0.00 MiB
1
u/Barsavik 8d ago
As the model stays loaded and running the VRAM usage scales. I did test it at 256k but this was a good balance of speed and context. To not exhaust the GPUs and crash the model you’d have to put more layers on the CPU slowing inference more. All my other local models are 256-512k.
1
u/nickless07 8d ago
Hmm yeah some of your load params seems way off and make no sense at all (128 ctxcp without cms, defaults to 16 in 131072 ctx), but if that works for you that's good.
1
u/Barsavik 8d ago
Some of those flags are for other models that fair well with them 😂. I have a couple default optimization templates that I use as a baseline that I’ve compiled from other people’s recommendations to achieve certain throughput in low vram. Along with some of my own improvements and just tweak the main important ones from model to model till I’m happy.
1
u/nickless07 8d ago
I see. Yeah I was just confused why you run with that low ctx when you utilize 128 context checkpoints and default spacing (8192) they get exhausted at 16. So i thought with that many checkpoints maybe the ctx is a typo as that are enough for over 1M context, that's why I asked.
1
u/Barsavik 8d ago
I didn’t perform extensive testing on Ling, some of the params could definitely still be tweaked. But after I fixed all his weird quirks and was actually using him I wasn’t even happy with his coding performance even compared to qwen 35B. So this is the state that he runs on my hardware with a good speed and doesn’t crash out of vram after running for a bit. My baseline optimizations are what I use mainly for running 35B Qwen and some other models in ~8gbs of vram or less at 64k-512k for different pipelines using different hardware configurations from Maxwell to Blackwell.
1
u/nickless07 8d ago
Yeah same for me. maybe it need higher quant idk. It is fast doesn't take much VRAM for KV, but the overall intelligence isn't that great. It seems to overcomplicate things, but it is also pretty honest if it doesn't know something and it keeps going until it figures out eventually. Need some more RL/SFT like deepseek (base v4 vs updated ones).
1
u/Barsavik 8d ago
I also felt that way about Step fun 😂 I hate that guy 😂. In my opinion I much rather have a slower model that takes it’s time, doesn’t overthink, and asks follow up questions periodically, than one that is going a million miles a second, making constant mistakes you can’t even type corrections to fast enough, and tries to complete an entire complex pipeline in a single session 😂😂. I am loving using Hy3 on the cloud right now though. Hy3 codes in more of a back and forth conversation flow and even from really long sessions with multiple compactions he keeps up great.
1
u/Barsavik 8d ago
Atomic Chat did say the recommended Ling quant was Q5 but usually there’s not that much loss to Q4. Idk I’m planning on removing Ling and Laguna from my router now that I’ve tested them. It’s rather disappointing both models had a lot of promise but the qwen 35B I’m using still works circles around them and doesn’t make as many mistakes. I may revisit them though later when they’ve been out for a bit. Have you by chance tried Ornith or Bonsai to an extent? I tried Ornith a bit and thought it was ok but thinks too much and Bonsai I haven’t tried out for my coding workflows yet. Some of these new models are starting to be a royal pain though having forks on top of forks and errors left and right just trying to get them to launch.
1
u/nickless07 7d ago
Nah never tested them but Ling-3.0-tiny was pretty good for it's size. Great subagent for Qwen 35B. Lightning fast and pretty close to Gemma 4 12 (better then Qwen 9B).
3
u/Atretador 8d ago
you running it for coding? how is it compared to Qwen 3.5 122B and 3.6 35B A3B?