How to tune reasoning chain length in local LLMs without retraining or fine-tuning.

Qwen 3.5 is a capable reasoning model. But its reasoning chains can grow excessively long. Users running the model locally via Ollama and other inference engines report that even simple prompts trigger lengthy internal reasoning. A basic greeting can produce hundreds of reasoning tokens before the model answers.

This is not just a user experience problem. Long reasoning chains cost tokens, increase latency, and in production systems, can blow through budget limits. The model is doing useful work. But it is doing too much of it.

A technique posted on r/LocalLLaMA shows how to control reasoning length by combining logit bias on the reasoning token with grammar constraints. The approach works at inference time. No retraining. No fine-tuning. Just parameter tuning.

This article covers the technique, how it works, and practical guidance for local LLM users.


The Problem: Qwen 3.5 Overthinks

Qwen 3.5 was trained with explicit reasoning support. The model produces reasoning content wrapped in special tags before generating the final answer. This is similar to DeepSeek-R1 and other reasoning-tuned models.

The problem is that the model often reasons far longer than necessary. Users report that straightforward requests produce elaborate internal monologues. The model explores multiple angles, considers edge cases, and double-checks conclusions that do not need checking. All of this happens inside the reasoning tags where the user does not see it directly. But they pay for it in tokens and wait for it in latency.

The issue has been documented in the LocalAI community, the vLLM project, and user forums. Qwen3.5-27B reduces reasoning greatly when tools are present in the request, suggesting the model's reasoning behavior is context-sensitive and not fixed. This sensitivity means reasoning length can be influenced at inference time.


The Solution: Logit Bias Plus Grammar

The r/LocalLLaMA technique combines two mechanisms that are already available in inference engines like llama.cpp, vLLM, and Ollama.

Logit bias. Adjusting the logit bias on the reasoning token controls how likely the model is to continue reasoning versus terminate the reasoning phase and move to the answer. A negative bias on the reasoning continuation token makes the model wrap up reasoning sooner. A positive bias encourages longer reasoning.

Grammar constraints. A grammar rule that requires the reasoning section to end with a specific token or pattern forces a clean transition from reasoning to answer. This prevents the model from getting stuck in infinite reasoning loops.

Together, these two mechanisms let users tune the average reasoning chain length without changing the model weights.


How Logit Bias Works on Reasoning Tokens

Reasoning models use special tokens to mark the reasoning section. Qwen 3.5 uses tags like <think> and </think> or similar special tokens to delimit reasoning content.

The model generates reasoning tokens autoregressively. At each step, it samples from a distribution over the vocabulary. The logits for the reasoning continuation token determine how likely the model is to keep reasoning versus transition to the answer phase.

By applying a logit bias to the reasoning continuation token, you shift this decision boundary.

Negative bias: the model is less likely to continue reasoning. Reasoning chains become shorter. The model moves to the answer phase sooner.

Positive bias: the model is more likely to continue reasoning. Reasoning chains become longer. The model explores more angles before answering.

The key insight is that this bias applies only to the reasoning phase token. It does not affect the quality of the final answer tokens. The model still generates answers with the same capability. It just spends less time in the reasoning phase.


Practical Tuning with curl

Inference engines that support logit bias and grammar constraints can be configured via API parameters. A typical curl request to a local vLLM or llama.cpp server looks like this.

The logit_bias parameter adjusts the reasoning continuation token. The grammar parameter enforces structural rules that require reasoning to terminate.

The exact token ID for the reasoning continuation token depends on the model's tokenizer. For Qwen 3.5, this is typically the <think> token or a reasoning-specific control token. You can find the token ID using the tokenizer's encode method.

from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3.5-7B")
print(tokenizer.encode("<think>", add_special_tokens=False))

Once you have the token ID, you can experiment with bias values.

Conservative reasoning. Bias of -2.0 to -5.0. Short chains. Fast answers. Good for simple queries where deep reasoning is unnecessary.

Balanced reasoning. Bias of -1.0 to -2.0. Moderate chains. Good default for general use.

Deep reasoning. Bias of 0.0 to +2.0. Long chains. Good for complex problems where thorough analysis is worth the token cost.

The grammar constraint ensures that reasoning does not continue indefinitely. A simple grammar rule requires the reasoning section to contain at least one </think> token followed by the answer content. This prevents infinite loops even with a neutral or positive bias.


Why Grammar Constraints Matter

Logit bias alone can push the model toward shorter reasoning. But it does not guarantee that reasoning terminates cleanly. The model might still produce fragmented reasoning or get stuck in a loop where it oscillates between reasoning and non-reasoning modes.

Grammar constraints solve this by enforcing structure at the sampling level. The grammar engine ensures that the output follows a valid parse tree. For Qwen 3.5, a grammar rule might look like this.

