MLA299 commited on
Commit
caf2ffb
·
verified ·
1 Parent(s): a733fa2

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +44 -54
README.md CHANGED
@@ -2,11 +2,9 @@
2
  library_name: mlx
3
  pipeline_tag: text-generation
4
  license: apache-2.0
5
- base_model: Qwen/Qwen3-8B
6
  tags:
7
  - mlx
8
  - lora
9
- - qwen3
10
  - code
11
  - reasoning
12
  - text-generation
@@ -14,10 +12,10 @@ tags:
14
  - distillation
15
  ---
16
 
17
- # Tennda-Qwen
18
 
19
- > **Tennda 团队微调的高效代码/推理助手**(基座:Qwen3-8B)
20
- > 结构化 `<think>` 推理 + 直接给答案,思考精炼、回答完整,适合代码生成、数学与逻辑推理场景。
21
 
22
  ---
23
 
@@ -25,24 +23,25 @@ tags:
25
 
26
  | Item | Details |
27
  |---|---|
28
- | **Model Name** | Tennda-Qwen |
29
  | **Developer** | Tennda Team |
30
- | **Base Model** | [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B)(Apache-2.0) |
31
- | **Fine-tuning** | QLoRA(rank=16, scale=32, 最后 16 层,可训练参数 19.4M / 0.237%) |
32
- | **Weight Format** | 4-bit 量化,MLX 原生(约 4.3GB) |
33
- | **Framework** | MLX 0.32.1 + mlx-lm 0.31.3Apple Silicon Metal 加速) |
34
- | **Training Data** | 多教师蒸馏 SFT 数据(Qwen3.8-Max / GLM-5.2 / Kimi-K3 生成),sft_balanced 子集 2,000 条:数学 27% · 代码 27% · 推理 20% · 指令 14% |
35
- | **Context** | 训练长度 1024(基座原生更长) |
 
36
  | **Release Date** | 2026-08-24 |
37
 
38
  ---
39
 
40
  ## Highlights
41
 
42
- - **思考精炼**`<think>` 推理链压缩至 300-550 字要点式,不浪费 token(基座常出现 1500+ 字思考失控)
43
- - **回答完整**:蒸馏数据教会「短思考 + 完整交付」,5 题实测 0 次思考失控(基座 2/5 次)
44
- - **多领域覆盖**:数学、代码、逻辑推理、指令跟随均衡训练
45
- - **Apple Silicon 原生**MLX 4-bit,峰值推理内存 ~6GBM 系列单机可跑
46
 
47
  ---
48
 
@@ -55,45 +54,43 @@ tags:
55
  | Train loss | 1.70 | — | **0.421** |
56
  | Val loss | 1.702 | **0.590** (iter 700) | 0.794 |
57
 
58
- ![Training curves](https://huggingface.co/MLA299/Tennda-Reason/resolve/main/qwen_training_curves.png)
59
 
60
- - 2000 iterations ≈ 2 epochsbatch=2, seq=1024, ~67 tokens/s, M4 单卡约 8 小时)
61
- - GPU 峰值显存 **8.5GB**,全程稳定无 OOM
62
- - **发布检查点:iter 700**(Val 0.590 最佳),经 5 题盲测对比击败最终检查点(详见训练报告第 7 节)
63
 
64
  ### Checkpoint Selection
65
 
66
- | | iter 700(发布版) | iter 2000 |
67
  |---|---|---|
68
  | Val loss | **0.590** | 0.794 |
69
- | 事实准确性(TCP 题) | ✅ 正确 | ❌ 细节错误 |
70
- | 格式合规 | ✅(复测确认) | ✅ |
71
 
72
  ---
73
 
74
- ## Evaluation (5 prompts, temp=0.3, vs base Qwen3-8B)
75
 
76
- | Task | Tennda-Qwen | Base Qwen3-8B |
77
  |---|---|---|
78
- | Python 快排 | ✅ 完整可运行代码+复杂度分析 | ❌ 思考失控,无正文输出 |
79
- | JS 闭包 | ✅ 结构化完整教程 | ⚠️ 正文过简 |
80
- | SQL 部门最高工资 | ✅ 窗口函数双方案 | ❌ 思考失控,无正文输出 |
81
- | TCP 三次握手 | ✅ 类比生动、步骤正确 | ✅ 简洁正确 |
82
- | Python HTTP 服务器 | ⚠️ 多方案,细节小瑕疵 | ✅ 简洁正确 |
83
 
