Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
@@ -1,199 +1,97 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
-
|
10 |
|
|
|
11 |
|
12 |
## Model Details
|
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 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
-
|
95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
-
|
97 |
-
#### Speeds, Sizes, Times [optional]
|
98 |
-
|
99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
-
|
103 |
-
## Evaluation
|
104 |
-
|
105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
106 |
-
|
107 |
-
### Testing Data, Factors & Metrics
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
-
|
197 |
-
## Model Card Contact
|
198 |
-
|
199 |
-
[More Information Needed]
|
|
|
1 |
---
|
2 |
+
language: en
|
3 |
+
license: mit
|
4 |
+
datasets:
|
5 |
+
- fineweb-edu
|
6 |
+
tags:
|
7 |
+
- llama
|
8 |
+
- sparse
|
9 |
+
- llm
|
10 |
+
- sparse-pretraining
|
11 |
+
metrics:
|
12 |
+
- perplexity
|
13 |
+
arxiv: 2501.12486
|
14 |
---
|
15 |
|
16 |
+
# tjingrant/sparsellm-1b-40p
|
|
|
|
|
|
|
17 |
|
18 |
+
This is a sparse language model based on LLaMA2-1B with 40% sparsity.
|
19 |
|
20 |
## Model Details
|
21 |
|
22 |
+
- **Model Type:** Sparse Causal Language Model
|
23 |
+
- **Base Model:** LLaMA2-1B
|
24 |
+
- **Sparsity Configuration:** 40% sparsity
|
25 |
+
- **Training Data:** Trained on the Fineweb-Edu dataset
|
26 |
+
- **Tokenizer:** Same as the original LLaMA2 model
|
27 |
+
- **Perplexity:** 19.93 (measured on Wikitext-103)
|
28 |
+
- **Parameter Counts:**
|
29 |
+
- Total Parameters: 1.20B
|
30 |
+
- Total Linear Parameters: 1.14B
|
31 |
+
- Non-zero Linear Parameters: 0.68B
|
32 |
+
- Linear Layer Sparsity: 40.00%
|
33 |
+
- Average Linear Parameters During Training: 0.87B (Average Density: 0.7651)
|
34 |
+
## Training Parameters
|
35 |
+
|
36 |
+
- **Training Steps:** 13050
|
37 |
+
- **Batch Size:** 8M tokens (4096 × 2048)
|
38 |
+
- **Learning Rate:** 0.0003
|
39 |
+
- **Total Training Tokens:** 104400000000 (104.4B)
|
40 |
+
- **Final Training Loss:** 2.1374 ± 0.0134 (from last 1% of steps)
|
41 |
+
- **Pruning Start Step:** 2500
|
42 |
+
- **Pruning End Step:** 8875
|
43 |
+
- **Matching Dense Model:** [sparsellm-1b-40p-small-dense](https://huggingface.co/tjingrant/sparsellm-1b-40p-small-dense)
|
44 |
+
|
45 |
+
|
46 |
+
## Performance and Training Details
|
47 |
+
|
48 |
+
Here is the performance and parameter information for all models in this series:
|
49 |
+
|
50 |
+
| Model | Total Params | Linear Params | Avg Linear Params | Non-Zero Linear | Sparsity | Batch Size | LR | Total Tokens | Final Train Loss | Perplexity |
|
51 |
+
|-------|--------------|---------------|------------------|----------------|----------|------------|-----|-------------|------------------|------------|
|
52 |
+
| [sparsellm-1b-20p](https://huggingface.co/tjingrant/sparsellm-1b-20p) | 1.20B | 1.14B | 1.02B | 0.91B | 20.00% | 8M | 3e-4 | 89.6B | 2.133 ± 0.022 | 19.58 |
|
53 |
+
| [sparsellm-1b-40p](https://huggingface.co/tjingrant/sparsellm-1b-40p) | 1.20B | 1.14B | 0.87B | 0.68B | 40.00% | 8M | 3e-4 | 104.4B | 2.137 ± 0.013 | 19.93 |
|
54 |
+
| [sparsellm-1b-60p](https://huggingface.co/tjingrant/sparsellm-1b-60p) | 1.20B | 1.14B | 0.69B | 0.46B | 60.00% | 8M | 3e-4 | 131.0B | 2.182 ± 0.017 | 20.80 |
|
55 |
+
| [sparsellm-1b-80p](https://huggingface.co/tjingrant/sparsellm-1b-80p) | 1.20B | 1.14B | 0.45B | 0.23B | 80.00% | 8M | 3e-4 | 200.4B | 2.228 ± 0.021 | 25.77 |
|
56 |
+
| [sparsellm-1b-20p-small-dense](https://huggingface.co/tjingrant/sparsellm-1b-20p-small-dense) | 1.07B | 1.01B | 1.01B | 1.01B | 0.00% | 8M | 3e-4 | 89.6B | 2.139 ± 0.022 | 19.49 |
|
57 |
+
| [sparsellm-1b-40p-small-dense](https://huggingface.co/tjingrant/sparsellm-1b-40p-small-dense) | 0.88B | 0.82B | 0.82B | 0.82B | 0.00% | 8M | 3e-4 | 104.4B | 2.161 ± 0.024 | 21.40 |
|
58 |
+
| [sparsellm-1b-60p-small-dense](https://huggingface.co/tjingrant/sparsellm-1b-60p-small-dense) | 0.70B | 0.65B | 0.65B | 0.65B | 0.00% | 8M | 3e-4 | 131.0B | 2.209 ± 0.021 | 22.58 |
|
59 |
+
| [sparsellm-1b-80p-small-dense](https://huggingface.co/tjingrant/sparsellm-1b-80p-small-dense) | 0.46B | 0.42B | 0.42B | 0.42B | 0.00% | 8M | 3e-4 | 200.4B | 2.237 ± 0.028 | 24.57 |
|
60 |
+
|
61 |
+
Notes:
|
62 |
+
- **Perplexity** is measured on Wikitext-103
|
63 |
+
- **Batch Size** is given in tokens (samples × sequence length)
|
64 |
+
- **Total Tokens** = Training Steps × Batch Size
|
65 |
+
- **Final Train Loss** is computed from the last 1% of training steps (mean ± std)
|
66 |
+
- **Avg Linear Params** is the average number of active parameters during training, computed from the pruning schedule
|
67 |
+
- Rows 1-4 are sparse models, rows 5-8 are the matching dense models with (approximately) matching average parameter counts over pretraining.
|
68 |
+
|
69 |
+
|
70 |
+
## Usage
|
71 |
+
|
72 |
+
```python
|
73 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
74 |
+
|
75 |
+
tokenizer = AutoTokenizer.from_pretrained("{model_name}")
|
76 |
+
model = AutoModelForCausalLM.from_pretrained("{model_name}")
|
77 |
+
|
78 |
+
inputs = tokenizer("Hello, my name is", return_tensors="pt")
|
79 |
+
outputs = model.generate(**inputs, max_length=50)
|
80 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
81 |
+
```
|
82 |
+
|
83 |
+
## Citation
|
84 |
+
|
85 |
+
If you use this model in your research, please cite our paper:
|
86 |
+
|
87 |
+
**[The Journey Matters: Average Parameter Count over Pre-training Unifies Sparse and Dense Scaling Laws](https://arxiv.org/abs/2501.12486)**
|
88 |
+
|
89 |
+
```bibtex
|
90 |
+
@inproceedings{{
|
91 |
+
jin2025the,
|
92 |
+
title={{The Journey Matters: Average Parameter Count over Pre-training Unifies Sparse and Dense Scaling Laws}},
|
93 |
+
author={{Tian Jin and Ahmed Imtiaz Humayun and Utku Evci and Suvinay Subramanian and Amir Yazdanbakhsh and Dan Alistarh and Gintare Karolina Dziugaite}},
|
94 |
+
booktitle={{The Thirteenth International Conference on Learning Representations}},
|
95 |
+
year={{2025}},
|
96 |
+
}}
|
97 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|