MartialTerran commited on
Commit
44a2a95
·
verified ·
1 Parent(s): ab82086

Delete GLM-5.2 Vocabulary Efficiency Improvements.md

Browse files
GLM-5.2 Vocabulary Efficiency Improvements.md DELETED
@@ -1,82 +0,0 @@
1
- # GLM-5.2 Vocabulary Pruning Candidates (`glm_5.2_prune_candidates.json`)
2
-
3
- Identified by Martial Terran, LLM Vocabulary Reduction Specialist, this repository provides a curated list of Token IDs that are candidates for pruning or deactivation from the GLM-5.2 model's active inference weights, tokenizer configuration, and output projection layers.
4
-
5
- The pruning configuration in `glm_5.2_prune_candidates.json` maps directly to rows that can be safely modified or removed within:
6
- * `config.json`
7
- * `tokenizer_config.json`
8
- * `tokenizer.json`
9
- * `chat_template.jinja`
10
- * **Input Embeddings:** `model.embed_tokens.weight` `{Shape: torch.Size([154880, 6144])}` in shard `model-00001-of-00282.safetensors`
11
- * **LM Head Projection:** `lm_head.weight` `{Shape: torch.Size([154880, 6144])}` in shard `model-00001-of-00282.safetensors`
12
-
13
- **Target Repository ID:** `zai-org/GLM-5.2`
14
-
15
- By safely deactivating or pruning these identified Token IDs from the active `lm_head` and `embed_tokens` matrices, you can reduce the parameter footprint and improve inference throughput.
16
-
17
- ---
18
-
19
- ## Pruning Efficiency Gains
20
-
21
- Pruning these 331 inactive tokens translates to a reduction of **~20.34 Billion MACs** per 10,000 tokens of processed context.
22
-
23
- ### Resource Reduction Report
24
- * **Number of Dead Tokens Identified:** 331
25
- * **Vocabulary Reduction:** 0.21% of the total vocabulary
26
- * **Memory Saved (Raw Weights):** 7.76 MB (at FP16/BF16 precision)
27
- * **Total Parameters Removed:** 4,067,328 parameters
28
-
29
- ### Inference Efficiency (per 10,000 tokens)
30
- * **MACs Saved:** 20.34 Billion MACs
31
- * **FLOPs Saved:** 40.67 GFLOPs
32
-
33
- ---
34
-
35
- ## Hardware-Aware Performance Profile
36
-
37
- To evaluate the real-world performance impact of pruning these tokens, we look beyond raw FLOP counts. During LLM deployment, execution is split into two fundamentally different hardware regimes:
38
-
39
- 1. **Prefill Phase (Prompt Processing):** Compute-bound (GEMM). FLOP/MAC savings scale linearly with context length and batch size.
40
- 2. **Decode Phase (Autoregressive Generation):** Memory-bandwidth bound (GEMV). The bottleneck is streaming the weight matrices from GPU High Bandwidth Memory (HBM) to SRAM/Registers. FLOP savings are secondary to **HBM read throughput savings**.
41
-
42
- ### 1. Bandwidth Savings vs. FLOP Savings
43
- During the **Decode Phase**, GPU execution is heavily bound by memory bandwidth. By removing the elements identified in `glm_5.2_prune_candidates.json` from the `lm_head`, we save **3.14 MB of HBM reads per token generation step** (independent of batch size, as the weight matrix is streamed to SRAM once per step).
44
-
45
- ### 2. Latency Profile Generation
46
- The table below translates these memory bandwidth savings into theoretical clock-time savings across NVIDIA A100, H100, and H200 accelerators based on raw hardware throughput limits.
47
-
48
- ---
49
-
50
- ## GLM-5.2 Hardware-Aligned Pruning Report
51
-
52
- ```text
53
- ================================================================================
54
- GLM-5.2 HARDWARE-ALIGNED PRUNING REPORT (d_model=6144)
55
- ================================================================================
56
- --- 1. VOCABULARY ALIGNMENT ANALYSIS (CUDA Warp / Tensor Core Optimization) ---
57
- Original Vocabulary Size: 154,880 (Multiple of 128)
58
- Raw Dead Tokens Identified: 331 (0.214% of vocab)
59
- Target Alignment Block Size: 128 tokens
60
- Optimized Aligned Vocab Size: 154,624
61
- Actual Tokens Pruned: 256 (Safely deleted rows)
62
- Padding Tokens Kept for Performance:75 (Preserves warp speed & coalescing)
63
- Effective Vocabulary Reduction: 0.165%
64
-
65
- --- 2. STATIC FOOTPRINT REDUCTIONS (FP16/BF16 Precision) ---
66
- Weights Memory Saved: 6.000 MB (Aligned) / 7.760 MB (Raw)
67
- Total Parameters Trimmed: 3,145,728 parameters
68
- Input Embedding Matrix Shrinkage: 256 x 6144
69
- Output LM Head Matrix Shrinkage: 256 x 6144
70
-
71
- --- 3. PREFILL PHASE PROFILE (Compute-Bound: GEMM) ---
72
- Execution Target Context: 8,192 tokens (Batch Size: 8)
73
- Computational MACs Saved: 103.0792 Billion MACs
74
- Computational FLOPs Saved: 206.1584 GFLOPs
75
-
76
- --- 4. DECODE PHASE PROFILE (Bandwidth-Bound: GEMV) ---
77
- HBM Data Stream Saved per Step: 3072.00 KB / token step
78
- Theoretical Hardware Latency Saved per Autoregressive Step:
79
- * NVIDIA A100 (SXM4) | Bandwidth: 2.039 TB/s | Saved: 1542.78 ns
80
- * NVIDIA H100 (SXM5) | Bandwidth: 3.350 TB/s | Saved: 939.02 ns
81
- * NVIDIA H200 (SXM) | Bandwidth: 4.800 TB/s | Saved: 655.36 ns
82
- ================================================================================