Adding model card for 8B model

#2
by ranarag - opened
Files changed (1) hide show
  1. README.md +373 -3
README.md CHANGED
@@ -1,3 +1,373 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ pipeline_tag: text-generation
3
+ inference: false
4
+ license: apache-2.0
5
+ library_name: transformers
6
+ tags:
7
+ - language
8
+ - granite-3.2
9
+ base_model:
10
+ - ibm-granite/granite-3.1-8b-instruct
11
+ ---
12
+
13
+ # Granite-3.2-8B-Instruct
14
+
15
+ **Model Summary:**
16
+ Granite-3.2-8B-Instruct is an 8-billion-parameter, long-context AI model fine-tuned for advanced reasoning capabilities. Built on top of [Granite-3.1-8B-Instruct](https://huggingface.co/ibm-granite/granite-3.1-8b-instruct), it has been trained using a mix of permissively licensed open-source datasets and internally generated synthetic data designed for reasoning tasks. The model allows controllability of its thinking capability, ensuring it is applied only when required.
17
+
18
+
19
+ - **Developers:** Granite Team, IBM
20
+ - **Website**: [Granite Docs](https://www.ibm.com/granite/docs/)
21
+ - **Release Date**: February 7th, 2025
22
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
23
+
24
+ **Supported Languages:**
25
+ English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. However, users may finetune this Granite model for languages beyond these 12 languages.
26
+
27
+ **Intended Use:**
28
+ This model is designed to handle general instruction-following tasks and can be integrated into AI assistants across various domains, including business applications.
29
+
30
+ **Capabilities**
31
+ * **Thinking**
32
+ * Summarization
33
+ * Text classification
34
+ * Text extraction
35
+ * Question-answering
36
+ * Retrieval Augmented Generation (RAG)
37
+ * Code related tasks
38
+ * Function-calling tasks
39
+ * Multilingual dialog use cases
40
+ * Long-context tasks including long document/meeting summarization, long document QA, etc.
41
+
42
+
43
+
44
+ **Generation:**
45
+ This is a simple example of how to use Granite-3.2-8B-Instruct model.
46
+
47
+ Install the following libraries:
48
+
49
+ ```shell
50
+ pip install torch torchvision torchaudio
51
+ pip install accelerate
52
+ pip install transformers
53
+ ```
54
+ Then, copy the snippet from the section that is relevant for your use case.
55
+
56
+ ```python
57
+ from transformers import AutoModelForCausalLM, AutoTokenizer, set_seed
58
+ import torch
59
+
60
+ model_path="ibm-granite/granite-3.2-8b-instruct"
61
+ device="cuda"
62
+ model = AutoModelForCausalLM.from_pretrained(
63
+ model_path,
64
+ device_map=device,
65
+ torch_dtype=torch.bfloat16,
66
+ )
67
+ tokenizer = AutoTokenizer.from_pretrained(
68
+ model_path
69
+ )
70
+
71
+ conv = [{"role": "user", "content":"You have 10 liters of a 30% acid solution. How many liters of a 70% acid solution must be added to achieve a 50% acid mixture?"}]
72
+
73
+ input_ids = tokenizer.apply_chat_template(conv, return_tensors="pt", thinking=True, return_dict=True, add_generation_prompt=True).to(device)
74
+
75
+ set_seed(42)
76
+ output = model.generate(
77
+ **input_ids,
78
+ max_new_tokens=8192,
79
+ )
80
+
81
+ prediction = tokenizer.decode(output[0, input_ids["input_ids"].shape[1]:], skip_special_tokens=True)
82
+ print(prediction)
83
+ ```
84
+
85
+ **Example Outputs**
86
+ - thinking=True
87
+ ```md
88
+ Here is my thought process:
89
+
90
+ 1. We know we start with 10 liters of a 30% acid solution, so there's 3 liters of pure acid in it (10 liters * 0.3).
91
+ 2. We need to determine how much of the 70% acid solution to add such that the final mixture is 50% acid.
92
+ 3. Let's say x liters of the 70% acid solution are added. This will contribute 0.7x liters of pure acid.
93
+ 4. The total volume of the new mixture will be 10 + x liters, and the total amount of pure acid will be 3 + 0.7x liters.
94
+ 5. We need to set up an equation where (3 + 0.7x) / (10 + x) = 0.5 (since we want a 50% acid mixture).
95
+ 6. Solving this equation for x will give us the volume of 70% solution needed.
96
+
97
+ Here is my response:
98
+
99
+ To solve this, we need to set up an equation based on the concentration of acid before and after mixing.
100
+
101
+ 1. **Initial Acid Content**:
102
+ - We start with 10 liters of a 30% acid solution.
103
+ - Pure acid in this = 10 * 0.3 = 3 liters.
104
+
105
+ 2. **Variable for Addition**:
106
+ - Let x be the liters of 70% acid solution to be added.
107
+ - Pure acid in x liters of 70% solution = 0.7x liters.
108
+
109
+ 3. **Final Mixture Concentration**:
110
+ - Total volume of mixture = 10 + x liters.
111
+ - Total pure acid in the mixture = 3 (from initial solution) + 0.7x (from added solution).
112
+
113
+ 4. **Setting up the equation for 50% acid concentration**:
114
+ - We require that the ratio of pure acid to total volume is 0.5 (50%).
115
+ - Therefore, the equation is:
116
+
117
+ \[
118
+ \frac{3 + 0.7x}{10 + x} = 0.5
119
+ \]
120
+
121
+ 5. **Solving the equation**:
122
+
123
+ Multiply both sides by (10 + x) to clear the fraction:
124
+
125
+ \[
126
+ 3 + 0.7x = 0.5(10 + x)
127
+ \]
128
+
129
+ Expanding the right side:
130
+
131
+ \[
132
+ 3 + 0.7x = 5 + 0.5x
133
+ \]
134
+
135
+ Subtract 0.5x from both sides:
136
+
137
+ \[
138
+ 3 + 0.2x = 5
139
+ \]
140
+
141
+ Subtract 3 from both sides:
142
+
143
+ \[
144
+ 0.2x = 2
145
+ \]
146
+
147
+ Divide by 0.2:
148
+
149
+ \[
150
+ x = 10
151
+ \]
152
+
153
+ So, 10 liters of the 70% acid solution must be added to the initial 10 liters of 30% solution to get a 50% acid mixture.
154
+
155
+ Let's verify:
156
+
157
+ - Initial acid: 3 liters
158
+ - Acid from added solution: 0.7 * 10 = 7 liters
159
+ - Total acid: 3 + 7 = 10 liters
160
+ - Total volume: 10 + 10 = 20 liters
161
+ - Acid percentage: \(\frac{10}{20} = 0.5 = 50\%\)
162
+
163
+ This confirms our solution.
164
+
165
+ Final answer: 10 liters of 70% acid solution should be added.
166
+ ```
167
+ - thinking=False
168
+ ```md
169
+ Let's denote the amount of 70% acid solution to be added as x liters.
170
+
171
+ We start with 10 liters of a 30% acid solution, which means there are 0.3 * 10 = 3 liters of pure acid in it.
172
+
173
+ We want to end up with a 50% acid solution after adding x liters of 70% acid solution. The total volume of the mixture will be 10 + x liters, and we want half of this volume to be pure acid.
174
+
175
+ So, the amount of pure acid in the final mixture should be 0.5 * (10 + x) liters.
176
+
177
+ The amount of pure acid in the final mixture comes from two sources: the original 30% solution and the added 70% solution. So, we can set up the following equation:
178
+
179
+ 3 (from the original solution) + 0.7x (from the added solution) = 0.5 * (10 + x)
180
+
181
+ Now, let's solve for x:
182
+
183
+ 3 + 0.7x = 5 + 0.5x
184
+ 0.7x - 0.5x = 5 - 3
185
+ 0.2x = 2
186
+ x = 2 / 0.2
187
+ x = 10
188
+
189
+ So, you need to add 10 liters of a 70% acid solution to the 10 liters of a 30% acid solution to get a 50% acid mixture.
190
+ ```
191
+
192
+ **Evaluation Results:**
193
+ <table>
194
+
195
+ <thead>
196
+ <tr>
197
+ <th style="text-align:left; background-color: #001d6c; color: white;">Models</th>
198
+ <th style="text-align:center; background-color: #001d6c; color: white;">ArenaHard</th>
199
+ <th style="text-align:center; background-color: #001d6c; color: white;">Alpaca-Eval-2</th>
200
+ <th style="text-align:center; background-color: #001d6c; color: white;">MMLU</th>
201
+ <th style="text-align:center; background-color: #001d6c; color: white;">PopQA</th>
202
+ <th style="text-align:center; background-color: #001d6c; color: white;">TruthfulQA</th>
203
+ <th style="text-align:center; background-color: #001d6c; color: white;">BigBenchHard</th>
204
+ <th style="text-align:center; background-color: #001d6c; color: white;">DROP</th>
205
+ <th style="text-align:center; background-color: #001d6c; color: white;">GSM8K</th>
206
+ <th style="text-align:center; background-color: #001d6c; color: white;">HumanEval</th>
207
+ <th style="text-align:center; background-color: #001d6c; color: white;">HumanEval+</th>
208
+ <th style="text-align:center; background-color: #001d6c; color: white;">IFEval</th>
209
+ <th style="text-align:center; background-color: #001d6c; color: white;">AttaQ</th>
210
+ </tr></thead>
211
+ <tbody>
212
+ <tr>
213
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Llama-3.1-8B-Instruct</td>
214
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">36.43</td>
215
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">27.22</td>
216
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">69.15</td>
217
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">28.79</td>
218
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">52.79</td>
219
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">72.66</td>
220
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">61.48</td>
221
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">83.24</td>
222
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.32</td>
223
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">80.15</td>
224
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">79.10</td>
225
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">83.43</td>
226
+ </tr>
227
+
228
+ <tr>
229
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">DeepSeek-R1-Distill-Llama-8B</td>
230
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">17.17</td>
231
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">21.85</td>
232
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">45.80</td>
233
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">13.25</td>
234
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">47.43</td>
235
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">65.71</td>
236
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">44.46</td>
237
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">72.18</td>
238
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">67.54</td>
239
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">62.91</td>
240
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">66.50</td>
241
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">42.87</td>
242
+ </tr>
243
+
244
+ <tr>
245
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Qwen-2.5-7B-Instruct</td>
246
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">25.44</td>
247
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">30.34</td>
248
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">74.30</td>
249
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">18.12</td>
250
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">63.06</td>
251
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">70.40</td>
252
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">54.71</td>
253
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">84.46</td>
254
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">93.35</td>
255
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">89.91</td>
256
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">74.90</td>
257
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">81.90</td>
258
+ </tr>
259
+
260
+ <tr>
261
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">DeepSeek-R1-Distill-Qwen-7B</td>
262
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">10.36</td>
263
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">15.35</td>
264
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">50.72</td>
265
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">9.94</td>
266
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">47.14</td>
267
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">65.04</td>
268
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">42.76</td>
269
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">78.47</td>
270
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">79.89</td>
271
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">78.43</td>
272
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">59.10</td>
273
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">42.45</td>
274
+ </tr>
275
+
276
+ <tr>
277
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Granite-3.1-8B-Instruct</td>
278
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">37.58</td>
279
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">30.34</td>
280
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">66.77</td>
281
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">28.7</td>
282
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">65.84</td>
283
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">68.55</td>
284
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">50.78</td>
285
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">79.15</td>
286
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">89.63</td>
287
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.79</td>
288
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">73.20</td>
289
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.73</td>
290
+ </tr>
291
+
292
+
293
+ <tr>
294
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Granite-3.1-2B-Instruct</td>
295
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">23.3</td>
296
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">27.17</td>
297
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">57.11</td>
298
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">20.55</td>
299
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">59.79</td>
300
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">54.46</td>
301
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">18.68</td>
302
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">67.55</td>
303
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">79.45</td>
304
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">75.26</td>
305
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">63.59</td>
306
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">84.7</td>
307
+ </tr>
308
+
309
+
310
+ <tr>
311
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Granite-3.2-2B-Instruct</td>
312
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">24.86</td>
313
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">34.51</td>
314
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">57.18</td>
315
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">20.56</td>
316
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">59.8</td>
317
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">52.27</td>
318
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">21.12</td>
319
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">67.02</td>
320
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">80.13</td>
321
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">73.39</td>
322
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">61.55</td>
323
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">83.23</td>
324
+ </tr>
325
+
326
+ <tr>
327
+ <td style="text-align:left; background-color: #DAE8FF; color: black;"><b>Granite-3.2-8B-Instruct</b></td>
328
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">55.25</td>
329
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">61.19</td>
330
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">66.79</td>
331
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">28.04</td>
332
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">66.92</td>
333
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">64.77</td>
334
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">50.95</td>
335
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">81.65</td>
336
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">89.35</td>
337
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.72</td>
338
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">74.31</td>
339
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.42</td>
340
+
341
+ </tr>
342
+
343
+
344
+
345
+ </tbody></table>
346
+
347
+ **Training Data:**
348
+ Overall, our training data is largely comprised of two key sources: (1) publicly available datasets with permissive license, (2) internal synthetically generated data targeted to enhance reasoning capabilites.
349
+ <!-- A detailed attribution of datasets can be found in [Granite 3.2 Technical Report (coming soon)](#), and [Accompanying Author List](https://github.com/ibm-granite/granite-3.0-language-models/blob/main/author-ack.pdf). -->
350
+
351
+ **Infrastructure:**
352
+ We train Granite-3.2-8B-Instruct 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.
353
+
354
+ **Ethical Considerations and Limitations:**
355
+ Granite-3.2-8B-Instruct builds upon Granite-3.1-8B-Instruct, leveraging both permissively licensed open-source and select proprietary data for enhanced performance. Since it inherits its foundation from the previous model, all ethical considerations and limitations applicable to [Granite-3.1-8B-Instruct](https://huggingface.co/ibm-granite/granite-3.1-8b-instruct) remain relevant.
356
+
357
+
358
+ **Resources**
359
+ - ⭐️ Learn about the latest updates with Granite: https://www.ibm.com/granite
360
+ - 📄 Get started with tutorials, best practices, and prompt engineering advice: https://www.ibm.com/granite/docs/
361
+ - 💡 Learn about the latest Granite learning resources: https://ibm.biz/granite-learning-resources
362
+
363
+ <!-- ## Citation
364
+ ```
365
+ @misc{granite-models,
366
+ author = {author 1, author2, ...},
367
+ title = {},
368
+ journal = {},
369
+ volume = {},
370
+ year = {2024},
371
+ url = {https://arxiv.org/abs/0000.00000},
372
+ }
373
+ ``` -->