ege-konic commited on
Commit
39c84f4
·
verified ·
1 Parent(s): 074fe7c

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +118 -0
README.md ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ base_model: LiquidAI/LFM2.5-8B-A1B
7
+ pipeline_tag: text-generation
8
+ tags:
9
+ - reap
10
+ - pruning
11
+ - moe
12
+ - lfm2
13
+ - liquid-ai
14
+ ---
15
+
16
+ # LFM2.5-8B-A1B-REAP-50
17
+
18
+ ## Model Description
19
+
20
+ This is a **50% expert-pruned** variant of [LiquidAI/LFM2.5-8B-A1B](https://huggingface.co/LiquidAI/LFM2.5-8B-A1B), produced by **REAP** (Ranking and Eliminating Experts via Activation Patterns) pruning.
21
+
22
+ - **Base**: LFM2.5-8B-A1B — 32 experts per MoE layer, 8.47B params, 16.94 GB (bf16)
23
+ - **This model**: 16 experts per MoE layer, 4.59B params, 8.57 GB (bf16)
24
+ - **Compression**: 45.5% size reduction, 50% expert removal
25
+ - **No fine-tuning**: REAP produces an exact subset of original expert weights — gate/router weights and surviving expert weights are bit-for-bit identical to the base model.
26
+
27
+ ## How REAP Works
28
+
29
+ REAP scores each expert's importance using activation patterns from a calibration set, then prunes the lowest-importance experts **per-layer independently**. This is not uniform pruning — different experts survive in different layers:
30
+
31
+ - Expert 27 survives in 73% of layers (most important)
32
+ - Expert 29 survives in 32% of layers (most pruned)
33
+
34
+ **Calibration**: 200 samples from `evol-codealpaca-v1`
35
+ **Tool**: [reap-cuda](https://github.com/egesabanci/reap-cuda)
36
+
37
+ ## Loading
38
+
39
+ ```python
40
+ from transformers import AutoModelForCausalLM, AutoTokenizer
41
+ import torch
42
+
43
+ model = AutoModelForCausalLM.from_pretrained(
44
+ "konic-labs/LFM2.5-8B-A1B-REAP-50",
45
+ trust_remote_code=True,
46
+ dtype=torch.bfloat16,
47
+ device_map="auto",
48
+ )
49
+ tokenizer = AutoTokenizer.from_pretrained(
50
+ "konic-labs/LFM2.5-8B-A1B-REAP-50", trust_remote_code=True
51
+ )
52
+
53
+ messages = [{"role": "user", "content": "What is 2+2?"}]
54
+ text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
55
+ inputs = tokenizer(text, return_tensors="pt").to(model.device)
56
+ out = model.generate(**inputs, max_new_tokens=256, do_sample=False, temperature=None)
57
+ print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
58
+ ```
59
+
60
+ Works with **vLLM** out of the box (native `Lfm2MoeForCausalLM` support).
61
+
62
+ ## Benchmark Results
63
+
64
+ | Benchmark | Base (published) | This model (REAP-50) | Retention |
65
+ |-----------|:------:|:------:|:------:|
66
+ | MATH500 | 88.76% | **77.0%** | 86.7% |
67
+ | BFCLv3 (single-turn) | 64.79% | **59.07%** | 91.1% |
68
+
69
+ ### MATH500 per-difficulty
70
+
71
+ | Level | Accuracy |
72
+ |-------|:--------:|
73
+ | L1 | 90.7% |
74
+ | L2 | 84.4% |
75
+ | L3 | 81.9% |
76
+ | L4 | 82.8% |
77
+ | L5 | 58.2% |
78
+
79
+ ### BFCLv3 per-category
80
+
81
+ | Category | Accuracy |
82
+ |----------|:--------:|
83
+ | simple_python | 78.50% |
84
+ | multiple | 85.00% |
85
+ | parallel | 70.00% |
86
+ | parallel_multiple | 70.50% |
87
+ | irrelevance | 80.00% |
88
+ | live_simple | 60.47% |
89
+ | live_multiple | 54.32% |
90
+ | live_parallel | 31.25% |
91
+ | live_parallel_multiple | 54.17% |
92
+ | live_irrelevance | 75.90% |
93
+ | live_relevance | 68.75% |
94
+
95
+ ## Throughput (vLLM, NVIDIA L4)
96
+
97
+ | Config | Tokens/sec |
98
+ |--------|:-----------:|
99
+ | Offline batch (500 prompts) | 1,280 |
100
+ | HTTP server (conc=256) | 2,282 |
101
+
102
+ ## Intended Use
103
+
104
+ Research and deployment of compressed MoE models. This is the intermediate pruning stage — apply your own quantization (AWQ, GPTQ, etc.) on top, or use directly in bf16.
105
+
106
+ ## Citation
107
+
108
+ ```
109
+ @software{reap-cuda,
110
+ title = {REAP: Ranking and Eliminating Experts via Activation Patterns},
111
+ author = {Konic Labs},
112
+ url = {https://github.com/egesabanci/reap-cuda}
113
+ }
114
+ ```
115
+
116
+ ## License
117
+
118
+ Apache-2.0 (inherited from base model).