ThatsNinja commited on
Commit
0a8099a
·
verified ·
1 Parent(s): c3f52e5

Upload correctness_model/docs/rfcs/RFC0008-Base-Model-GLM-Edge.md with huggingface_hub

Browse files
correctness_model/docs/rfcs/RFC0008-Base-Model-GLM-Edge.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ author: Correctness Model Team
3
+ created: 2026-08-03
4
+ modified: 2026-08-04
5
+ status: implemented
6
+ ---
7
+
8
+ # RFC0008: Base Model Selection - GLM-Edge 1.5B Chat
9
+
10
+ ## Overview
11
+
12
+ This RFC selects the base model for the correctness-focused training
13
+ architecture (RFC0007). The base model must be:
14
+ 1. Small enough to train on 16GB gfx1030 (RX 6900 XT)
15
+ 2. Compatible with PyTorch (chosen framework)
16
+ 3. Open-source with permissive license
17
+ 4. A good foundation for the verifier/feedback mechanisms
18
+
19
+ ## Decision: GLM-Edge 1.5B Chat
20
+
21
+ **GLM-Edge 1.5B Chat** is selected as the base model.
22
+
23
+ ### Why GLM-Edge 1.5B Chat
24
+
25
+ - **Size**: ~1.5B params (2B total with embeddings) - trainable on 16GB gfx1030
26
+ - **Edge-focused**: designed for mobile/car/PC platforms - aligns with our
27
+ small-hardware goal
28
+ - **PyTorch support**: native transformers integration
29
+ - **License**: Apache 2.0 (code), GLM-4 model license (weights)
30
+ - **Proven efficiency**: 60+ tokens/s on edge NPUs, INT4 quantization support
31
+ - **Fine-tuning support**: official LoRA/SFT fine-tuning scripts provided
32
+ - **BF16 native**: uses bfloat16 (matches our precision strategy)
33
+
34
+ ### Model Details
35
+
36
+ - **Architecture**: GLM-4 based (dense, not MoE)
37
+ - **Precision**: BF16 native
38
+ - **Context**: designed for edge deployment
39
+ - **Family**: GLM-Edge-1.5B-Chat, GLM-Edge-4B-Chat, GLM-Edge-V-2B/5B (vision)
40
+
41
+ ## Alternatives Considered
42
+
43
+ ### 1. GLM-Edge 4B Chat
44
+ - **Pros**: More capable
45
+ - **Cons**: Larger, harder to train on 16GB
46
+ - **Verdict**: Deferred - use 1.5B for initial experiments
47
+
48
+ ### 2. Llama 3.2 1B / 3B
49
+ - **Pros**: Well-supported, standard architecture
50
+ - **Cons**: Not edge-optimized, no official edge fine-tuning focus
51
+ - **Verdict**: Viable alternative, but GLM-Edge is more aligned with our
52
+ small-hardware goal
53
+
54
+ ### 3. Qwen2.5 0.5B / 1.5B
55
+ - **Pros**: Small, well-supported
56
+ - **Cons**: Less edge-focused than GLM-Edge
57
+ - **Verdict**: Viable alternative
58
+
59
+ ### 4. Custom small model from scratch
60
+ - **Pros**: Full control
61
+ - **Cons**: Requires training from scratch (expensive), no pretrained weights
62
+ - **Verdict**: Deferred - use pretrained GLM-Edge as base, fine-tune
63
+
64
+ ## Integration with Correctness Architecture
65
+
66
+ ### Feature Extraction
67
+
68
+ GLM-Edge uses standard GLM-4 attention. To extract verifier features
69
+ (RFC0002), we hook into the attention module:
70
+ - Attention weights (per head)
71
+ - Output statistics
72
+ - Softmax entropy
73
+ - Cross-head consistency
74
+
75
+ ### Training Stages (RFC0007)
76
+
77
+ 1. **base**: GLM-Edge already pretrained - use as-is or fine-tune
78
+ 2. **verifier**: train verifier on GLM-Edge internal states + correctness labels
79
+ 3. **feedback**: train feedback policy
80
+ 4. **sparse**: learn sparse attention mask
81
+
82
+ ### Hardware Fit (gfx1030, 16GB)
83
+
84
+ - 1.5B params in BF16 = ~3GB weights
85
+ - Leaves ~13GB for activations, KV cache, optimizer states
86
+ - Feasible for fine-tuning with LoRA or full fine-tuning with gradient
87
+ checkpointing
88
+ - Our optimizations (block-sparse RFC0003, latent compression RFC0005,
89
+ FP8 RFC0006) further reduce memory
90
+
91
+ ## Prerequisites
92
+
93
+ 1. **PyTorch with ROCm support** - not yet installed (see RFC0009)
94
+ 2. **transformers** library (from source, per GLM-Edge docs)
95
+ 3. **Model weights** - download from HuggingFace
96
+ 4. **GLM-Edge repo** - for fine-tuning scripts
97
+
98
+ ## Regression Plan
99
+
100
+ - GLM-Edge 1.5B Chat loads and runs in PyTorch on gfx1030
101
+ - Feature extraction captures internal states correctly
102
+ - Verifier training converges
103
+ - Correctness rate improves vs baseline
104
+
105
+ ## Communication
106
+
107
+ - Depends on RFC0007 (training architecture)
108
+ - Requires RFC0009 (PyTorch ROCm setup)
109
+ - Builds on RFC0001-0006 (kernel, sparse, latent, FP8)
110
+
111
+ ## References
112
+
113
+ - GLM-Edge repo: github.com/zai-org/GLM-Edge
114
+ - GLM-Edge 1.5B Chat: huggingface.co/zai-org/glm-edge-1.5b-chat
115
+ - License: Apache 2.0 (code), GLM-4 (weights)