Fu01978 commited on
Commit
9ff04b0
·
verified ·
1 Parent(s): f2e20c0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +74 -1
README.md CHANGED
@@ -20,4 +20,77 @@ tags:
20
  - math
21
  - creative
22
  - merge
23
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  - math
21
  - creative
22
  - merge
23
+ ---
24
+
25
+ # SmolMoE-4x360M-Instruct
26
+
27
+ A Mixture-of-Experts model
28
+ built by merging four SmolLM2-360M fine-tunes
29
+ using [mergekit](https://github.com/arcee-ai/mergekit).
30
+ Each expert specializes
31
+ in a distinct domain,
32
+ with 2 experts active per token
33
+ (~720M active parameters
34
+ per forward pass
35
+ out of ~1.4B total).
36
+
37
+ ## Experts
38
+
39
+ | # | Model | Specialization |
40
+ |---|-------|---------------|
41
+ | E0 | [HuggingFaceTB/SmolLM2-360M-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM2-360M-Instruct) | General knowledge, factual Q&A |
42
+ | E1 | [prithivMLmods/SmolLM2-CoT-360M](https://huggingface.co/prithivMLmods/SmolLM2-CoT-360M) | Chain-of-thought reasoning, logic |
43
+ | E2 | [summerstars/SolaraV2-coder-0517](https://huggingface.co/summerstars/SolaraV2-coder-0517) | Code generation, mathematics |
44
+ | E3 | [Fu01978/SmolLM2-360M-Instruct-Heretic](https://huggingface.co/Fu01978/SmolLM2-360M-Instruct-Heretic) | Creative writing, expressive language |
45
+
46
+ ## Architecture
47
+
48
+ - **Base architecture:** Mixtral-style MoE (via mergekit)
49
+ - **Total experts:** 4
50
+ - **Active experts per token:** 2
51
+ - **Gate mode:** `hidden` (router trained on real hidden states), with subsequent router fine-tuning
52
+ - **Active parameters per token:** ~720M
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ from transformers import AutoModelForCausalLM, AutoTokenizer
58
+ import torch
59
+
60
+ model = AutoModelForCausalLM.from_pretrained(
61
+ "Fu01978/SmolMoE-4x360M-Instruct",
62
+ torch_dtype=torch.bfloat16,
63
+ device_map="auto",
64
+ trust_remote_code=True,
65
+ )
66
+ tokenizer = AutoTokenizer.from_pretrained("Fu01978/SmolMoE-4x360M-Instruct")
67
+
68
+ messages = [{"role": "user", "content": "Implement a binary search in Python."}]
69
+ formatted = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
70
+ inputs = tokenizer(formatted, return_tensors="pt").to(model.device)
71
+
72
+ output = model.generate(**inputs, max_new_tokens=256, temperature=0.2, do_sample=True)
73
+ print(tokenizer.decode(output[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
74
+ ```
75
+
76
+ ## Limitations
77
+
78
+ - General factual accuracy
79
+ is imperfect — the model can hallucinate
80
+ details on knowledge questions
81
+ - At 360M per expert,
82
+ complex multi-step reasoning
83
+ has limits
84
+ - E0 (General)
85
+ is the weakest
86
+ router target
87
+ due to weight similarity
88
+ with E3 (Heretic),
89
+ which is a direct fine-tune
90
+ of the same base
91
+
92
+ ## Created With
93
+
94
+ - [mergekit](https://github.com/arcee-ai/mergekit)
95
+ — MoE construction
96
+ - Kaggle Dual T4 GPUs