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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
granite-3.0-3b-a800m-instruct - bnb 8bits
|
11 |
+
- Model creator: https://huggingface.co/ibm-granite/
|
12 |
+
- Original model: https://huggingface.co/ibm-granite/granite-3.0-3b-a800m-instruct/
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
Original model description:
|
18 |
+
---
|
19 |
+
pipeline_tag: text-generation
|
20 |
+
inference: false
|
21 |
+
license: apache-2.0
|
22 |
+
library_name: transformers
|
23 |
+
tags:
|
24 |
+
- language
|
25 |
+
- granite-3.0
|
26 |
+
model-index:
|
27 |
+
- name: granite-3.0-2b-instruct
|
28 |
+
results:
|
29 |
+
- task:
|
30 |
+
type: text-generation
|
31 |
+
dataset:
|
32 |
+
type: instruction-following
|
33 |
+
name: IFEval
|
34 |
+
metrics:
|
35 |
+
- name: pass@1
|
36 |
+
type: pass@1
|
37 |
+
value: 42.49
|
38 |
+
veriefied: false
|
39 |
+
- task:
|
40 |
+
type: text-generation
|
41 |
+
dataset:
|
42 |
+
type: instruction-following
|
43 |
+
name: MT-Bench
|
44 |
+
metrics:
|
45 |
+
- name: pass@1
|
46 |
+
type: pass@1
|
47 |
+
value: 7.02
|
48 |
+
veriefied: false
|
49 |
+
- task:
|
50 |
+
type: text-generation
|
51 |
+
dataset:
|
52 |
+
type: human-exams
|
53 |
+
name: AGI-Eval
|
54 |
+
metrics:
|
55 |
+
- name: pass@1
|
56 |
+
type: pass@1
|
57 |
+
value: 25.7
|
58 |
+
veriefied: false
|
59 |
+
- task:
|
60 |
+
type: text-generation
|
61 |
+
dataset:
|
62 |
+
type: human-exams
|
63 |
+
name: MMLU
|
64 |
+
metrics:
|
65 |
+
- name: pass@1
|
66 |
+
type: pass@1
|
67 |
+
value: 50.16
|
68 |
+
veriefied: false
|
69 |
+
- task:
|
70 |
+
type: text-generation
|
71 |
+
dataset:
|
72 |
+
type: human-exams
|
73 |
+
name: MMLU-Pro
|
74 |
+
metrics:
|
75 |
+
- name: pass@1
|
76 |
+
type: pass@1
|
77 |
+
value: 20.51
|
78 |
+
veriefied: false
|
79 |
+
- task:
|
80 |
+
type: text-generation
|
81 |
+
dataset:
|
82 |
+
type: commonsense
|
83 |
+
name: OBQA
|
84 |
+
metrics:
|
85 |
+
- name: pass@1
|
86 |
+
type: pass@1
|
87 |
+
value: 40.8
|
88 |
+
veriefied: false
|
89 |
+
- task:
|
90 |
+
type: text-generation
|
91 |
+
dataset:
|
92 |
+
type: commonsense
|
93 |
+
name: SIQA
|
94 |
+
metrics:
|
95 |
+
- name: pass@1
|
96 |
+
type: pass@1
|
97 |
+
value: 59.95
|
98 |
+
veriefied: false
|
99 |
+
- task:
|
100 |
+
type: text-generation
|
101 |
+
dataset:
|
102 |
+
type: commonsense
|
103 |
+
name: Hellaswag
|
104 |
+
metrics:
|
105 |
+
- name: pass@1
|
106 |
+
type: pass@1
|
107 |
+
value: 71.86
|
108 |
+
veriefied: false
|
109 |
+
- task:
|
110 |
+
type: text-generation
|
111 |
+
dataset:
|
112 |
+
type: commonsense
|
113 |
+
name: WinoGrande
|
114 |
+
metrics:
|
115 |
+
- name: pass@1
|
116 |
+
type: pass@1
|
117 |
+
value: 67.01
|
118 |
+
veriefied: false
|
119 |
+
- task:
|
120 |
+
type: text-generation
|
121 |
+
dataset:
|
122 |
+
type: commonsense
|
123 |
+
name: TruthfulQA
|
124 |
+
metrics:
|
125 |
+
- name: pass@1
|
126 |
+
type: pass@1
|
127 |
+
value: 48
|
128 |
+
veriefied: false
|
129 |
+
- task:
|
130 |
+
type: text-generation
|
131 |
+
dataset:
|
132 |
+
type: reading-comprehension
|
133 |
+
name: BoolQ
|
134 |
+
metrics:
|
135 |
+
- name: pass@1
|
136 |
+
type: pass@1
|
137 |
+
value: 78.65
|
138 |
+
veriefied: false
|
139 |
+
- task:
|
140 |
+
type: text-generation
|
141 |
+
dataset:
|
142 |
+
type: reading-comprehension
|
143 |
+
name: SQuAD 2.0
|
144 |
+
metrics:
|
145 |
+
- name: pass@1
|
146 |
+
type: pass@1
|
147 |
+
value: 6.71
|
148 |
+
veriefied: false
|
149 |
+
- task:
|
150 |
+
type: text-generation
|
151 |
+
dataset:
|
152 |
+
type: reasoning
|
153 |
+
name: ARC-C
|
154 |
+
metrics:
|
155 |
+
- name: pass@1
|
156 |
+
type: pass@1
|
157 |
+
value: 50.94
|
158 |
+
veriefied: false
|
159 |
+
- task:
|
160 |
+
type: text-generation
|
161 |
+
dataset:
|
162 |
+
type: reasoning
|
163 |
+
name: GPQA
|
164 |
+
metrics:
|
165 |
+
- name: pass@1
|
166 |
+
type: pass@1
|
167 |
+
value: 26.85
|
168 |
+
veriefied: false
|
169 |
+
- task:
|
170 |
+
type: text-generation
|
171 |
+
dataset:
|
172 |
+
type: reasoning
|
173 |
+
name: BBH
|
174 |
+
metrics:
|
175 |
+
- name: pass@1
|
176 |
+
type: pass@1
|
177 |
+
value: 37.7
|
178 |
+
veriefied: false
|
179 |
+
- task:
|
180 |
+
type: text-generation
|
181 |
+
dataset:
|
182 |
+
type: code
|
183 |
+
name: HumanEvalSynthesis
|
184 |
+
metrics:
|
185 |
+
- name: pass@1
|
186 |
+
type: pass@1
|
187 |
+
value: 39.63
|
188 |
+
veriefied: false
|
189 |
+
- task:
|
190 |
+
type: text-generation
|
191 |
+
dataset:
|
192 |
+
type: code
|
193 |
+
name: HumanEvalExplain
|
194 |
+
metrics:
|
195 |
+
- name: pass@1
|
196 |
+
type: pass@1
|
197 |
+
value: 40.85
|
198 |
+
veriefied: false
|
199 |
+
- task:
|
200 |
+
type: text-generation
|
201 |
+
dataset:
|
202 |
+
type: code
|
203 |
+
name: HumanEvalFix
|
204 |
+
metrics:
|
205 |
+
- name: pass@1
|
206 |
+
type: pass@1
|
207 |
+
value: 35.98
|
208 |
+
veriefied: false
|
209 |
+
- task:
|
210 |
+
type: text-generation
|
211 |
+
dataset:
|
212 |
+
type: code
|
213 |
+
name: MBPP
|
214 |
+
metrics:
|
215 |
+
- name: pass@1
|
216 |
+
type: pass@1
|
217 |
+
value: 27.4
|
218 |
+
veriefied: false
|
219 |
+
- task:
|
220 |
+
type: text-generation
|
221 |
+
dataset:
|
222 |
+
type: math
|
223 |
+
name: GSM8K
|
224 |
+
metrics:
|
225 |
+
- name: pass@1
|
226 |
+
type: pass@1
|
227 |
+
value: 47.54
|
228 |
+
veriefied: false
|
229 |
+
- task:
|
230 |
+
type: text-generation
|
231 |
+
dataset:
|
232 |
+
type: math
|
233 |
+
name: MATH
|
234 |
+
metrics:
|
235 |
+
- name: pass@1
|
236 |
+
type: pass@1
|
237 |
+
value: 19.86
|
238 |
+
veriefied: false
|
239 |
+
- task:
|
240 |
+
type: text-generation
|
241 |
+
dataset:
|
242 |
+
type: multilingual
|
243 |
+
name: PAWS-X (7 langs)
|
244 |
+
metrics:
|
245 |
+
- name: pass@1
|
246 |
+
type: pass@1
|
247 |
+
value: 50.23
|
248 |
+
veriefied: false
|
249 |
+
- task:
|
250 |
+
type: text-generation
|
251 |
+
dataset:
|
252 |
+
type: multilingual
|
253 |
+
name: MGSM (6 langs)
|
254 |
+
metrics:
|
255 |
+
- name: pass@1
|
256 |
+
type: pass@1
|
257 |
+
value: 28.87
|
258 |
+
veriefied: false
|
259 |
+
base_model:
|
260 |
+
- ibm-granite/granite-3.0-3b-a800m-base
|
261 |
+
---
|
262 |
+
|
263 |
+
<!-- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd5057674cdb524450093d/1hzxoPwqkBJXshKVVe6_9.png) -->
|
264 |
+
<!-- ![image/png](granite-3_0-language-models_Group_1.png) -->
|
265 |
+
|
266 |
+
# Granite-3.0-3B-A800M-Instruct
|
267 |
+
|
268 |
+
**Model Summary:**
|
269 |
+
Granite-3.0-3B-A800M-Instruct is a 3B parameter model finetuned from *Granite-3.0-3B-A800M-Base-4K* using a combination of open source instruction datasets with permissive license and internally collected synthetic datasets. This model is developed using a diverse set of techniques with a structured chat format, including supervised finetuning, model alignment using reinforcement learning, and model merging.
|
270 |
+
|
271 |
+
- **Developers:** Granite Team, IBM
|
272 |
+
- **GitHub Repository:** [ibm-granite/granite-3.0-language-models](https://github.com/ibm-granite/granite-3.0-language-models)
|
273 |
+
- **Website**: [Granite Docs](https://www.ibm.com/granite/docs/)
|
274 |
+
- **Paper:** [Granite 3.0 Language Models](https://github.com/ibm-granite/granite-3.0-language-models/blob/main/paper.pdf)
|
275 |
+
- **Release Date**: October 21st, 2024
|
276 |
+
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
277 |
+
|
278 |
+
**Supported Languages:**
|
279 |
+
English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. Users may finetune Granite 3.0 models for languages beyond these 12 languages.
|
280 |
+
|
281 |
+
**Intended use:**
|
282 |
+
The model is designed to respond to general instructions and can be used to build AI assistants for multiple domains, including business applications.
|
283 |
+
|
284 |
+
*Capabilities*
|
285 |
+
* Summarization
|
286 |
+
* Text classification
|
287 |
+
* Text extraction
|
288 |
+
* Question-answering
|
289 |
+
* Retrieval Augmented Generation (RAG)
|
290 |
+
* Code related tasks
|
291 |
+
* Function-calling tasks
|
292 |
+
* Multilingual dialog use cases
|
293 |
+
|
294 |
+
**Generation:**
|
295 |
+
This is a simple example of how to use Granite-3.0-3B-A800M-Instruct model.
|
296 |
+
|
297 |
+
Install the following libraries:
|
298 |
+
|
299 |
+
```shell
|
300 |
+
pip install torch torchvision torchaudio
|
301 |
+
pip install accelerate
|
302 |
+
pip install transformers
|
303 |
+
```
|
304 |
+
Then, copy the snippet from the section that is relevant for your use case.
|
305 |
+
|
306 |
+
```python
|
307 |
+
import torch
|
308 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
309 |
+
|
310 |
+
device = "auto"
|
311 |
+
model_path = "ibm-granite/granite-3.0-3b-a800m-instruct"
|
312 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
313 |
+
# drop device_map if running on CPU
|
314 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
|
315 |
+
model.eval()
|
316 |
+
# change input text as desired
|
317 |
+
chat = [
|
318 |
+
{ "role": "user", "content": "Please list one IBM Research laboratory located in the United States. You should only output its name and location." },
|
319 |
+
]
|
320 |
+
chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
|
321 |
+
# tokenize the text
|
322 |
+
input_tokens = tokenizer(chat, return_tensors="pt").to(device)
|
323 |
+
# generate output tokens
|
324 |
+
output = model.generate(**input_tokens,
|
325 |
+
max_new_tokens=100)
|
326 |
+
# decode output tokens into text
|
327 |
+
output = tokenizer.batch_decode(output)
|
328 |
+
# print output
|
329 |
+
print(output)
|
330 |
+
```
|
331 |
+
|
332 |
+
**Model Architecture:**
|
333 |
+
Granite-3.0-3B-A800M-Instruct is based on a decoder-only sparse Mixture of Experts (MoE) transformer architecture. Core components of this architecture are: Fine-grained Experts, Dropless Token Routing, and Load Balancing Loss.
|
334 |
+
|
335 |
+
| Model | 2B Dense | 8B Dense | 1B MoE | 3B MoE |
|
336 |
+
| :-------- | :--------| :--------| :--------| :-------- |
|
337 |
+
| Embedding size | 2048 | 4096 | 1024 | **1536** |
|
338 |
+
| Number of layers | 40 | 40 | 24 | **32** |
|
339 |
+
| Attention head size | 64 | 128 | 64 | **64** |
|
340 |
+
| Number of attention heads | 32 | 32 | 16 | **24** |
|
341 |
+
| Number of KV heads | 8 | 8 | 8 | **8** |
|
342 |
+
| MLP hidden size | 8192 | 12800 | 512 | **512** |
|
343 |
+
| MLP activation | SwiGLU | SwiGLU | SwiGLU | **SwiGLU** |
|
344 |
+
| Number of Experts | — | — | 32 | **40** |
|
345 |
+
| MoE TopK | — | — | 8 | **8** |
|
346 |
+
| Initialization std | 0.1 | 0.1 | 0.1 | **0.1** |
|
347 |
+
| Sequence Length | 4096 | 4096 | 4096 | **4096** |
|
348 |
+
| Position Embedding | RoPE | RoPE | RoPE | **RoPE** |
|
349 |
+
| # Parameters | 2.5B | 8.1B | 1.3B | **3.3B** |
|
350 |
+
| # Active Parameters | 2.5B | 8.1B | 400M | **800M** |
|
351 |
+
| # Training tokens | 12T | 12T | 10T | **10T** |
|
352 |
+
|
353 |
+
**Training Data:**
|
354 |
+
Overall, our SFT data is largely comprised of three key sources: (1) publicly available datasets with permissive license, (2) internal synthetic data targeting specific capabilities, and (3) very small amounts of human-curated data. A detailed attribution of datasets can be found in the [Granite Technical Report](https://github.com/ibm-granite/granite-3.0-language-models/blob/main/paper.pdf) and [Accompanying Author List](https://github.com/ibm-granite/granite-3.0-language-models/blob/main/author-ack.pdf).
|
355 |
+
|
356 |
+
**Infrastructure:**
|
357 |
+
We train Granite 3.0 Language Models using IBM's super computing cluster, Blue Vela, which is outfitted with NVIDIA H100 GPUs. This cluster provides a scalable and efficient infrastructure for training our models over thousands of GPUs while minimizing environmental impact by utilizing 100% renewable energy sources.
|
358 |
+
|
359 |
+
**Ethical Considerations and Limitations:**
|
360 |
+
Granite 3.0 Instruct Models are primarily finetuned using instruction-response pairs mostly in English, but also multilingual data covering eleven languages. Although this model can handle multilingual dialog use cases, its performance might not be similar to English tasks. In such case, introducing a small number of examples (few-shot) can help the model in generating more accurate outputs. While this model has been aligned by keeping safety in consideration, the model may in some cases produce inaccurate, biased, or unsafe responses to user prompts. So we urge the community to use this model with proper safety testing and tuning tailored for their specific tasks.
|
361 |
+
|
362 |
+
<!-- ## Citation
|
363 |
+
```
|
364 |
+
@misc{granite-models,
|
365 |
+
author = {author 1, author2, ...},
|
366 |
+
title = {},
|
367 |
+
journal = {},
|
368 |
+
volume = {},
|
369 |
+
year = {2024},
|
370 |
+
url = {https://arxiv.org/abs/0000.00000},
|
371 |
+
}
|
372 |
+
``` -->
|
373 |
+
|