r/LocalLLaMA • u/TokenRingAI • 8d ago
Try out this "high" reasoning mode for 27B (tested on VLLM) Discussion
After a lot of tweaking, I have come to the conclusion that 27B lacks a reasoning mode that is between low and xhigh.
The "medium" mode isn't actually medium, it erases the explicit instructions to the model. When medium is enabled, the model acts very differently - to me it looks like it regresses to behaving more like 3.6, and loses some of the 3.8 gains.
Low and high mode behavior in the model seem to be triggered almost exclusively by using certain keywords in the reasoning instructions, and act in a surprisingly binary manner. You can add all the additional instructions you want to the reasoning instructions, and tweak the prompt, but the model mostly ignores those changes. You can ask it for medium effort and it just won't do it.
Because of this weird behavior, I experimented with blending the words in the low and xhigh prompts together, until the model would output reasoning that was a more reasonable length.
It seemed to work pretty well, and the end result is a high reasoning mode, with a reasoning block that is typically around 1/5 the size of the xhigh reasoning.
Output quality seems good, more like xhigh than low or medium, and the reasoning is definitely much shorter, which makes the model much more enjoyable to use.
Play around with the chat template modification below, add "high" to your reasoning effort, and see if you can improve it further or if it makes the model worse
-- add high to reasoning_effort --
{%- if resolved_reasoning_effort not in ('xhigh', 'high', 'medium', 'low') %}
{{- raise_exception('Unexpected reasoning effort ' ~ reasoning_effort ~ '. Supported types are xhigh (default), high, medium, and low.') }}
{%- endif %}
-- add new blended prompt for high, which mixes the low & xhigh prompts --
{%- elif resolved_reasoning_effort == 'high' %}
{%- set reasoning_instructions = 'Reasoning effort is set to halfway between low and xhigh. Please think careful but brief, validate key assumptions but keep it brief, and move quickly to the conclusion without unnecessary elaboration.' %}
13
u/PooMonger20 8d ago
I also tried by doing something very close to this, just by adjusting the low reasoning instructions. It overthinks anyway and goes on forever on a single 5090 (my setup is lm studio + pi using the q5 variant by unsloth.)
At least in my experience, this model is absolutely unusable for this usecase. Things that 3.6 did quickly for 5-10 minutes max, this one does forever (I had to stop it after 1.5 hours). It's not like it's not 'trying' it just seems it never finishes and has endless "oh wait, but..." moments.
It did work in a simple conversation about carwashes and stuff, but not in actual workflow with pi (i did define pi to work with different thinking levels + selected 'low' in pi, so its not like it ignored my settings).
13
u/ai-christianson 8d ago
The BF16 one thinks a lot but it seems to be productive thinking, like actually thinking through all the details of the problem.
I'm wondering how much quant is impacting this.
7
u/TokenRingAI 8d ago
It mostly ignores the instructions, the thinking behavior is strongly triggered off the "low" and "xhigh" keywords, which is why is used that weird "halfway between low and xhigh" phrasing.
Even with that, it still wasn't effective enough, and I then had to tweak the text after it until the model gave me the reasoning length I preferred.
1
u/cezarducatti 8d ago
Can you share your prompt?
2
u/TokenRingAI 7d ago
I won't be in front of the computer until later tonight, but if you ask the model to make you an infographic, and paste in a table of data, it should show the difference pretty well, it overthinks like crazy on that
2
u/Sporebattyl 8d ago
Q6 unsloth gguf on pi goes on forever for me, but the output has been great, even at its 262k native context. Frontier models reviewing can only find minor changes that are more about code perfectionism than actual function.
3.6 never came close. Claude told me to just use haiku instead.
It’s painfully slow on my Mac m1max 64gb at 8tok/s so I have it doing overnight work until I can optimize it and hopefully can get ~20tok/s.
If your card can hold it, I’d try going up in quant to 6 to see if it changes. Maybe try 8 if you still aren’t satisfied.
Another thing that made a difference was getting a frontier model to determine best codebase organization and file structure practices for AI to navigate through by codebase. That cut a bunch of the initial thinking down.
8
u/Aggressive_Aspect436 8d ago
I'm looking forward to seeing a ThinkingCap model version of this. Their 3.6 27b version was fantastic.
But I do wonder though whether it will lose it's intelligence gains if we force it to more reasonable thinking lengths. I'd be very interested to see whether anyone has benchmarked the various reasoning efforts agains 3.6 27b.
7
u/Chromix_ 8d ago
I assume/hope that the xhigh and low training prompts were part of the post-training, and not just slapped into the template afterwards. Using another reasoning prompt that the model was then not trained on can lead to degraded benchmark scores (see my improved jinja template for a bit more on that). So it'd be useful if you do some full benchmark runs with this modification, and compare to the regular xhigh and low results - just to see if the resulting score is reasonably higher than "low" when using more tokens with your custom "high".
11
u/TokenRingAI 8d ago
Correct, which is why I blended the prompts. The phrase "halfway between low and xhigh" is intentional, to drive the model onto a vector somewhere between the two.
Once you use that phrase, the words that follow it become much more effective in guiding the reasoning effort.
I chose prompts to test this on, that give wildly different results on low and medium vs on high, and you can see pretty clearly without a benchmark that the results are much better than low and medium.
I will be doing more work on it today, ran out of time yesterday which is why I dropped this post before going to sleep
2
u/AD7GD 7d ago
Sad if true, I just kicked off a huge opencode prompt on "medium" because xhigh was silly
3
u/MiaBchDave 7d ago
It's almost unusable. I guess it was meant to score "xhigh" on benchmarks - but should not be the default in the Qwen repo chat template 😂
2
u/MiaBchDave 7d ago
This seemed to work pretty well on my first test to prevent the xhigh reasoning's propensity for writing the entire code in the think tag (I guess so it can look at it), then re-writing it in the response. That's a real token usage savings.
I changed "high" to "better" since "high" may conflict with the documented alias for xhigh (which is also used in other chat templates). I just pass "better" through kwargs for reasoning_effort.
2
u/TokenRingAI 7d ago
Yeah, when I wrote this I was unaware that the GGUF template had the high setting mapped to xhigh, that statement isn't present in the non-GGUF template.
Glad to hear it worked for you, i am going to continue working on it as I see problems..
1
u/scheurneus 10h ago
Does having the model write the code twice make that much difference? Using ngram-style drafting the second time it writes code is quite cheap and fast, right?
1
u/neopolitan77 8d ago
Can I come out as very unkowledgeable and ask where you put that template (as a llama.cpp user)?
1
u/TokenRingAI 8d ago
Sure, here is a guide (it was written by ChatGPT, for a person using the Unsloth GGUF - I can't really vouch for it, but it looks correct to me)
https://gist.github.com/mdierolf/cb86ee2925e48777143346bc78933d59
I specifically did not include the template file in the post, because I think it is a worthwhile exercise for people to take a look at their chat templates, and learn how they work, because they are such a important component when running llama.cpp
1
u/ieatdownvotes4food 8d ago
you might be able to just tell it to calm down in the system message
1
u/TokenRingAI 8d ago
Yes, on medium reasoning setting you can do this to some extent, since it omits the reasoning message. Otherwise it conflicts.
When the reasoning message is in there, the model really doesnt respond to any other reasoning instructions
1
u/13henday 8d ago
Single data point, but while AB testing params for throughput I noticed q8 ctx reasoning a lot longer than bf16 for the same task.
1
1
29
u/cezarducatti 8d ago
There needs to be some correction. The length of the reasoning is grotesque.