File size: 1,780 Bytes
5e244a3
cacdca7
 
 
 
5e244a3
cacdca7
 
 
 
 
 
25e7c15
 
 
 
cacdca7
f3dd023
cacdca7
 
 
 
 
 
 
 
 
f3dd023
cacdca7
 
 
 
 
 
 
 
 
 
 
 
9e22b0c
cacdca7
 
 
 
a3aef6d
55e4499
 
a3aef6d
 
cacdca7
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
---
language:
- en
library_name: transformers
license: llama2
---



### Background

Sparse computation is increasingly recognized as an important direction in enhancing the computational efficiency of large language models (LLMs). 

Prior research has demonstrated that LLMs utilizing the ReLU activation function exhibit sparse activations. Interestingly, our findings indicate that models based on SwiGLU also manifest sparse activations.

This phenomenon prompts an essential question: Which activation function is optimal for sparse LLMs? Although previous works on activation function selection have focused on the performance of LLMs, we argue that the efficiency of sparse computation should also be considered so that the LLMs can proceed with efficient inference while preserving performance.

To answer this question, we pretrain 4 LLMs with different activation functions, including ReLU, SwiGLU, ReGLU, and Squared ReLU to do more comprehensive experiments.

### Dataset

We pretrain the model on  100 billion tokens, including:

* Refinedweb
* SlimPajama


### Training Hyper-parameters


| Parameter             | Value       |
|-----------------------|-------------|
| Batch_Size            | 4M          |
| GPUs                  | 64xA100(80G)|
| LR_Scheduler          | cosine      |
| LR                    | 3e-4        |




### Citation:

Please kindly cite using the following BibTeX:

```bibtex
@article{zhang2024relu2,
      title={ReLU$^2$ Wins: Discovering Efficient Activation Functions for Sparse LLMs}, 
      author={Zhengyan Zhang and Yixin Song and Guanghui Yu and Xu Han and Yankai Lin and Chaojun Xiao and Chenyang Song and Zhiyuan Liu and Zeyu Mi and Maosong Sun},
      journal = {arXiv preprint arXiv:2402.03804},
       year={2024},
}
```