Downloads · 30 days
13
8% of all-time downloads
becnic/Qwen3-4B-Thinking-2507-Heretic
Qwen3-4B-Thinking-2507-Heretic is a text generation model from becnic. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
Qwen3-4B-Thinking-2507 has the following features: - Type: Causal Language Models - Training Stage: Pretraining & Post-training - Number of Parameters: 4.0B - Number of Paramaters (Non-Embedding): 3.6B - Number of Lay…
Downloads · 30 days
13
8% of all-time downloads
All-time downloads
155
Public
Parameters
4B
8.1 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors8 GB · 100%
From the Hugging Face model README
| Parameter | Value |
|---|---|
| direction_index | 19.42 |
| attn.o_proj.max_weight | 1.23 |
| attn.o_proj.max_weight_position | 22.34 |
| attn.o_proj.min_weight | 0.69 |
| attn.o_proj.min_weight_distance | 10.42 |
| mlp.down_proj.max_weight | 1.12 |
| mlp.down_proj.max_weight_position | 29.64 |
| mlp.down_proj.min_weight | 1.08 |
| mlp.down_proj.min_weight_distance | 20.24 |
| Metric | This model | Original model (Qwen/Qwen3-4B-Thinking-2507) |
|---|---|---|
| KL divergence | 0.06 | 0 (by definition) |
| Refusals | 6/100 | 96/100 |
Qwen3-4B-Thinking-2507 has the following features:
NOTE: This model supports only thinking mode. Meanwhile, specifying enable_thinking=True is no longer required.
Additionally, to enforce model thinking, the default chat template automatically includes <think>. Therefore, it is normal for the model's output to contain only </think> without an explicit opening <think> tag.
For more details, including benchmark evaluation, hardware requirements, and inference performance, please refer to our blog, GitHub, and Documentation.
Supported languages: English, German, French, Italian, Portuguese, Hindi, Spanish, and Thai.
The code of Qwen3 has been in the latest Hugging Face transformers and we advise you to use the latest version of transformers.
With transformers<4.51.0, you will encounter the following error:
KeyError: 'qwen3'
The following contains a code snippet illustrating how to use the model generate content based on given inputs.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "becnic/Qwen3-4B-Thinking-2507-Heretic"
# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
# prepare the model input
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
# conduct text completion
generated_ids = model.generate(
**model_inputs,
max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
# parsing thinking content
try:
# rindex finding 151668 (</think>)
index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
index = 0
thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")
print("thinking content:", thinking_content) # no opening <think> tag
print("content:", content)
For deployment, you can use sglang>=0.4.6.post1 or vllm>=0.8.5 or to create an OpenAI-compatible API endpoint:
python -m sglang.launch_server --model-path becnic/Qwen3-4B-Thinking-2507-Heretic --context-length 262144 --reasoning-parser deepseek-r1
vllm serve becnic/Qwen3-4B-Thinking-2507-Heretic --max-model-len 262144 --enable-reasoning --reasoning-parser deepseek_r1
Note: If you encounter out-of-memory (OOM) issues, you may consider reducing the context length to a smaller value. However, since the model may require longer token sequences for reasoning, we strongly recommend using a context length greater than 131,072 when possible.
For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.