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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pipeline_tag: text-generation
|
3 |
+
inference: false
|
4 |
+
license: apache-2.0
|
5 |
+
# datasets:
|
6 |
+
# metrics:
|
7 |
+
# - code_eval
|
8 |
+
library_name: transformers
|
9 |
+
tags:
|
10 |
+
- language
|
11 |
+
- granite-3.0
|
12 |
+
model-index:
|
13 |
+
- name: granite-3.0-8b-base
|
14 |
+
results:
|
15 |
+
- task:
|
16 |
+
type: text-generation
|
17 |
+
dataset:
|
18 |
+
type: human-exams
|
19 |
+
name: MMLU
|
20 |
+
metrics:
|
21 |
+
- name: pass@1
|
22 |
+
type: pass@1
|
23 |
+
value: 65.25
|
24 |
+
veriefied: false
|
25 |
+
- task:
|
26 |
+
type: text-generation
|
27 |
+
dataset:
|
28 |
+
type: human-exams
|
29 |
+
name: MMLU-Pro
|
30 |
+
metrics:
|
31 |
+
- name: pass@1
|
32 |
+
type: pass@1
|
33 |
+
value: 33.13
|
34 |
+
veriefied: false
|
35 |
+
- task:
|
36 |
+
type: text-generation
|
37 |
+
dataset:
|
38 |
+
type: human-exams
|
39 |
+
name: AGI-Eval
|
40 |
+
metrics:
|
41 |
+
- name: pass@1
|
42 |
+
type: pass@1
|
43 |
+
value: 34.45
|
44 |
+
veriefied: false
|
45 |
+
- task:
|
46 |
+
type: text-generation
|
47 |
+
dataset:
|
48 |
+
type: commonsense
|
49 |
+
name: WinoGrande
|
50 |
+
metrics:
|
51 |
+
- name: pass@1
|
52 |
+
type: pass@1
|
53 |
+
value: 74.43
|
54 |
+
veriefied: false
|
55 |
+
- task:
|
56 |
+
type: text-generation
|
57 |
+
dataset:
|
58 |
+
type: commonsense
|
59 |
+
name: OBQA
|
60 |
+
metrics:
|
61 |
+
- name: pass@1
|
62 |
+
type: pass@1
|
63 |
+
value: 46.80
|
64 |
+
veriefied: false
|
65 |
+
- task:
|
66 |
+
type: text-generation
|
67 |
+
dataset:
|
68 |
+
type: commonsense
|
69 |
+
name: SIQA
|
70 |
+
metrics:
|
71 |
+
- name: pass@1
|
72 |
+
type: pass@1
|
73 |
+
value: 67.80
|
74 |
+
veriefied: false
|
75 |
+
- task:
|
76 |
+
type: text-generation
|
77 |
+
dataset:
|
78 |
+
type: commonsense
|
79 |
+
name: PIQA
|
80 |
+
metrics:
|
81 |
+
- name: pass@1
|
82 |
+
type: pass@1
|
83 |
+
value: 82.32
|
84 |
+
veriefied: false
|
85 |
+
- task:
|
86 |
+
type: text-generation
|
87 |
+
dataset:
|
88 |
+
type: commonsense
|
89 |
+
name: Hellaswag
|
90 |
+
metrics:
|
91 |
+
- name: pass@1
|
92 |
+
type: pass@1
|
93 |
+
value: 81.03
|
94 |
+
veriefied: false
|
95 |
+
- task:
|
96 |
+
type: text-generation
|
97 |
+
dataset:
|
98 |
+
type: commonsense
|
99 |
+
name: TruthfulQA
|
100 |
+
metrics:
|
101 |
+
- name: pass@1
|
102 |
+
type: pass@1
|
103 |
+
value: 52.89
|
104 |
+
veriefied: false
|
105 |
+
- task:
|
106 |
+
type: text-generation
|
107 |
+
dataset:
|
108 |
+
type: reading-comprehension
|
109 |
+
name: BoolQ
|
110 |
+
metrics:
|
111 |
+
- name: pass@1
|
112 |
+
type: pass@1
|
113 |
+
value: 86.97
|
114 |
+
veriefied: false
|
115 |
+
- task:
|
116 |
+
type: text-generation
|
117 |
+
dataset:
|
118 |
+
type: reading-comprehension
|
119 |
+
name: SQuAD v2
|
120 |
+
metrics:
|
121 |
+
- name: pass@1
|
122 |
+
type: pass@1
|
123 |
+
value: 32.92
|
124 |
+
veriefied: false
|
125 |
+
- task:
|
126 |
+
type: text-generation
|
127 |
+
dataset:
|
128 |
+
type: reasoning
|
129 |
+
name: ARC-C
|
130 |
+
metrics:
|
131 |
+
- name: pass@1
|
132 |
+
type: pass@1
|
133 |
+
value: 52.73
|
134 |
+
veriefied: false
|
135 |
+
- task:
|
136 |
+
type: text-generation
|
137 |
+
dataset:
|
138 |
+
type: reasoning
|
139 |
+
name: GPQA
|
140 |
+
metrics:
|
141 |
+
- name: pass@1
|
142 |
+
type: pass@1
|
143 |
+
value: 32.13
|
144 |
+
veriefied: false
|
145 |
+
- task:
|
146 |
+
type: text-generation
|
147 |
+
dataset:
|
148 |
+
type: reasoning
|
149 |
+
name: BBH
|
150 |
+
metrics:
|
151 |
+
- name: pass@1
|
152 |
+
type: pass@1
|
153 |
+
value: 64.25
|
154 |
+
veriefied: false
|
155 |
+
- task:
|
156 |
+
type: text-generation
|
157 |
+
dataset:
|
158 |
+
type: code
|
159 |
+
name: HumanEval
|
160 |
+
metrics:
|
161 |
+
- name: pass@1
|
162 |
+
type: pass@1
|
163 |
+
value: 44.51
|
164 |
+
veriefied: false
|
165 |
+
- task:
|
166 |
+
type: text-generation
|
167 |
+
dataset:
|
168 |
+
type: code
|
169 |
+
name: MBPP
|
170 |
+
metrics:
|
171 |
+
- name: pass@1
|
172 |
+
type: pass@1
|
173 |
+
value: 41.40
|
174 |
+
veriefied: false
|
175 |
+
- task:
|
176 |
+
type: text-generation
|
177 |
+
dataset:
|
178 |
+
type: math
|
179 |
+
name: GSM8K
|
180 |
+
metrics:
|
181 |
+
- name: pass@1
|
182 |
+
type: pass@1
|
183 |
+
value: 61.87
|
184 |
+
veriefied: false
|
185 |
+
- task:
|
186 |
+
type: text-generation
|
187 |
+
dataset:
|
188 |
+
type: math
|
189 |
+
name: MATH
|
190 |
+
metrics:
|
191 |
+
- name: pass@1
|
192 |
+
type: pass@1
|
193 |
+
value: 29.28
|
194 |
+
veriefied: false
|
195 |
+
- task:
|
196 |
+
type: text-generation
|
197 |
+
dataset:
|
198 |
+
type: multilingual
|
199 |
+
name: MGSM
|
200 |
+
metrics:
|
201 |
+
- name: pass@1
|
202 |
+
type: pass@1
|
203 |
+
value: 51.60
|
204 |
+
veriefied: false
|
205 |
+
---
|
206 |
+
<!-- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/62cd5057674cdb524450093d/1hzxoPwqkBJXshKVVe6_9.png) -->
|
207 |
+
|
208 |
+
# Granite-3.0-8B-Base
|
209 |
+
|
210 |
+
## Model Summary
|
211 |
+
**Granite-3.0-8B-Base** is an open-source decoder-only language model from IBM Research that supports a variety of text-to-text generation tasks (e.g., question-answering, text-completion). **Granite-3.0-8B-Base** is trained from scratch and follows a two-phase training strategy. In the first phase, it is trained on 10 trillion tokens sourced from diverse domains, including natural language, math, code, and safety. During the second phase, it is further trained on 2 trillion tokens using a carefully curated mix of high-quality data, aiming to enhance its performance on specific tasks.
|
212 |
+
|
213 |
+
|
214 |
+
<!-- **Granite-3.0-8B-Base** is an open-source decoder-only language model from IBM Research that supports a variety of text-to-text generation tasks (e.g., question-answering, text-completion). The particular characteristics of this model, includig a dense architecture, small size, and open-source nature, make it an ideal baseline for finetuning other models requiring fast and/or real-time inference while keeping the need of deployment resources low. **Granite-3.0-8B-Base** is trained from scratch and follows a two-phase training strategy. In the first phase, it is trained on 10 trillion tokens sourced from diverse domains, including natural language, math, code, and safety. During the second phase, it is further trained on 2 trillion tokens using a carefully curated mix of high-quality data, aiming to enhance its performance on specific tasks. -->
|
215 |
+
|
216 |
+
<!-- Use Cases:
|
217 |
+
Dense LLMs: Suitable for scenarios where fast inference with a smaller model size is prioritized, such as real-time applications or deployment on resource-constrained devices.
|
218 |
+
MoE LLMs: Ideal for situations where large model capacity is needed while maintaining computational efficiency, like handling complex tasks or large datasets with high computational demands -->
|
219 |
+
|
220 |
+
<!-- businesses seeking to implement advanced AI solutions. -->
|
221 |
+
|
222 |
+
<!-- It is built with a similar technology used to create the Granite Code Models. -->
|
223 |
+
<!-- (e.g., dialog, reasoning, math, safety, code, tools) -->
|
224 |
+
|
225 |
+
- **Developers:** IBM Research
|
226 |
+
- **GitHub Repository:** [ibm-granite/granite-language-models](https://github.com/ibm-granite/granite-language-models)
|
227 |
+
- **Website**: [Granite Docs](https://www.ibm.com/granite/docs/)
|
228 |
+
- **Paper:** [Granite Language Models](https://) <!-- TO DO: Update github repo link when it is ready -->
|
229 |
+
- **Release Date**: October 21st, 2024
|
230 |
+
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0).
|
231 |
+
|
232 |
+
<!-- de/es/fr/ja/pt/ar/cs/it/ko/nl/zh -->
|
233 |
+
## Supported Languages
|
234 |
+
English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, Chinese (Simplified)
|
235 |
+
|
236 |
+
## Usage
|
237 |
+
### Intended use
|
238 |
+
Prominent use cases of LLMs in text-to-text generation include summarization, text classification, extraction, question-answering, and more. All Granite Base models are able to handle these tasks as they were trained on a large amount of data from various domains. Moreover, all Granite language model can serve as baseline to create specialized models for specific application scenarios.
|
239 |
+
|
240 |
+
### Generation
|
241 |
+
This is a simple example of how to use **Granite-3.0-8B-Base** model.
|
242 |
+
|
243 |
+
Install the following libraries:
|
244 |
+
|
245 |
+
```shell
|
246 |
+
pip install torch torchvision torchaudio
|
247 |
+
pip install accelerate
|
248 |
+
pip install transformers
|
249 |
+
```
|
250 |
+
Then, copy the code snippet below to run the example.
|
251 |
+
|
252 |
+
```python
|
253 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
254 |
+
device = "auto"
|
255 |
+
model_path = "ibm-granite/granite-3.0-8b-base"
|
256 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
257 |
+
# drop device_map if running on CPU
|
258 |
+
model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
|
259 |
+
model.eval()
|
260 |
+
# change input text as desired
|
261 |
+
input_text = "Where is the MIT-IBM Watson AI Lab located?"
|
262 |
+
# tokenize the text
|
263 |
+
input_tokens = tokenizer(input_text, return_tensors="pt").to(device)
|
264 |
+
# generate output tokens
|
265 |
+
output = model.generate(**input_tokens,
|
266 |
+
max_length=4000)
|
267 |
+
# decode output tokens into text
|
268 |
+
output = tokenizer.batch_decode(output)
|
269 |
+
# print output
|
270 |
+
print(output)
|
271 |
+
```
|
272 |
+
|
273 |
+
<!-- ['Where is the MIT-IBM Watson AI Lab located?\n\nThe MIT-IBM Watson AI Lab is located in Cambridge, Massachusetts.\n\nWhat is the mission of the MIT-IBM Watson AI Lab?\n\nThe mission of the MIT-IBM Watson AI Lab is to advance the state of the art in artificial intelligence (AI) and machine learning (ML) through collaboration between MIT and IBM.\n\nWhat are some of the projects being worked on at the MIT-IBM Watson AI Lab?\n\nSome of the projects being worked on at the MIT-IBM Watson AI Lab include developing new AI and ML algorithms, applying AI and ML to real-world problems, and exploring the ethical implications of AI and ML.\n\nWhat is the significance of the MIT-IBM Watson AI Lab?<|endoftext|>'] -->
|
274 |
+
|
275 |
+
## Model Architeture
|
276 |
+
**Granite-3.0-8B-Base** is based on a decoder-only dense transformer architecture. Core components of this architecture are: GQA and RoPE, MLP with SwiGLU, RMSNorm, and shared input/output embbeddings.
|
277 |
+
|
278 |
+
| Model | 2B Dense | 8B Dense | 1B MoE | 3B MoE |
|
279 |
+
| :-------- | :--------| :-------- | :------| :------|
|
280 |
+
| Embedding size | 2048 | **4096** | 1024 | 1536 |
|
281 |
+
| Number of layers | 40 | **40** | 24 | 32 |
|
282 |
+
| Attention head size | 64 | **128** | 64 | 64 |
|
283 |
+
| Number of attention heads | 32 | **32** | 16 | 24 |
|
284 |
+
| Number of KV heads | 8 | **8** | 8 | 8 |
|
285 |
+
| MLP hidden size | 8192 | **12800** | 512 | 512 |
|
286 |
+
| MLP activation | SwiGLU | **SwiGLU** | SwiGLU | SwiGLU |
|
287 |
+
| Number of Experts | — | **—** | 32 | 40 |
|
288 |
+
| MoE TopK | — | **—** | 8 | 8 |
|
289 |
+
| Initialization std | 0.1 | **0.1** | 0.1 | 0.1 |
|
290 |
+
| Sequence Length | 4096 | **4096** | 4096 | 4096 |
|
291 |
+
| Position Embedding | RoPE | **RoPE** | RoPE | RoPE |
|
292 |
+
| # Paremeters | 2.5B | **8.1B** | 1.3B | 3.3B |
|
293 |
+
| # Active Parameters | 2.5B | **8.1B** | 400M | 800M |
|
294 |
+
| # Training tokens | 12T | **12T** | 10T | 10T |
|
295 |
+
|
296 |
+
<!-- TO DO: To be completed once the paper is ready -->
|
297 |
+
## Training Data
|
298 |
+
This model is trained on a mix of open-source and proprietary datasets.
|
299 |
+
<!-- - **Data Collection and Filtering:** Pretraining knowledge data is sourced from the following publicly available sources [LIST OF SOURCES].
|
300 |
+
- **Exact and Fuzzy Deduplication:** We adopt an aggressive deduplication strategy that includes both exact and fuzzy deduplication to remove documents having (near) identical code content.
|
301 |
+
- **HAP, PII[, Malware Filtering]:** We apply a HAP content filter that reduces models' likelihood of generating hateful, abusive, or profane language. We also make sure to redact Personally Identifiable Information (PII) by replacing PII content (e.g., names, email addresses, keys, passwords) with corresponding tokens (e.g., ⟨NAME⟩, ⟨EMAIL⟩, ⟨KEY⟩, ⟨PASSWORD⟩). [Particularly for code data, we scan all datasets using [ClamAV](https://www.clamav.net/) to identify and remove instances of malware in the source code.]
|
302 |
+
- **Natural Language Datasets:** In addition to collecting data from multiple sources for model training, we use several publicly available high-quality natural language datasets to improve the model's proficiency in critical tasks (e.g., language understanding, mathematical reasoning). Unlike the knowledge data, we do not deduplicate these datasets. -->
|
303 |
+
|
304 |
+
## Infrastructure
|
305 |
+
We train the Granite 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.
|
306 |
+
|
307 |
+
## Ethical Considerations and Limitations
|
308 |
+
The use of Large Language Models involves risks and ethical considerations people must be aware of, including but not limited to: bias and fairness, misinformation, and autonomous decision-making. **Granite-3.0-8B-Base** model is not the exception in this regard. Even though this model is suited for multiple generative AI tasks, it has not undergone any safety alignment, there it may produce problematic outputs. Additionally, it remains uncertain whether smaller models might exhibit increased susceptibility to hallucination in generation scenarios by copying text verbatim from the training dataset due to their reduced sizes and memorization capacities. This aspect is currently an active area of research, and we anticipate more rigorous exploration, comprehension, and mitigations in this domain. Regarding ethics, a latent risk associated with all Large Language Models is their malicious utilization. We urge the community to use **Granite-3.0-8B-Base** model with ethical intentions and in a responsible way.
|
309 |
+
|
310 |
+
## Citation
|
311 |
+
```
|
312 |
+
@misc{granite-models,
|
313 |
+
author = {author 1, author2, ...},
|
314 |
+
title = {},
|
315 |
+
journal = {},
|
316 |
+
volume = {},
|
317 |
+
year = {2024},
|
318 |
+
url = {https://arxiv.org/abs/0000.00000},
|
319 |
+
}
|
320 |
+
```
|