News for hackers. Stuff that matters.
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Tuesday July 22, 2025 @06:40PM (#44653836)
I'm currently making 2bit to 8bit GGUFs for local deployment! Will be up in an hour or so at https://huggingface.co/unsloth/Qwen3-Coder-480B-A35B-Instruc...

Also docs on running it in a 24GB GPU + 128 to 256GB of RAM here: https://docs.unsloth.ai/basics/qwen3-coder

Re:Qwen3-Coder: Agentic coding in the world by mathrawka on Tuesday July 22, 2025 @06:53PM (#44653943)
Looks like the docs have a typo:

    Recommended context: 65,536 tokens (can be increased)
That should be recommended token output, as shown in the official docs as:

    Adequate Output Length: We recommend using an output length of 65,536 tokens for most queries, which is adequate for instruct models.
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Tuesday July 22, 2025 @07:02PM (#44654010)
Oh thanks - so the output can be any length you like - I'm actually also making 1 million context length GGUFs as well! https://huggingface.co/unsloth/Qwen3-Coder-480B-A35B-Instruc...
Re:Qwen3-Coder: Agentic coding in the world by sgammon on Tuesday July 22, 2025 @09:05PM (#44654724)
Cool, thanks! I'd like to try it
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Tuesday July 22, 2025 @09:43PM (#44654959)
It just got uploaded! I made some docs as well on how to run it at https://docs.unsloth.ai/basics/qwen3-coder
Re:Qwen3-Coder: Agentic coding in the world by jdright on Tuesday July 22, 2025 @10:36PM (#44655236)
Any idea if there is a way to run on 256gb ram + 16gb vram with usable performance, even if barely?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Tuesday July 22, 2025 @10:53PM (#44655324)
Yes! 3bit maybe 4bit can also fit! llama.cpp has MoE offloading so your GPU holds the active experts and non MoE layers, thus you only need 16GB to 24GB of VRAM! I wrote about how to do in this section: https://docs.unsloth.ai/basics/qwen3-coder#improving-generat...
Re:Qwen3-Coder: Agentic coding in the world by jdright on Wednesday July 23, 2025 @08:32AM (#44658490)
awesome documentation, I'll try this. thank you!
Re:Qwen3-Coder: Agentic coding in the world by andai on Tuesday July 22, 2025 @11:24PM (#44655456)
I've been reading about your dynamic quants, very cool. Does your library let me produce these, or only run them? I'm new to this stuff.
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @12:27AM (#44655726)
Thank you! Oh currently not sadly - we might publish some stuff on it in the future!
Re:Qwen3-Coder: Agentic coding in the world by Jayakumark on Tuesday July 22, 2025 @11:31PM (#44655489)
What will be the approx token/s prompt processing and generation speed with this setup on RTX 4090?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @12:53AM (#44655816)
I also just made IQ1_M which needs 160GB! If you have 160-24 = 136 ish of RAM as well, then you should get 3 tokens to 5 ish per second.

If you don't have enough RAM, then < 1 token / s

Re:Qwen3-Coder: Agentic coding in the world by Abishek_Muthian on Wednesday July 23, 2025 @12:24AM (#44655711)
Thank you for your work, does the Qwen3-Coder offer significant advantage over Qwen2.5-coder for non-agentic tasks like just plain autocomplete and chat?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @12:26AM (#44655722)
Oh it should be better, especially since the model was specifically designed for coding tasks! You can disable the tool calling parts of the model!
Re:Qwen3-Coder: Agentic coding in the world by babuloseo on Wednesday July 23, 2025 @01:00AM (#44655849)
hello sir
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @01:04AM (#44655865)
hi!
Re:Qwen3-Coder: Agentic coding in the world by gnulinux on Wednesday July 23, 2025 @01:45AM (#44656039)
Do 2bit quantizations really work? All the ones I've seen/tried were completely broken even when 4bit+ quantizations worked perfectly. Even if it works for these extremely large models, is it really much better than using something slightly smaller on 4 or 5 bit quant?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @01:52AM (#44656068)
Oh the Unsloth dynamic ones are not 2bit at all - it's a mixture of 2, 3, 4, 5, 6 and sometimes 8bit.

Important layers are in 8bit, 6bit. Less important ones are left in 2bit! I talk more about it here: https://docs.unsloth.ai/basics/unsloth-dynamic-2.0-ggufs

Re:Qwen3-Coder: Agentic coding in the world by blensor on Wednesday July 23, 2025 @03:52AM (#44656749)
Not an AI researcher here so this is probably common knowledge for people in this field, but I saw a video about the quantization recently and wondered exactly about that, if it's possible to compress a net by using more precision where it counts and less precision where it's not important. And also wondered how one would go about deciding which parts count and which don't

Great to know that this is already a thing and I assume model "compression" is going to be the next hot topic

Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @05:24AM (#44657238)
Yes you're exactly thinking correctly! We shouldn't quantize a model naively to 2bit or 4bit, but we should do it smartly!
Re:Qwen3-Coder: Agentic coding in the world by qxfys on Wednesday July 23, 2025 @10:25AM (#44659587)
How do you pick which one should be 2, which one should be 4, etc. Is this secret sauce? or, something open?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Thursday July 24, 2025 @06:42PM (#44677203)
Oh I wrote about it here: https://docs.unsloth.ai/basics/unsloth-dynamic-2.0-ggufs We might provide some scripts for them in the future!
Re:Qwen3-Coder: Agentic coding in the world by qxfys on Friday July 25, 2025 @03:55AM (#44680761)
Thanks! But, I can't find any details on how you "intelligently adjust quantization for every possible layer" from that page. I assume this is a secret?

I am wondering about the possibility that different use cases might require different "intelligent quantization", i.e., quantization for LLM for financial analysis might be different from LLM for code generation. I am currently doing a postdoc in this. Interested in doing research together?

Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Friday July 25, 2025 @07:39AM (#44682038)
Oh we haven't yet published about it yet! I talk about in bits and pieces - we might do a larger blog on it!

Yes different use cases will be different - oh interesting! Sorry I doubt I can be of much in our research - I'm mainly an engineering guy so less research focused!

Re:Qwen3-Coder: Agentic coding in the world by CMCDragonkai on Wednesday July 23, 2025 @02:02AM (#44656106)
How do you decide which layers are the important ones?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @02:34AM (#44656287)
I wrote approximately in the blog about it and linked some papers! I also wrote about it here - https://unsloth.ai/blog/dynamic-4bit - one has to inspect the activation and weight quantization errors!
Re:Qwen3-Coder: Agentic coding in the world by blensor on Wednesday July 23, 2025 @11:25AM (#44660281)
So you are basically looking at "fMRI" of the "brain" while it's doing a wide range of things and cutting out the things that stay dark the most?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @07:26PM (#44665136)
Oh that's a good analogy! Yes that sounds right!
Re:Qwen3-Coder: Agentic coding in the world by menaerus on Wednesday July 23, 2025 @04:50AM (#44657038)
> The key reason to use Unsloth quants is because of our deep involvement in fixing critical bugs across major models

sounds convincing, eh ... /s

On the less cynical note, approach does look interesting but I'd also like to understand how and why does it work, if it works at all.

Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @05:26AM (#44657249)
Oh we actually fixed bugs! We fixed a few bugs in Gemma - see https://news.ycombinator.com/item?id=39671146, a gradient accumulation bug see https://news.ycombinator.com/item?id=41859037, Phi bugs, Llama bugs and more! See https://unsloth.ai/blog/reintroducing for more details!
Re:Qwen3-Coder: Agentic coding in the world by menaerus on Wednesday July 23, 2025 @05:32AM (#44657286)
What does your approach with dynamics weights has to do with those bugs? All those bugs seem uncorrelated to the technique.
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @06:22AM (#44657554)
Oh apologies I got confused - it's because when we calculate our dynamic quants, we have to do it on the fixed model!

For example in Phi 3 for example, the end of sentence token was wrong - if we use this, then our quants would be calibrated incorrectly, since chatting with the model will use the actual correct token.

Another is Llama 4 - https://github.com/ggml-org/llama.cpp/pull/12889 in which I fixed a RoPE issue - if we didn't fix it first, then again the calibration process would be incorrect.

Re:Qwen3-Coder: Agentic coding in the world by menaerus on Wednesday July 23, 2025 @07:29AM (#44657975)
Ok, this then goes to say that your approach doesn't work without applying whatever fixes to the vanilla models. What I'm trying to understand is the approach itself. Why does it and how does it work?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @09:27AM (#44659023)
Re:Qwen3-Coder: Agentic coding in the world by PeterStuer on Wednesday July 23, 2025 @04:58AM (#44657079)
If you don't mind divulging, what resources and time did it take to dynamically quantize Qwen3-Coder?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @05:24AM (#44657228)
It takes a few hours to compute the imatrix on some calibration dataset since we use more than 1-3 million tokens of high quality data. Then we have to decide on which layers to quantize to higher bits or not, which takes more time. And the quantization creation also takes some hours. Uploading also takes some time as well! Overall 8 hours maybe minimum?
Re:Qwen3-Coder: Agentic coding in the world by jychang on Wednesday July 23, 2025 @06:47AM (#44657704)
What cluster do you have to do the quantizing? I'm guessing you're not using a single machine with a 3090 in your garage.
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @09:28AM (#44659028)
Oh definitely not! I use some spot cloud instances!
Re:Qwen3-Coder: Agentic coding in the world by sleight42 on Wednesday July 23, 2025 @05:02PM (#44664014)
But you can get one of these quantized models to run effectively on a 3090?

If so, I'd love detailed instructions.

The guide you posted earlier goes over my (and likely many others') head!

Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @07:27PM (#44665143)
Oh yes definitely! Oh wait is the guide too long / wordy? This section https://docs.unsloth.ai/basics/qwen3-coder-how-to-run-locall... shows how to run it on a 3090
Re:Qwen3-Coder: Agentic coding in the world by sleight42 on Thursday July 24, 2025 @06:06PM (#44676889)
Kind of you to respond! Thanks!

I have pretty bad ADHD. And I've only run locally using kobold; dilettante at DIY AI.

So, yeah, I'm a bit lost in it.

Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Thursday July 24, 2025 @06:45PM (#44677223)
Oh sorry - for Kobold - I think it uses llama.cpp behind the hood? I think Kobold has some guides on using custom GGUFs
Re:Qwen3-Coder: Agentic coding in the world by tomdekan on Thursday July 24, 2025 @07:31AM (#44669472)
Thanks Daniel. Do you recommend any resources showing the differences between different quantizations?
Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Thursday July 24, 2025 @06:43PM (#44677213)
Oh our blog https://docs.unsloth.ai/basics/unsloth-dynamic-2.0-ggufs compares the accuracy differences for each different quantization method for Llama 4 Scout and also Gemma 3 27B - they should apply to other quants (like Qwen 3 Coder)
Re:Qwen3-Coder: Agentic coding in the world by PeterStuer on Wednesday July 23, 2025 @04:48AM (#44657030)
I had given up long time ago on self hosted transformer models for coding because the SOTA was definetly in favor of SaaS. This might just give me another try.

Would llama.cpp support multiple (rtx 3090, no nvlink hw bridge) GPUs over PCIe4? (Rest of the machine is 32 CPU cores, 256GB RAM)

Re:Qwen3-Coder: Agentic coding in the world by jychang on Wednesday July 23, 2025 @06:24AM (#44657564)
How fast you run this model will strongly depend on if you have DDR4 or DDR5 ram.

You will be mostly using 1 of your 3090s. The other one will be basically doing nothing. You CAN put the MoE weights on the 2nd 3090, but it's not going to speed up inference much, like <5% speedup. As in, if you lack a GPU, you'd be looking at <1 token/sec speeds depending on how fast your CPU does flops, and if you have a single 3090 you'd be doing 10tokens/ec, but with 2 3090s you'll still just be doing maybe 11tok/sec. These numbers are made up, but you get the idea.

Qwen3 Coder 480B is 261GB for IQ4_XS, 276GB for Q4_K_XL, so you'll be putting all the expert weights in RAM. That's why your RAM bandwidth is your limiting factor. I hope you're running off a workstation with dual cpus and 12 sticks of DDR5 RAM per CPU, which allows you to have 24 channel DDR5 RAM.

Re:Qwen3-Coder: Agentic coding in the world by PeterStuer on Wednesday July 23, 2025 @01:15PM (#44661602)
1 CPU, DDR4 ram
Re:Qwen3-Coder: Agentic coding in the world by jychang on Wednesday July 23, 2025 @04:24PM (#44663617)
How many channels of DDR4 ram? What speed is it running at? DDR4-3200?

The (approximate) equation for milliseconds per token, is:

Time for token generation = (number of params active in the model)*(quantization size in bits)/8 bits*[(percent of active params in common weights)/(memory bandwidth of GPU) + (percent of active params in experts)/(memory bandwidth of system RAM)].

This equation ignores prefill (prompt processing) time. This assumes the CPU and GPU is fast enough compute-wise to do the math, and the bottleneck is memory bandwidth (this is usually true).

So for example, if you are running Kimi K2 (32b active params per token, 74% of those params are experts, 26% of those params are common params/shared expert) at Q4 quantization (4 bits per param), and have a 3090 gpu (935GB/sec) and an AMD Epyc 9005 cpu with 12 channel DDR5-6400 (614GB/sec memory bandwidth), then:

Time for token generation = (32b params)*(4bits/param)/8 bits*[(26%)/(935 GB/s) + (74%)/(614GB/sec)] = 23.73 ms/token or ~42 tokens/sec. https://www.wolframalpha.com/input?i=1+sec+%2F+%2816GB+*+%5B...

Notice how this equation explains how the second 3090 is pretty much useless. If you load up the common weights on the first 3090 (which is standard procedure), then the 2nd 3090 is just "fast memory" for some expert weights. If the quantized model is 256GB (rough estimate, I don't know the model size off the top of my head), and common weights are 11GB (this is true for Kimi K2, I don't know if it's true for Qwen3, but this is a decent rough estimate), then you have 245GB of "expert" weights. Yes, this is generally the correct ratio for MoE models, Deepseek R1 included. If you put 24GB of that 245GB on your second 3090, you have 935GB/sec speed on... 24/245 or ~10% of each token. In my Kimi K2 example above, you start off with 18.08ms per token spent reading the model from RAM, so even if your 24GB on your GPU was infinitely fast, it would still take... about 16ms per token reading from RAM. Or in total about 22ms/token, or in total 45 tokens/sec. That's with an infinitely fast 2nd GPU, you get a speedup of merely 3 tokens/sec.

Re:Qwen3-Coder: Agentic coding in the world by jychang on Thursday July 24, 2025 @03:25AM (#44667933)
Inspired me to write this, since it seems like most people don't understand how fast models run:

https://unexcitedneurons.substack.com/p/how-to-calculate-hom...

Re:Qwen3-Coder: Agentic coding in the world by PeterStuer on Thursday July 24, 2025 @12:51PM (#44672980)
Thank you for that writeup!

In my case it is a fairly old system I built from cheap eBay parts. Threadripper 3970X with 8x32GB dual channel 2666Mhz DDR4.

Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Wednesday July 23, 2025 @05:22AM (#44657219)
Oh yes llama.cpp's trick is it supports any hardware setup! It might be a bit slower, but it should function well!
Re:Qwen3-Coder: Agentic coding in the world by colordrops on Wednesday July 23, 2025 @05:56PM (#44664454)
Would a version of this ever be possible to run on a machine with a 16GB gpu and 64gb RAM?
Re:Qwen3-Coder: Agentic coding in the world by ashvardanian on Thursday July 24, 2025 @06:33AM (#44669090)
Thanks for the uploads! Was reading through the Unsloth docs for Qwen3-Coder before I found the HN thread :)

What would be a reasonable throughput level to expect from running 8-bit or 16-bit versions on 8x H200 DGX systems?

Re:Qwen3-Coder: Agentic coding in the world by danielhanchen on Thursday July 24, 2025 @06:46PM (#44677237)
Oh 8*H200 is nice - for llama.cpp definitely look at https://docs.unsloth.ai/basics/qwen3-coder-how-to-run-locall... - llama.cpp has a high throughput mode which should be helpful.

You should be able to get 40 to 50 tokens / s in the minimum. High throughput mode + a small draft model might get you 100 tokens / s generation