aisamdasu commited on
Commit
a20d541
·
verified ·
1 Parent(s): bc4ff69

Update moe guide

Browse files
Files changed (2) hide show
  1. moe/README.md +21 -0
  2. moe/TRAINING_PLAN.md +34 -1
moe/README.md CHANGED
@@ -14,6 +14,25 @@ multi-token prediction heads.
14
  - Top-2 routing during training.
15
  - Shared expert for common syntax and indentation.
16
  - Router z-loss and auxiliary load-balancing loss.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  ## Routing Metrics
19
 
@@ -32,3 +51,5 @@ Log:
32
  - Router churn.
33
  - Synthetic Python overfitting.
34
  - MTP loss overpowering next-token loss.
 
 
 
14
  - Top-2 routing during training.
15
  - Shared expert for common syntax and indentation.
16
  - Router z-loss and auxiliary load-balancing loss.
17
+ - QK norm for long-context attention stability.
18
+ - Expert-choice telemetry from the first step, not after loss diverges.
19
+ - Optional multi-token prediction heads with low loss weight.
20
+
21
+ ## Best Current Shape
22
+
23
+ Use shared attention and sparse FFN. Keep early layers mostly dense/shared so
24
+ the model learns lexical syntax before specializing.
25
+
26
+ - Early blocks: dense FFN or shared expert heavy.
27
+ - Middle blocks: sparse MoE every other block.
28
+ - Late blocks: sparse MoE with stricter router stability checks.
29
+ - Expert count: start with 8 experts for smoke, then 16-32 for H100 ablation.
30
+ - Routing: top-2 with capacity factor 1.25 during training.
31
+ - Inference ablation: top-1 only after top-2 training is stable.
32
+
33
+ For code completion, the highest-value specialization is not one expert per
34
+ language. Better targets are syntax/indentation, FIM reconstruction,
35
+ repository-context patterns, generated-code continuation, and real-code APIs.
36
 
37
  ## Routing Metrics
38
 
 
51
  - Router churn.
52
  - Synthetic Python overfitting.
53
  - MTP loss overpowering next-token loss.
54
+ - Shared expert absorbing too much load.
55
+ - Dropped tokens above 1% for sustained windows.
moe/TRAINING_PLAN.md CHANGED
@@ -5,6 +5,16 @@
5
  Train only on manifest-verified JSONL checkpoints. Do not point the trainer at
6
  raw source directories.
7
 
 
 
 
 
 
 
 
 
 
 
8
  ## Curriculum
9
 
10
  1. Warm up on short and medium FIM examples.
@@ -12,7 +22,7 @@ raw source directories.
12
  3. Add code generation as an auxiliary continuation task.
13
  4. Fine-tune with real-code FIM weighted higher than synthetic continuation.
14
 
15
- ## Defaults
16
 
17
  - Context: start at 2048, then ablate 4096.
18
  - Precision: bf16 on H100.
@@ -20,3 +30,26 @@ raw source directories.
20
  - Grad clipping: enabled.
21
  - MoE aux loss: start small and tune from expert load.
22
  - Top-k: top-2 for training, top-1 as inference ablation only.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  Train only on manifest-verified JSONL checkpoints. Do not point the trainer at
6
  raw source directories.
7
 
8
+ Primary input:
9
+
10
+ ```text
11
+ dataset/<checkpoint>/dataset/*.jsonl
12
+ ```
13
+
14
+ Each 20 GiB checkpoint should be treated as an atomic training unit. Keep the
15
+ checkpoint report beside the run metadata so loss curves can be traced back to
16
+ the exact JSONL files.
17
+
18
  ## Curriculum
19
 
20
  1. Warm up on short and medium FIM examples.
 
22
  3. Add code generation as an auxiliary continuation task.
23
  4. Fine-tune with real-code FIM weighted higher than synthetic continuation.
24
 
25
+ ## H100 Defaults
26
 
27
  - Context: start at 2048, then ablate 4096.
28
  - Precision: bf16 on H100.
 
30
  - Grad clipping: enabled.
31
  - MoE aux loss: start small and tune from expert load.
32
  - Top-k: top-2 for training, top-1 as inference ablation only.
33
+ - Capacity factor: 1.25 for training.
34
+ - Router z-loss: enabled from step 0.
35
+ - Router jitter: small nonzero value during early training.
36
+ - MTP loss: optional, low coefficient, disabled if next-token validation
37
+ worsens.
38
+
39
+ ## Preprocessing
40
+
41
+ - Preserve whitespace and FIM markers exactly.
42
+ - Append `<|endoftext|>` between packed records.
43
+ - Bucket by token length before batching.
44
+ - Track domain and language metadata for router analysis.
45
+ - Do not rebalance by duplicating JSONL files. Rebalance in the dataloader or
46
+ sampler to avoid SSD growth.
47
+
48
+ ## Router Guardrails
49
+
50
+ - If one expert holds more than 35% sustained load, raise aux loss or increase
51
+ shared capacity.
52
+ - If dropped tokens exceed 1%, reduce batch tokens or increase capacity.
53
+ - If router entropy collapses early, lower LR or increase warmup.
54
+ - If domain-to-expert correlation is too strong, improve data mix before adding
55
+ experts.