blockblockblock commited on
Commit
09218b7
·
verified ·
1 Parent(s): bd512e2

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +85 -125
README.md CHANGED
@@ -1,155 +1,115 @@
1
  ---
2
  license: mit
3
- library_name: transformers
 
 
 
 
 
 
 
 
 
 
 
4
  ---
5
- <div align="center">
6
- <a href="https://github.com/MoonshotAI/Moonlight"><img width="80%" src="figures/banner.png"></a>
7
- </div>
8
-
9
- <!-- # Muon is Scalable For LLM Training -->
10
 
11
  <div align="center">
12
- <a href="https://github.com/MoonshotAI/Moonlight/blob/master/Moonlight.pdf" ><img src="figures/logo.png" height="16" width="16" style="display: inline-block; vertical-align: middle; margin: 2px;"><b style="display: inline-block;"> Tech Report</b></a> |
13
- <a href="https://huggingface.co/moonshotai/Moonlight-16B-A3B"><img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" height="16" width="16" style="display: inline-block; vertical-align: middle; margin: 2px;"><b style="display: inline-block;"> HuggingFace</b></a> |
14
- <a href="#"><img src="figures/megatron.png" height="16" width="16" style="display: inline-block; vertical-align: middle; margin: 2px;"><b style="display: inline-block;">Megatron(coming soon)</b></a>
15
- </div>
16
-
17
-
18
- ## Abstract
19
- Recently, the [Muon optimizer](https://github.com/KellerJordan/Muon) has demonstrated strong results in training small-scale language models, but the scalability to larger models has not been proven. We identify two crucial techniques for scaling up Muon:
20
-
21
- - **Weight Decay**: Critical for scaling to larger models
22
- - **Consistent RMS Updates**: Enforcing a consistent root mean square on model updates
23
 
24
- These techniques allow Muon to work out-of-the-box on large-scale training without the need of hyper-parameter tuning. Scaling law experiments indicate that Muon is $\sim2\times$ more sample efficient than Adam with compute optimal training.
25
 
26
- Based on these improvements, we introduce **Moonlight**, a 3B/16B-parameter Mixture-of-Expert (MoE) model trained with 5.7T tokens using Muon. Our model improves the current Pareto frontier, achieving better performance with much fewer training FLOPs compared to prior models.
27
 
28
- We open-source our Muon implementation that is memory optimal and communication efficient. We also release the pretrained, instruction-tuned, and intermediate checkpoints to support future research.
29
 
30
- Our code is available at [MoonshotAI/Moonlight](https://github.com/MoonshotAI/Moonlight).
 
 
 
31
 
32
- ## Key Ingredients
 
 
33
 
34
- Our work builds upon Muon while systematically identifying and resolving its limitations in large-scale training scenarios. Our technical contributions include:
35
-
36
- - **Analysis for Effective Scaling of Muon**: Through extensive analysis, we identify that weight decay plays a crucial roles in Muon's scalability. Besides, we proposed to keep a consistent update root mean square (RMS) across different matrix and non-matrix parameters through parameter-wise update scale adjustments. Such adjustments significantly enhanced training stability.
37
-
38
- - **Efficient Distributed Implementation**: We develop a distributed version of Muon with ZeRO-1 style optimization, achieving optimal memory efficiency and reduced communication overhead while preserving the mathematical properties of the algorithm.
39
-
40
- - **Scaling Law Validation**: We performed scaling law research that compares Muon with strong AdamW baselines, and showed the superior performance of Muon (see Figure 1). Based on the scaling law results, Muon achieves comparable performance to AdamW trained counterparts while requiring only approximately 52% of the training FLOPs.
41
-
42
- <div align="center">
43
- <img width="90%" src="figures/scaling.png">
44
- <p><em>Scaling up with Muon. <b>(a)</b> Scaling law experiments comparing Muon and Adam. Muon is 2 times more sample efficient than Adam. <b>(b)</b> The MMLU performance of our Moonlight model optimized with Muon and other comparable models. Moonlight advances the Pareto frontier of performance vs training FLOPs.</em></p>
45
  </div>
46
 
 
47
 
48
- ## Performance
49
-
50
- We compared Moonlight with SOTA public models at similar scale:
51
 
52
- - **LLAMA3-3B** is a 3B-parameter dense model trained with 9T tokens
53
- - **Qwen2.5-3B** is a 3B-parameter dense model trained with 18T tokens
54
- - **Deepseek-v2-Lite** is a 2.4B/16B-parameter MOE model trained with 5.7T tokens
55
 
56
  <div align="center">
57
 
58
- | | **Benchmark (Metric)** | **Llama3.2-3B** | **Qwen2.5-3B** | **DSV2-Lite** | **Moonlight** |
59
- |---|---|---|---|---|---|
60
- | | Activated Param† | 2.81B | 2.77B | 2.24B | 2.24B |
61
- | | Total Params† | 2.81B | 2.77B | 15.29B | 15.29B |
62
- | | Training Tokens | 9T | 18T | 5.7T | 5.7T |
63
- | | Optimizer | AdamW | * | AdamW | Muon |
64
- | **English** | MMLU | 54.75 | 65.6 | 58.3 | **70.0** |
65
- | | MMLU-pro | 25.0 | 34.6 | 25.5 | **42.4** |
66
- | | BBH | 46.8 | 56.3 | 44.1 | **65.2** |
67
- | | TriviaQA‡ | 59.6 | 51.1 | 65.1 | **66.3** |
68
- | **Code** | HumanEval | 28.0 | 42.1 | 29.9 | **48.1** |
69
- | | MBPP | 48.7 | 57.1 | 43.2 | **63.8** |
70
- | **Math** | GSM8K | 34.0 | **79.1** | 41.1 | 77.4 |
71
- | | MATH | 8.5 | 42.6 | 17.1 | **45.3** |
72
- | | CMath | - | 80.0 | 58.4 | **81.1** |
73
- | **Chinese** | C-Eval | - | 75.0 | 60.3 | **77.2** |
74
- | | CMMLU | - | 75.0 | 64.3 | **78.2** |
75
 
76
  </div>
77
 
78
- *Qwen 2 & 2.5 reports didn't disclose their optimizer information. †The reported parameter counts exclude the embedding parameters. ‡We test all listed models with the full set of TriviaQA.*
79
-
80
-
81
- ## Example usage
82
- ### Model Download
83
-
84
- <div align="center">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
- | **Model** | **#Total Params** | **#Activated Params** | **Context Length** | **Download Link** |
87
- | :------------: | :------------: | :------------: | :------------: | :------------: |
88
- | Moonlight-16B-A3B | 16B | 3B | 8K | [🤗 Hugging Face](https://huggingface.co/moonshotai/Moonlight-16B-A3B) |
89
- | Moonlight-16B-A3B-Instruct | 16B | 3B | 8K | [🤗 Hugging Face](https://huggingface.co/moonshotai/Moonlight-16B-A3B-Instruct) |
90
 
91
- </div>
92
 
93
- ### Inference with Hugging Face Transformers
 
 
 
 
 
 
 
 
94
 
95
- We introduce how to use our model at inference stage using transformers library. It is recommended to use python=3.10, torch>=2.1.0, and transformers=4.48.2 as the development environment.
96
 
97
- For our pretrained model (Moonlight-16B-A3B):
98
- ```python
99
- from transformers import AutoModelForCausalLM, AutoTokenizer
100
 
101
- model_name = "moonshotai/Moonlight-16B-A3B"
102
- model = AutoModelForCausalLM.from_pretrained(
103
- model_name,
104
- torch_dtype="auto",
105
- device_map="auto",
106
- trust_remote_code=True,
107
- )
108
- tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
109
 
110
- prompt = "1+1=2, 1+2="
111
- inputs = tokenizer(prompt, return_tensors="pt", padding=True, truncation=True).to(model.device)
112
- generated_ids = model.generate(**inputs, max_new_tokens=100)
113
- response = tokenizer.batch_decode(generated_ids)[0]
114
- print(response)
115
- ```
116
 
117
- For our instruct model (Moonlight-16B-A3B-Instruct):
118
-
119
- ```python
120
- from transformers import AutoModelForCausalLM, AutoTokenizer
121
-
122
- model_name = "moonshotai/Moonlight-16B-A3B-Instruct"
123
- model = AutoModelForCausalLM.from_pretrained(
124
- model_name,
125
- torch_dtype="auto",
126
- device_map="auto",
127
- trust_remote_code=True
128
- )
129
- tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
130
-
131
- messages = [
132
- {"role": "system", "content": "You are a helpful assistant provided by Moonshot-AI."},
133
- {"role": "user", "content": "Is 123 a prime?"}
134
- ]
135
- input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
136
- generated_ids = model.generate(inputs=input_ids, max_new_tokens=500)
137
- response = tokenizer.batch_decode(generated_ids)[0]
138
- print(response)
139
- ```
140
-
141
- Moonlight has the same architecture as DeepSeek-V3, which is supported by many popular inference engines, such as VLLM and SGLang. As a result, our model can also be easily deployed using these tools.
142
 
143
- ## Citation
144
- If you find Moonlight is useful or want to use in your projects, please kindly cite our paper:
145
- ```
146
- @misc{liu2025muonscalablellmtraining,
147
- title={Muon is Scalable for LLM Training},
148
- author={Jingyuan Liu and Jianlin Su and Xingcheng Yao and Zhejun Jiang and Guokun Lai and Yulun Du and Yidao Qin and Weixin Xu and Enzhe Lu and Junjie Yan and Yanru Chen and Huabin Zheng and Yibo Liu and Shaowei Liu and Bohong Yin and Weiran He and Han Zhu and Yuzhi Wang and Jianzhou Wang and Mengnan Dong and Zheng Zhang and Yongsheng Kang and Hao Zhang and Xinran Xu and Yutao Zhang and Yuxin Wu and Xinyu Zhou and Zhilin Yang},
149
- year={2025},
150
- eprint={2502.16982},
151
- archivePrefix={arXiv},
152
- primaryClass={cs.LG},
153
- url={https://arxiv.org/abs/2502.16982},
154
- }
155
- ```
 
1
  ---
2
  license: mit
3
+ base_model: moonshotai/Moonlight-16B-A3B
4
+ base_model_relation: quantized
5
+ quantized_by: blockblockblock
6
+ library_name: exllamav3
7
+ pipeline_tag: text-generation
8
+ tags:
9
+ - exl3
10
+ - exllamav3
11
+ - quantized
12
+ - mixture-of-experts
13
+ quantization_format: exl3
14
+ bits_per_weight: 4.0
15
  ---
 
 
 
 
 
16
 
17
  <div align="center">
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ # Moonlight · 16B · A3B
20
 
21
+ <sub><code>EXL3</code> &nbsp;·&nbsp; <b>4.0&nbsp;bpw</b> &nbsp;·&nbsp; 8.8&nbsp;GB &nbsp;·&nbsp; Mixture&#8209;of&#8209;Experts &nbsp;·&nbsp; 27 layers &times; 64 experts</sub>
22
 
23
+ <br/>
24
 
25
+ [![format](https://img.shields.io/badge/format-EXL3-c63010?style=for-the-badge&labelColor=14120e)](https://github.com/turboderp-org/exllamav3)
26
+ [![bpw](https://img.shields.io/badge/bpw-4.0-6b8a76?style=for-the-badge&labelColor=14120e)](#quants)
27
+ [![size](https://img.shields.io/badge/size-8.8_GB-6b8a76?style=for-the-badge&labelColor=14120e)](#quants)
28
+ [![arch](https://img.shields.io/badge/arch-DeepseekV3_16B--A3B-c63010?style=for-the-badge&labelColor=14120e)](https://huggingface.co/moonshotai/Moonlight-16B-A3B)
29
 
30
+ [![base model](https://img.shields.io/badge/Base-moonshotai%2FMoonlight--16B--A3B-2a2620?style=flat-square&logo=huggingface&logoColor=white)](https://huggingface.co/moonshotai/Moonlight-16B-A3B)
31
+ [![quantized by](https://img.shields.io/badge/Quantized_by-blockblockblock-2a2620?style=flat-square&logo=huggingface&logoColor=white)](https://huggingface.co/blockblockblock)
32
+ [![collection](https://img.shields.io/badge/All_bpws-Collection-c63010?style=flat-square&logo=huggingface&logoColor=white)](https://huggingface.co/collections/blockblockblock/moonlight-16b-a3b-exl3-6a45c909308a40a29ad4a3b1)
33
 
 
 
 
 
 
 
 
 
 
 
 
34
  </div>
35
 
36
+ ---
37
 
38
+ > [!NOTE]
39
+ > An [ExLlamaV3](https://github.com/turboderp-org/exllamav3) build of [`moonshotai/Moonlight-16B-A3B`](https://huggingface.co/moonshotai/Moonlight-16B-A3B) at **4.0 bits per weight**. See [Quants](#quants) for sibling repos at other bit&#8209;widths or browse the [collection](https://huggingface.co/collections/blockblockblock/moonlight-16b-a3b-exl3-6a45c909308a40a29ad4a3b1).
 
40
 
41
+ ## Quants
 
 
42
 
43
  <div align="center">
44
 
45
+ | BPW &nbsp; | &nbsp; Head bits &nbsp; | &nbsp; Calibration rows &nbsp; | &nbsp; Size &nbsp; | &nbsp; Status |
46
+ | :---: | :---: | :---: | ---: | :--- |
47
+ | **4.0** | 8 | 128 | **8.8&nbsp;GB** | <kbd>this repo</kbd> |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  </div>
50
 
51
+ ## Inference
52
+
53
+ <table>
54
+ <thead>
55
+ <tr>
56
+ <th align="left" width="32%">Loader</th>
57
+ <th align="left">Use it for</th>
58
+ </tr>
59
+ </thead>
60
+ <tbody>
61
+ <tr>
62
+ <td><a href="https://github.com/theroyallab/tabbyAPI"><b>TabbyAPI</b></a></td>
63
+ <td>OpenAI&#8209;compatible HTTP server. Drop&#8209;in for OpenAI clients.</td>
64
+ </tr>
65
+ <tr>
66
+ <td><a href="https://github.com/oobabooga/text-generation-webui"><b>text&#8209;generation&#8209;webui</b></a></td>
67
+ <td>Local chat UI. Pick the <i>ExLlamaV3</i> loader from the model dropdown.</td>
68
+ </tr>
69
+ <tr>
70
+ <td><a href="https://github.com/turboderp-org/exllamav3"><b>ExLlamaV3</b></a></td>
71
+ <td>Direct Python API for embedding the model in your own code or pipeline.</td>
72
+ </tr>
73
+ </tbody>
74
+ </table>
75
+
76
+ ## Download
77
+
78
+ ```bash
79
+ pip install -U huggingface_hub
80
+
81
+ hf download \
82
+ blockblockblock/Moonlight-16B-A3B-exl3-4.0bpw \
83
+ --local-dir ./Moonlight-16B-A3B-exl3-4.0bpw
84
+ ```
85
 
86
+ <details>
87
+ <summary><b>Quantization recipe</b> &nbsp;<sub>(advanced, embedded in <code>quantization_config.json</code>)</sub></summary>
 
 
88
 
89
+ <br/>
90
 
91
+ | Setting | Value |
92
+ | :--- | :--- |
93
+ | Format | `EXL3` |
94
+ | Bits per weight | `4.0` |
95
+ | Head bits | `8` |
96
+ | Calibration rows | `128` |
97
+ | Codebook | `MCG` |
98
+ | Out&#8209;scales | `always` |
99
+ | Parallel mode | `enabled` (MoE expert batching) |
100
 
101
+ Loaded automatically by every ExLlamaV3 loader; reproduced here for searchability.
102
 
103
+ </details>
 
 
104
 
105
+ ## License &amp; use
 
 
 
 
 
 
 
106
 
107
+ > [!IMPORTANT]
108
+ > Use and license **follow the [base model](https://huggingface.co/moonshotai/Moonlight-16B-A3B)**.
109
+ > Quantization adds no additional restrictions. Refer to the upstream repository for terms, citation, and safety documentation.
 
 
 
110
 
111
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
+ <div align="center">
114
+ <sub><i>Quantized with <a href="https://github.com/Honkware/blockquant"><b>BlockQuant</b></a> &nbsp;·&nbsp; convention&nbsp;<code>{org}/{model}-exl3-{bpw}bpw</code></i></sub>
115
+ </div>
 
 
 
 
 
 
 
 
 
 
Free AI Image Generator No sign-up. Instant results. Open Now