84
- **结论**:格式对齐 5/5;「思考失控」从基座 2/5 降至 0/5;整体可用性显著提升。
85
 
86
  ---
87
 
88
  ## Usage (MLX)
89
 
90
- ### With mlx-lm
91
-
92
  ```python
93
  from mlx_lm import load, generate
94
 
95
  model, tokenizer = load("MLA299/Tennda-Reason")
96
- messages = [{"role": "user", "content": " Python 写一个快速排序"}]
97
  prompt = tokenizer.apply_chat_template(
98
  messages, tokenize=False, add_generation_prompt=True
99
  )
@@ -101,37 +98,30 @@ response = generate(model, tokenizer, prompt=prompt, max_tokens=2048, verbose=Fa
101
  print(response)
102
  ```
103
 
104
- ### Command line
105
 
106
  ```bash
107
- mlx_lm.generate --model MLA299/Tennda-Reason --prompt "写一个 SQL 查询:每个部门工资最高的员工" --max-tokens 2048
108
- ```
109
-
110
- ### LoRA adapter only (轻量分发)
111
-
112
- ```python
113
- model, tokenizer = load("mlx-community/Qwen3-8B-4bit", adapter_path="MLA299/Tennda-Reason-LoRA")
114
  ```
115
 
116
- > 推理参数建议:temp=0.3~0.7, max_tokens≥2048(思考链+答案完整输出)
117
 
118
  ---
119
 
120
  ## Limitations
121
 
122
- - 训练数据以英文为主,中文场景可用但未专门优化
123
- - SFT 后模型更「自信」,细节事实幻觉率略高于基座(如网络协议细节),关键场景建议加校验
124
- - 训练上下文 1024,超长输入依赖基座原生能力
125
- - 训练数据含少量合成蒸馏内容,请遵循上游数据集许可
126
 
127
  ---
128
 
129
- ## Provenance
130
 
