Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,155 +1,115 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
| 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 |
-
|
| 49 |
-
|
| 50 |
-
We compared Moonlight with SOTA public models at similar scale:
|
| 51 |
|
| 52 |
-
|
| 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 |
-
| |
|
| 59 |
-
|---|---|---|---|---|
|
| 60 |
-
|
|
| 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 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
-
|
| 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 |
-
</
|
| 92 |
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
-
|
| 98 |
-
```python
|
| 99 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 100 |
|
| 101 |
-
|
| 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 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
response = tokenizer.batch_decode(generated_ids)[0]
|
| 114 |
-
print(response)
|
| 115 |
-
```
|
| 116 |
|
| 117 |
-
|
| 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 |
-
|
| 144 |
-
|
| 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> · <b>4.0 bpw</b> · 8.8 GB · Mixture‑of‑Experts · 27 layers × 64 experts</sub>
|
| 22 |
|
| 23 |
+
<br/>
|
| 24 |
|
| 25 |
+
[](https://github.com/turboderp-org/exllamav3)
|
| 26 |
+
[](#quants)
|
| 27 |
+
[](#quants)
|
| 28 |
+
[](https://huggingface.co/moonshotai/Moonlight-16B-A3B)
|
| 29 |
|
| 30 |
+
[](https://huggingface.co/moonshotai/Moonlight-16B-A3B)
|
| 31 |
+
[](https://huggingface.co/blockblockblock)
|
| 32 |
+
[](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‑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 | Head bits | Calibration rows | Size | Status |
|
| 46 |
+
| :---: | :---: | :---: | ---: | :--- |
|
| 47 |
+
| **4.0** | 8 | 128 | **8.8 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‑compatible HTTP server. Drop‑in for OpenAI clients.</td>
|
| 64 |
+
</tr>
|
| 65 |
+
<tr>
|
| 66 |
+
<td><a href="https://github.com/oobabooga/text-generation-webui"><b>text‑generation‑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> <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‑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 & 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> · convention <code>{org}/{model}-exl3-{bpw}bpw</code></i></sub>
|
| 115 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|