Llama-3.2-3B-Thinking-SFT: A compact language model with step-by-step reasoning support
2 min readupdated
This model is a fully fine-tuned supervised fine-tuning (SFT) version of the base Llama-3.2-3B trained on a bilingual corpus (English and Chinese) with an internal reasoning mechanism added. Before providing the final answer, the model generates a hidden reasoning block inside special tags, which improves the logic of its responses. On simple tasks, the model can immediately output an empty block without unnecessary reasoning. This development will be useful for developers of local intelligent systems who need transparency in the AI's thought process on small hardware.
Key features
- Reasoning mode: Responses are wrapped in reasoning tags that separate the internal monologue from the final result.
- Bilingual training: The dataset includes high-quality annotated reasoning chains in English and Chinese.
- Runtime integration: Full compatibility with the transformers, vLLM, and llama.cpp ecosystems via a special tokenizer config.
- Training efficiency: The model was full-parameter fine-tuned on a single graphics card with a peak VRAM consumption of about 14.2 GB.
What you can do
- Chat client integration: Run the model in Cherry Studio or other interfaces with support for displaying thought process blocks.
- Logic problem solving: Use it to check precise reasoning, basic coding, and mathematical examples.
- Local deployment via vLLM: Set up a fast local text generation server with chat template support.
- Inference logic control: Flexibly disable the reasoning mode on the fly via generation parameters and logit bias.
Example
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
tok = AutoTokenizer.from_pretrained("wesjos/Llama-3.2-3B-Thinking-SFT")
model = AutoModelForCausalLM.from_pretrained(
"wesjos/Llama-3.2-3B-Thinking-SFT", dtype=torch.bfloat16, device_map="auto"
)
messages = [{ "role": "user", "content": "what is 89x12" }]
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tok(text, return_tensors="pt", add_special_tokens=False).to(model.device)
out = model.generate(**inputs, max_new_tokens=1024, do_sample=True, temperature=0.6, top_p=0.95)
print(tok.decode(out[0], skip_special_tokens=False))Read more
DetailsBenchmarks (GSM8K): accuracy with reasoning is 57.62%, and with thinking forcibly disabled it is 56.94%.
Hardware requirements: Training was performed on a GPU with 24 GB VRAM (14.2 GB peak); a consumer graphics card is sufficient for running it.
Training details: 4 epochs, Unsloth, PagedAdamW8bit optimizer, LR 2e-5, maximum sequence length of 8192 tokens.
Limitations: An SFT version without an RL stage, the dataset contains training examples from benchmarks, and the model may make mistakes in long calculation chains.










Comments