bokyeong1015
commited on
Commit
•
96680bc
1
Parent(s):
8170f99
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Shortened LLM Model Card
|
2 |
+
|
3 |
+
Shortened LLM is a depth-pruned version of large language models for efficient text generation.
|
4 |
+
|
5 |
+
- **Developed by:** [Nota AI](https://www.nota.ai/)
|
6 |
+
- **License:** Non-commercial license
|
7 |
+
- **Repository:** https://github.com/Nota-NetsPresso/shortened-llm
|
8 |
+
- **Paper:** https://arxiv.org/abs/2402.02834
|
9 |
+
|
10 |
+
## Compression Method
|
11 |
+
* After identifying unimportant Transformer blocks, we perform **one-shot pruning**.
|
12 |
+
* In retraining pruned models for quality recovery, **continued pretraining (CPT)** on a large corpus markedly outperforms LoRA-based tuning, particularly at severe pruning ratios.
|
13 |
+
|
14 |
+
## Models from Aggressive Pruning & CPT Retraining (arXiv-v2):
|
15 |
+
| Source<br>Model | Pruning<br>Ratio | Pruning<br>Criterion | HF Models<br>Link |
|
16 |
+
|:---:|:---:|:---:|:---:|
|
17 |
+
| Vicuna-v1.3-7B | 20% | PPL | [nota-ai/cpt_st-vicuna-v1.3-5.5b-ppl](https://huggingface.co/nota-ai/cpt_st-vicuna-v1.3-5.5b-ppl) |
|
18 |
+
| Vicuna-v1.3-7B | 45% | PPL | [nota-ai/cpt_st-vicuna-v1.3-3.7b-ppl](https://huggingface.co/nota-ai/cpt_st-vicuna-v1.3-3.7b-ppl) |
|
19 |
+
| Vicuna-v1.3-7B | 60% | PPL | [nota-ai/cpt_st-vicuna-v1.3-2.7b-ppl](https://huggingface.co/nota-ai/cpt_st-vicuna-v1.3-2.7b-ppl) |
|
20 |
+
| Vicuna-v1.3-7B | 80% | PPL | [nota-ai/cpt_st-vicuna-v1.3-1.5b-ppl](https://huggingface.co/nota-ai/cpt_st-vicuna-v1.3-1.5b-ppl) |
|
21 |
+
|
22 |
+
<details>
|
23 |
+
<summary>
|
24 |
+
Click to see the results:
|
25 |
+
</summary>
|
26 |
+
|
27 |
+
- EleutherAI/lm-evaluation-harness version [3326c54](https://github.com/EleutherAI/lm-evaluation-harness/tree/3326c547a733d598b4377e54be96e194861b964c)
|
28 |
+
|
29 |
+
<img alt="results" img src="https://netspresso-research-code-release.s3.us-east-2.amazonaws.com/compressed-llm/st_llm-cpt_results.png" width="100%">
|
30 |
+
|
31 |
+
</details>
|
32 |
+
|
33 |
+
#### Experimental Setup for CPT of Pruned Vicuna-7B
|
34 |
+
* Dataset: [SlimPajama-627B](https://huggingface.co/datasets/cerebras/SlimPajama-627B)
|
35 |
+
* Training using 8 NVIDIA H100 GPUs.
|
36 |
+
* 5.5B parameters: 37B training tokens (for 6 days)
|
37 |
+
* 3.7B parameters: 74B tokens (for 8 days)
|
38 |
+
* 2.7B parameters: 150B tokens (for 12 days)
|
39 |
+
* 1.5B parameters: 271B tokens (for 11 days)
|
40 |
+
* AdamW optimizer with (β1, β2)=(0.9, 0.95); a learning rate of 0.0001; a weight decay of 0.1.
|
41 |
+
* Global batch size: 512 (micro-batch size of 2 × 32 gradient accumulation steps × 8 GPUs).
|
42 |
+
|
43 |
+
<details>
|
44 |
+
<summary>
|
45 |
+
Click to see the learning curve:
|
46 |
+
</summary>
|
47 |
+
|
48 |
+
**Zero-shot performance over the course of training for models from Vicuna-7B-v1.3 at different pruning ratios.** For each model size, the CPT duration was limited to a two-week period, but additional training could further improve the quality.
|
49 |
+
|
50 |
+
<img alt="results" img src="https://netspresso-research-code-release.s3.us-east-2.amazonaws.com/compressed-llm/st_llm-cpt_learning-curve.png" width="100%">
|
51 |
+
|
52 |
+
</details>
|
53 |
+
|
54 |
+
|
55 |
+
|
56 |
+
## Models from Moderate Pruning & LoRA Retraining (arXiv-v1):
|
57 |
+
| Source<br>Model | Pruning<br>Ratio | Pruning<br>Criterion | HF Models<br>Link |
|
58 |
+
|:---:|:---:|:---:|:---:|
|
59 |
+
| LLaMA-1-7B | 20% | PPL | [nota-ai/st-llama-1-5.5b-ppl](https://huggingface.co/nota-ai/st-llama-1-5.5b-ppl) |
|
60 |
+
| LLaMA-1-7B | 20% | Taylor+ | [nota-ai/st-llama-1-5.5b-taylor](https://huggingface.co/nota-ai/st-llama-1-5.5b-taylor) |
|
61 |
+
| Vicuna-v1.3-7B | 20% | PPL | [nota-ai/st-vicuna-v1.3-5.5b-ppl](https://huggingface.co/nota-ai/st-vicuna-v1.3-5.5b-ppl) |
|
62 |
+
| Vicuna-v1.3-7B | 20% | Taylor+ | [nota-ai/st-vicuna-v1.3-5.5b-taylor](https://huggingface.co/nota-ai/st-vicuna-v1.3-5.5b-taylor) |
|
63 |
+
| Vicuna-v1.3-13B | 21% | PPL | [nota-ai/st-vicuna-v1.3-10.5b-ppl](https://huggingface.co/nota-ai/st-vicuna-v1.3-10.5b-ppl) |
|
64 |
+
| Vicuna-v1.3-13B | 21% | Taylor+ | [nota-ai/st-vicuna-v1.3-10.5b-taylor](https://huggingface.co/nota-ai/st-vicuna-v1.3-10.5b-taylor) |
|
65 |
+
|
66 |
+
<details>
|
67 |
+
|
68 |
+
<summary>
|
69 |
+
Click to see the results:
|
70 |
+
</summary>
|
71 |
+
|
72 |
+
- EleutherAI/lm-evaluation-harness version [3326c54](https://github.com/EleutherAI/lm-evaluation-harness/tree/3326c547a733d598b4377e54be96e194861b964c)
|
73 |
+
|
74 |
+
<img alt="results" img src="https://netspresso-research-code-release.s3.us-east-2.amazonaws.com/compressed-llm/st-llama_zero-shot_scores.png" width="100%">
|
75 |
+
|
76 |
+
</details>
|
77 |
+
|
78 |
+
## License
|
79 |
+
- All rights related to this repository and the compressed models are reserved by Nota Inc.
|
80 |
+
- The intended use is strictly limited to research and non-commercial projects.
|
81 |
+
|
82 |
+
## Acknowledgments
|
83 |
+
- [Microsoft for Startups Founders Hub](https://www.microsoft.com/en-us/startups) and [Gwangju AICA](http://www.aica-gj.kr/main.php) for generously providing GPU resources.
|
84 |
+
- [LLM-Pruner](https://github.com/horseee/LLM-Pruner), which utilizes [LM Evaluation Harness](https://github.com/EleutherAI/lm-evaluation-harness), [PEFT](https://github.com/huggingface/peft), and [Alpaca-LoRA](https://github.com/tloen/alpaca-lora). Thanks for the pioneering work on structured pruning of LLMs!
|
85 |
+
- Meta AI's [LLaMA](https://github.com/facebookresearch/llama) and LMSYS Org's [Vicuna](https://github.com/lm-sys/FastChat/blob/main/docs/vicuna_weights_version.md). Thanks for the open-source LLMs!
|
86 |
+
|
87 |
+
## Citation
|
88 |
+
```bibtex
|
89 |
+
@article{kim2024shortened,
|
90 |
+
title={Shortened LLaMA: Depth Pruning for Large Language Models with Comparison of Retraining Methods},
|
91 |
+
author={Kim, Bo-Kyeong and Kim, Geonmin and Kim, Tae-Ho and Castells, Thibault and Choi, Shinkook and Shin, Junho and Song, Hyoung-Kyu},
|
92 |
+
journal={arXiv preprint arXiv:2402.02834},
|
93 |
+
year={2024},
|
94 |
+
url={https://arxiv.org/abs/2402.02834}
|
95 |
+
}
|
96 |
+
```
|
97 |
+
```bibtex
|
98 |
+
@article{kim2024mefomo,
|
99 |
+
title={Shortened LLaMA: A Simple Depth Pruning for Large Language Models},
|
100 |
+
author={Kim, Bo-Kyeong and Kim, Geonmin and Kim, Tae-Ho and Castells, Thibault and Choi, Shinkook and Shin, Junho and Song, Hyoung-Kyu},
|
101 |
+
journal={ICLR Workshop on Mathematical and Empirical Understanding of Foundation Models (ME-FoMo)},
|
102 |
+
year={2024},
|
103 |
+
url={https://openreview.net/forum?id=18VGxuOdpu}
|
104 |
+
}
|
105 |
+
```
|