EEU-Qwen3-4B-2507-Hybrid-SLERP
A Thinking-Enhanced Direct-Instruct 4B model (4.02B parameters, 256K native context) created via Layer-Gradient, Component-Partitioned SLERP merging of Qwen/Qwen3-4B-Instruct-2507 and Qwen/Qwen3-4B-Thinking-2507, built with ZLangRH (zlrh).
中文简介:本模型通过 ZLangRH (
zlrh) 的分层分组件球面线性插值(Layer-Gradient SLERP),将Qwen3-4B-Thinking-2507的数学、逻辑与代码推理能力定向注入Qwen3-4B-Instruct-2507的中深层权重,同时保留Instruct-2507的免<think>直出模板、256K 原生上下文与干净的工具调用/结构化输出风格——在不增加<think>冗长思维链开销的前提下,获得更凝练、更稳健的直出表现。
Why This Merge? / 为什么做这个融合?
In the 2507 update, Qwen split the 4B lineup into two separate models:
Qwen3-4B-Instruct-2507: Fast direct output, strong instruction following & tool calling, native 256K context — but occasionally over-explains or stumbles mid-derivation on multi-step logic traps.Qwen3-4B-Thinking-2507: Strong deep reasoning — but generates mandatory, very long<think>chains (frequently >1,000 tokens even on simple JSON extraction or 3-sentence summaries).
Qwen3-4B-2507-Hybrid-SLERP bridges the two:
- Keeps direct non-thinking responses (clean
Instruct-2507chat template, zero<think>token tax). - Injects
Thinking-2507's reasoning circuits primarily into middle-to-deep MLP layers (peaking att = 0.65) while anchoring embeddings, input/output attention, and final norm closer toInstruct-2507(t = 0.20–0.25) to preserve crisp formatting, JSON strictness, native<tool_call>accuracy, and clean<|im_end|>stopping.
Merge Recipe / 融合配方
Merged in streaming bfloat16 (with f64 spherical dot/norm accumulation across all 398 tensors; verified 0 NaN, 0 Inf, 0 zero-rows, 0 norm anomalies) using zlrh merge -f merge.toml:
| Component | Layer Depth Curve (t: 0 = Instruct, 1 = Thinking) | Rationale |
|---|---|---|
embed_tokens & model.norm | 0.25 | Preserve Instruct token calibration, clean stopping, and tool-call tokens |
self_attn (36 layers) | [0.20, 0.35, 0.50, 0.45, 0.25] | Clean instruction parsing at entry/exit; balanced reasoning routing in middle layers |
mlp (36 layers) | [0.30, 0.50, 0.65, 0.55, 0.35] | Concentrate Thinking's math, coding, and deductive circuits in mid-deep FFN layers |
layernorm | 0.35 | Smooth transition across blocks |
The exact reproducible configuration is included in merge.toml.
Evaluation & Benchmarks / 全面实测对比
1. 16-Task Multi-Dimensional Suite (MLX bf16, temp = 0.0, Apple M4 16GB)
Tested across 8 capability dimensions: Competition Math & Bayes Probability, Deductive & Anti-Memorization Logic, Unit-Tested Python Coding, Native <tool_call> + Restraint, IFEval 4-Constraint Formatting + Strict JSON Schema, 8K Needle-in-a-Haystack Multi-Hop Retrieval, Chinese/Systems Translation, and Multi-Turn State + Stochastic Sampling Stability (temp=0.65):
| Model | Verified Pass Rate | 15-Task Output Tokens | Total Time (M4 bf16) | Highlights |
|---|---|---|---|---|
Qwen3-4B-2507-Hybrid-SLERP (Ours) | 14 / 16 (87.5%) | 5,542 tok | 515.8 s | -5.5% to -14.5% fewer tokens than Instruct; finishes CRT math cleanly (622 tok vs Instruct truncated at 768 tok); 100% pass on 8K haystack, <tool_call>, IFEval, JSON, Bayes (1/6), and LRUCache unit tests |
Qwen/Qwen3-4B-Instruct-2507 | 14 / 16 (87.5%) | 5,862 tok | 558.6 s | Truncated at 768 tok during CRT verification; 42.7% more verbose with mid-step hesitation on Chinese box-label logic puzzle |
(Both 4B models hit the same two 4B-scale boundaries: an edge case *)(* on O(n) wildcard parentheses and a subtle Gaokao-style Chinese idiom distinction.)
2. Core 6-Task Conciseness & Reasoning Benchmark (MLX bf16, temp = 0.0)
| Model | Accuracy | Total Tokens | Total Latency | Notes |
|---|---|---|---|---|
Qwen3-4B-2507-Hybrid-SLERP (Ours) | 6 / 6 | 1,267 tok | 112.6 s | -14.5% fewer tokens & -19.6% faster than Instruct; crisp deduction & stronger code assert coverage |
Qwen/Qwen3-4B-Instruct-2507 | 6 / 6 | 1,482 tok | 140.0 s | Mid-derivation stumble on logic puzzle; generic SLERP definition |
Qwen/Qwen3-4B-Thinking-2507 | — (capped) | 6,144+ tok | 537.3 s | Hit 1,024-token ceiling inside <think> on all 6 prompts |
3. GGUF (Q4_K_M, 2.32 GiB) Speed on Apple M4 (llama-bench, Metal)
| Metric | Throughput |
|---|---|
Prompt Processing (pp512) | 342.61 ± 2.21 tok/s |
Token Generation (tg128) | 33.46 ± 0.04 tok/s |
| Cold Model Load Time | ~1.45 s |
Usage / 使用方法
Note: This model is designed for direct (non-thinking) mode using its included
Instruct-2507chat template. Do not force<think>\nprefixes.
Recommended Sampling Parameters / 推荐采样参数
temperature:0.65top_p:0.85top_k:20
Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "EEU/EEU-Qwen3-4B-2507-Hybrid-SLERP"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
messages = [{"role": "user", "content": "用三句话通俗解释什么是 SLERP 模型融合。"}]
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tok([text], return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512, temperature=0.65, top_p=0.85, top_k=20)
print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
Apple Silicon (MLX)
mlx_lm.generate --model EEU/EEU-Qwen3-4B-2507-Hybrid-SLERP --prompt "Explain SLERP model merging concisely."
llama.cpp / Ollama (GGUF Q4_K_M)
llama-completion -m EEU-Qwen3-4B-2507-Hybrid-SLERP-Q4_K_M.gguf -cnv --temp 0.65 --top-p 0.85 --top-k 20
License & Credits / 许可证与致谢
- Inherited Apache-2.0 license from
Qwen/Qwen3-4B-Instruct-2507andQwen/Qwen3-4B-Thinking-2507. - Merged, verified, and quantized with ZLangRH (
zlrh) by Yeraldo Smith.