131
- - Base: [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B) (Apache-2.0)
132
- - Data: [r0b0tlab/qwen3.8-max-glm5.2-kimi-k3-distillation](https://huggingface.co/datasets/r0b0tlab/qwen3.8-max-glm5.2-kimi-k3-distillation) (sft_balanced subset)
133
- - Training framework: [mlx-lm](https://github.com/ml-explore/mlx-lm) LoRA
134
- - Full report: TRAINING_REPORT_QWEN.md (internal)
135
 
136
  ---
137
 
@@ -139,7 +129,7 @@ model, tokenizer = load("mlx-community/Qwen3-8B-4bit", adapter_path="MLA299/Tenn
139
 
140
  ```bibtex
141
  @misc{tennda-reason-2026,
142
- title = {Tennda-Reason: A Distillation-Fine-tuned Qwen3-8B for Code and Reasoning},
143
  author = {Tennda Team},
144
  year = {2026},
145
  month = {August},
@@ -150,4 +140,4 @@ model, tokenizer = load("mlx-community/Qwen3-8B-4bit", adapter_path="MLA299/Tenn
150
 
151
  ---
152
 
153
- *Tennda-Qwen · © 2026 Tennda Team*
 
2
  library_name: mlx
3
  pipeline_tag: text-generation
4
  license: apache-2.0
 
5
  tags:
6
  - mlx
7
  - lora
 
8
  - code
9
  - reasoning
10
  - text-generation
 
12
  - distillation
13
  ---
14
 
15
+ # Tennda-Reason
16
 
17
+ > **A high-efficiency code & reasoning assistant fine-tuned by the Tennda Team**
18
+ > Structured `<think>` reasoning followed by complete, production-ready answers — refined thinking, reliable delivery, built for code generation, math, and logical reasoning on Apple Silicon.
19
 
20
  ---
21
 
 
23
 
24
  | Item | Details |
25
  |---|---|
26
+ | **Model Name** | Tennda-Reason |
27
  | **Developer** | Tennda Team |
28
+ | **Parameters** | 8.2B (4-bit quantized, ~4.3GB) |
29
+ | **Architecture** | Standard Transformer decoder, native `<think>` reasoning support |
30
+ | **Weight Format** | 4-bit, MLX native |
31
+ | **Framework** | MLX 0.32.1 + mlx-lm 0.31.3 (Apple Silicon Metal acceleration) |
32
+ | **Training** | QLoRA (rank=16, scale=32, last 16 layers, 19.4M trainable params / 0.237%) |
33
+ | **Training Data** | Multi-teacher distillation SFT corpus (2,000 curated samples): math 27% · code 27% · reasoning 20% · instruction 14% |
34
+ | **Context Length** | 1024 (trained), extensible via base capabilities |
35
  | **Release Date** | 2026-08-24 |
36
 
37
  ---
38
 
39
  ## Highlights
40
 
41
+ - **Refined thinking**: `<think>` reasoning chains compressed to 300550 token key-point style — no rambling, no wasted tokens
42
+ - **Complete delivery**: trained on "short thinking + complete answer" patterns; 0/5 test failures from runaway reasoning (baseline: 2/5)
43
+ - **Multi-domain**: balanced across math, code, logical reasoning, and instruction following
44
+ - **Apple Silicon native**: MLX 4-bit, ~6GB peak inference memory, runs on a single M-series machine
45
 
46
  ---
47
 
 
54
  | Train loss | 1.70 | — | **0.421** |
55
  | Val loss | 1.702 | **0.590** (iter 700) | 0.794 |
56
 
57
+ ![Training curves](qwen_training_curves.png)
58
 
59
+ - 2,000 iterations ≈ 2 epochs (batch=2, seq=1024, ~67 tokens/s, ~8h on a single M4)
60
+ - GPU peak memory **8.5GB**, stable throughout, zero OOM
61
+ - **Released checkpoint: iter 700** (best validation loss), selected via blind A/B output comparison against the final checkpoint
62
 
63
  ### Checkpoint Selection
64
 
65
+ | | iter 700 (released) | iter 2000 |
66
  |---|---|---|
67
  | Val loss | **0.590** | 0.794 |
68
+ | Factual accuracy (networking task) | ✅ correct | ❌ detail error |
69
+ | Format compliance | ✅ verified | ✅ |
70
 
71
  ---
72
 
73
+ ## Evaluation (5 prompts, temp=0.3, vs pre-training baseline)
74
 
75
+ | Task | Tennda-Reason | Baseline |
76
  |---|---|---|
77
+ | Python quicksort | ✅ complete runnable code + complexity analysis | ❌ reasoning runaway, no answer produced |
78
+ | JS closures | ✅ full structured tutorial | ⚠️ thin output |
79
+ | SQL top salary per dept | ✅ window-function solutions | ❌ reasoning runaway, no answer produced |
80
+ | TCP 3-way handshake | ✅ vivid analogy, correct steps | ✅ concise & correct |
81
+ | Python HTTP server | ⚠️ multi-approach, minor rough edges | ✅ concise & correct |
82
 
83
+ **Summary**: format compliance 5/5; runaway-reasoning failures reduced from 2/5 (baseline) to 0/5; overall usability substantially improved.
84
 
85
  ---
86
 
87
  ## Usage (MLX)
88
 
 
 
89
  ```python
90
  from mlx_lm import load, generate
91
 
92
  model, tokenizer = load("MLA299/Tennda-Reason")
93
+ messages = [{"role": "user", "content": "Write a quicksort in Python"}]
94
  prompt = tokenizer.apply_chat_template(
95
  messages, tokenize=False, add_generation_prompt=True
96
  )
 
98
  print(response)
99
  ```
100
 
101
+ Command line:
102
 
103
  ```bash
104
+ mlx_lm.generate --model MLA299/Tennda-Reason \
105
+ --prompt "Write a SQL query: highest salary per department" \
106
+ --max-tokens 2048
 
 
 
 
107
  ```
108
 
109
+ > Recommended sampling: temp=0.30.7, max_tokens 2048 (thinking chain + full answer)
110
 
111
  ---
112
 
113
  ## Limitations
114
 
115
+ - Training data is English-dominant; Chinese works but is not specifically optimized
116
+ - Post-SFT the model is more confident; factual-detail hallucinations are slightly higher than baseline — verify critical details in production
117
+ - Trained at 1024 context; longer inputs rely on native capabilities
118
+ - Contains synthetic distillation content; upstream data terms apply
119
 
120
  ---
121
 
122
+ ## License
123
 
124
+ Apache-2.0. See the license terms for redistribution conditions.
 
 
 
125
 
126
  ---
127
 
 
129
 
130
  ```bibtex
131
  @misc{tennda-reason-2026,
132
+ title = {Tennda-Reason: A Distillation-Fine-tuned Model for Code and Reasoning on Apple Silicon},
133
  author = {Tennda Team},
134
  year = {2026},
135
  month = {August},
 
140
 
141
  ---
142
 
143
+ *Tennda-Reason · © 2026 Tennda Team*