YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
LFM2.5-8B-A1B No-Think Template
This repository is a chat-template adaptation of LiquidAI/LFM2.5-8B-A1B.
The original checkpoint is a reasoning-trained model. It is naturally aligned with a chat format where the assistant may enter a <think>...</think> block before producing the final answer. This repository does not change the model weights and does not turn the checkpoint into a true non-reasoning model.
Instead, this repository modifies chat_template.jinja to support no-think inference while staying close to the original reasoning-compatible format.
Key idea
When enable_thinking=False, the template intentionally opens and closes the thinking block with a short instruction:
<think>
No unnecessary reasoning. Close thinking and answer immediately.
</think>
The model is then expected to continue with the useful response immediately after </think>, either as normal final text or as a valid tool call.
This is different from removing <think> completely. Because the base model was trained with reasoning-style formatting, keeping a short closed thinking block reduces prompt-format shift while discouraging long chain-of-thought generation.
What changed?
The template introduces the following flag:
{%- set enable_thinking = enable_thinking | default(false) -%}
By default, enable_thinking=False, meaning the model runs in no-think mode.
In no-think mode, the system prompt is automatically extended with:
NO-THINK MODE IS ACTIVE.
STATE: The model may be prompted with a <think> block for format compatibility.
RULE: Follow this exact instruction whenever thinking begins: No unnecessary reasoning. Close thinking and answer immediately.
ACTION: Do not write chain-of-thought, hidden analysis, plans, drafts, self-talk, or step-by-step reasoning.
OUTPUT: Put the useful response only after </think>, either as final text or as a valid tool call.
The generation prompt becomes:
<|im_start|>assistant
<think>
No unnecessary reasoning. Close thinking and answer immediately.
</think>
The template also strips previous assistant reasoning traces from chat history when enable_thinking=False, so old <think>...</think> content is not repeatedly injected into later turns.
Usage with Transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "tuandunghcmut/LFM2.5-8B-A1B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="auto",
torch_dtype=torch.bfloat16,
)
messages = [
{"role": "user", "content": "Explain INT8 quantization in 3 sentences."}
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt",
enable_thinking=False,
).to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=256,
temperature=0.2,
top_k=80,
repetition_penalty=1.05,
)
new_tokens = outputs[0][inputs["input_ids"].shape[-1]:]
print(tokenizer.decode(new_tokens, skip_special_tokens=False))
Reasoning mode
To restore the original reasoning-style behavior, call the template with:
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt",
enable_thinking=True,
).to(model.device)
When enable_thinking=True, the template does not insert the no-think bridge.
Prompt inspection
You can verify the rendered prompt before generation:
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
enable_thinking=False,
)
print(prompt)
Expected suffix:
<|im_start|>assistant
<think>
No unnecessary reasoning. Close thinking and answer immediately.
</think>
Recommended generation settings
For direct-answer deployment, start with conservative decoding:
generation_config = dict(
max_new_tokens=256,
temperature=0.2,
top_k=80,
repetition_penalty=1.05,
)
Because the goal is to avoid long reasoning traces, max_new_tokens can usually be smaller than in reasoning mode.
Important limitations
This is a chat-template-level behavior control, not a new checkpoint.
Expected behavior:
- The model is encouraged to answer directly.
- The prompt remains compatible with the reasoning-trained format.
- The template discourages chain-of-thought generation.
- Previous reasoning traces are stripped from assistant history in no-think mode.
Possible limitations:
- The model may still occasionally emit
<think>or reasoning-like text because the weights were trained for reasoning behavior. - Some hard reasoning tasks may lose quality compared with full reasoning mode.
- Tool-call behavior should be tested in your target inference stack, especially if the server applies its own chat template.
Suggested path for a true non-reasoning checkpoint
If you want a real non-reasoning model rather than a template-controlled reasoning model, use a staged fine-tuning path.
Stage 1: no-think SFT
Train with assistant responses formatted like this:
<|im_start|>assistant
<think>
No unnecessary reasoning. Close thinking and answer immediately.
</think>
Final answer here.
<|im_end|>
This keeps the model close to the original reasoning distribution while teaching it to avoid long thinking content.
Stage 2: final-only SFT
After the model becomes stable in no-think format, optionally migrate to final-only responses:
<|im_start|>assistant
Final answer here.
<|im_end|>
Jumping directly from reasoning-only behavior to final-only prompting may cause format drift, unexpected <think> generation, or degraded output quality.
Attribution
Base model: LiquidAI/LFM2.5-8B-A1B
This repository only modifies the chat template for no-think inference compatibility. Model weights are unchanged unless explicitly stated otherwise.
- Downloads last month
- 6