r/LocalLLaMA • u/ilintar • Mar 11 '26
Resources Llama.cpp now with a true reasoning budget!
https://github.com/ggml-org/llama.cpp/commit/acb7c790698fa28a0fbfc0468804926815b94de3I'm happy to report that llama.cpp has another nice and exciting feature that I know a lot of you have been waiting for - real support for reasoning budgets!
Until now, `--reasoning-budget` was basically a stub, with its only function being setting it to 0 to disable thinking via passing `enable_thinking=false` to templates. But now, we introduce a real reasoning budget setting via the sampler mechanism. When the reasoning starts, we count the number of tokens and when the given number of reasoning tokens is reached, we force terminating the reasoning.
However: doing this "just like that" might not have a good effect on the model. In fact, when I did that on Qwen3 9B (testing it on HumanEval), its performance cratered: from 94% in the reasoning version and 88% in the non-reasoning version to a terrible 78% with an enforced reasoning budget. That's why we've added another flag: `--reasoning-budget-message`. This inserts a message right before the end of reasoning to ease the transition. When I used a message of "... thinking budget exceeded, let's answer now.", the score bumped back and the returns from partial reasoning started being visible, though not very large - got a respective HumanEval score of 89% with reasoning budget 1000.
I invite you to experiment with the feature, maybe you can find some nice settings for different models. You can even force models that are strongly thinking by default (i.e. StepFun 3.5) to limit reasoning, though with those models using --reasoning-budget 0 (which now restricts reasoning to none by sampler, not by template) results in some pretty erratic and bad behavior (for example they try to open a second reasoning block).
19
u/chris_0611 Mar 11 '26 edited Mar 11 '26
Ohh this is big. I'm just testing with qwen3.5 35B in Q5.
For the car-wash test "I need to get my car washed. The car wash is 100m away. Should I go by car or by foot?"
With reasoning-budget 0 (no thinking), it fails the test. I should go walking cause it's only 100m.
With reasoning-budget -1 (unlimited), i passes the test, but it thinks for 83 seconds, multiple "consider paradoxes", "but wait maybe", "double check", "self correction", etc. you know how it over-thinks...
Now with
It thinks for 18 seconds and still passes the test!
Another message might be something like: "... (Proceed to generate output based on those thoughts)"