start ::= reasoning answer
reasoning ::= "<think>" text "</think>"
answer ::= text

This grammar requires that every output contains a reasoning section delimited by <think> and </think> followed by an answer section. The reasoning section cannot extend indefinitely because the grammar requires the </think> token to appear before the answer section begins.

Inference engines like llama.cpp support grammar constraints via GBNF (GGML BNF) format. vLLM supports structured output via guided decoding. Both can enforce the reasoning-answer structure.


Measuring the Impact

The effect of logit bias on reasoning length is measurable. Users running Qwen 3.5 locally report the following patterns.

With a bias of -5.0 on the reasoning continuation token, reasoning chains drop from an average of 400 tokens to 80 tokens for simple queries. Latency improves by roughly 4x. Answer quality remains acceptable for factual questions.

With a bias of -2.0, reasoning chains drop from 400 tokens to 150 tokens. Latency improves by 2x. Answer quality is largely unchanged across most benchmarks.

With a bias of 0.0, reasoning chains stay at the natural length. The model uses whatever reasoning depth the training data suggested.

With a positive bias, reasoning chains grow. The model explores more angles. This can improve performance on complex reasoning tasks but increases cost and latency proportionally.

The key is that the relationship is monotonic. More negative bias equals shorter chains. More positive bias equals longer chains. This makes the parameter tunable and predictable.


Comparison to Other Approaches

Several other methods exist for controlling reasoning length. Logit bias plus grammar is the simplest and most flexible.

vLLM reasoning budget. The vLLM project added a reasoning token limit feature in March 2026. This enforces a hard cap on reasoning tokens at the decode loop level. It is effective but less flexible than logit bias. You cannot tune the average length. You can only set a maximum.

Model mode switching. Qwen 3.5 supports turning explicit thinking mode off. This eliminates reasoning entirely. The model answers directly without the reasoning phase. This is the fastest option but sacrifices the quality benefits of chain-of-thought reasoning.

Fine-tuning. Training the model on shorter reasoning chains is the most principled approach. But it requires data, compute, and expertise. Most local LLM users do not have these resources.

Post-training quantization. Some users report that aggressive quantization reduces reasoning length as a side effect. This is not reliable and degrades model quality.

Logit bias plus grammar sits in the sweet spot. It requires no retraining. It is adjustable per request. It preserves model quality. And it works with existing inference engines.


Practical Guidance for Local LLM Users

If you run Qwen 3.5 locally, here is a step-by-step tuning process.

Step 1: Identify the reasoning token. Use the tokenizer to find the token ID for the reasoning continuation token. This is usually the <think> token or a reasoning-specific control token.

Step 2: Set up grammar constraints. Define a GBNF grammar that requires reasoning to terminate with </think>. Test that the inference engine enforces this structure.

Step 3: Start with a conservative bias. Set logit bias to -3.0 on the reasoning token. Run a set of test queries. Measure reasoning length and answer quality.

Step 4: Tune the bias. If answers are too shallow, increase the bias toward -1.0. If reasoning is still too long, decrease the bias toward -5.0. Find the sweet spot for your use case.

Step 5: Monitor over time. Reasoning behavior can shift with context length, temperature, and prompt structure. Re-tune periodically.

Step 6: Combine with other optimizations. Use the reasoning control alongside context compression, tool selection, and prompt templates. The gains compound.


What This Means for the Ecosystem

Reasoning length control is becoming a first-class feature in inference engines. vLLM added reasoning budgets. llama.cpp supports grammar constraints. Ollama exposes logit bias parameters. The infrastructure is maturing.

For model developers, the lesson is that reasoning behavior should be controllable at inference time. Training models with a single fixed reasoning length is limiting. Models that support tunable reasoning are more versatile.

For application developers, the lesson is that reasoning is not free. Every token costs money and latency. Applications should match reasoning depth to task complexity. Simple tasks should use short reasoning. Complex tasks should use long reasoning. The same model can serve both use cases with the right parameters.

For users, the lesson is that local LLMs offer control that API models do not. API providers typically expose reasoning as a binary choice — on or off. Local inference lets you tune the continuous spectrum between these extremes.


Summary

Qwen 3.5's reasoning chains can grow excessively long for simple tasks. A technique combining logit bias on the reasoning continuation token with grammar constraints lets users tune reasoning length at inference time.

Logit bias shifts the model's decision to continue reasoning. Negative bias shortens chains. Positive bias lengthens them. Grammar constraints ensure clean termination and prevent infinite loops.

The approach works with standard inference engines. No retraining. No fine-tuning. Just parameter tuning. Users report 2-4x latency improvements with minimal quality loss.

For local LLM users, the practical steps are: identify the reasoning token, set up grammar constraints, start with a conservative bias, tune iteratively, and monitor over time.

Reasoning control is the new latency lever. Use it wisely.


Published May 16, 2026