ranarag commited on
Commit
95b5191
·
verified ·
1 Parent(s): 784580f

adding model card

Browse files
Files changed (1) hide show
  1. README.md +349 -3
README.md CHANGED
@@ -1,3 +1,349 @@
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-2b-instruct
11
+ ---
12
+
13
+ # Granite-3.2-2B-Instruct
14
+
15
+ **Model Summary:**
16
+ Granite-3.2-2B-Instruct is an 2-billion-parameter, long-context AI model fine-tuned for advanced reasoning capabilities. Built on top of [Granite-3.1-2B-Instruct](https://huggingface.co/ibm-granite/granite-3.1-2b-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 21th, 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-2B-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-2b-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. First, let's understand the composition of the initial 10 liters of 30% acid solution:
91
+ - Acid content = 30% of 10 liters = 0.30 * 10 = 3 liters
92
+
93
+ 2. We want to end up with a 50% acid solution. Let's denote the volume of the 70% acid solution to be added as 'x' liters.
94
+
95
+ 3. The amount of acid in the final mixture (50% solution) should equal the initial acid content plus the acid from the added 70% solution.
96
+ - Total acid in final mixture = 0.50 * (10 + x)
97
+
98
+ 4. The equation representing the total acid content is:
99
+ 3 (from initial solution) + 0.70 * x (from added solution) = 0.50 * (10 + x)
100
+
101
+ 5. Now, we solve for 'x':
102
+ 3 + 0.70x = 5 + 0.50x
103
+ 0.70x - 0.50x = 5 - 3
104
+ 0.20x = 2
105
+ x = 2 / 0.20
106
+ x = 10 liters
107
+
108
+ 6. Therefore, 10 liters of a 70% acid solution must be added to the initial 10 liters of 30% acid solution to achieve a 50% acid mixture.
109
+
110
+ Here is my response:
111
+
112
+ To solve this problem, we need to determine how much of a 70% acid solution must be added to a 10-liter solution that is already 30% acid to create a new mixture that is 50% acid. Here's how to calculate it:
113
+
114
+ 1. **Initial Acid Content**:
115
+ - The initial 10-liter solution contains 3 liters of acid (since 30% of 10 liters).
116
+
117
+ 2. **Desired Final Acid Content**:
118
+ - We want the final mixture to be 50% acid.
119
+
120
+ 3. **Equation Setup**:
121
+ - Let 'x' be the volume (in liters) of the 70% acid solution to be added.
122
+ - The equation representing the total acid content in the final mixture (which is 10 liters from the initial solution plus 'x' liters of the added solution) should equal 50% of the total volume (10 + x).
123
+ - This gives us: 3 (acid from initial solution) + 0.70x (acid from added solution) = 0.50(10 + x)
124
+
125
+ 4. **Solving the Equation**:
126
+ - First, simplify the right side of the equation: 0.50(10 + x) = 5 + 0.50x
127
+ - Now, the equation is: 3 + 0.70x = 5 + 0.50x
128
+ - Subtract 0.50x from both sides: 0.20x = 2
129
+ - Divide both sides by 0.20: x = 2 / 0.20
130
+ - x = 10 liters
131
+
132
+ 5. **Conclusion**:
133
+ - To achieve a 50% acid mixture from the initial 30% solution, you need to add 10 liters of a 70% acid solution.
134
+
135
+ So, the final answer is that 10 liters of a 70% acid solution must be added to the initial 10 liters of 30% acid solution.
136
+ ```
137
+ - thinking=False
138
+ ```md
139
+ To solve this problem, we'll use the concept of volume and concentration. Let's denote the amount of 70% acid solution we need to add as "x" liters.
140
+
141
+ First, let's find out how much acid is in the initial 10-liter solution:
142
+
143
+ Acid in initial solution = 30% of 10 liters = 0.30 * 10 = 3 liters
144
+
145
+ Now, we want to end up with a 50% acid solution in a total volume of (10 + x) liters. Let's denote the final volume as V.
146
+
147
+ Final acid concentration = 50%
148
+ Final acid amount = 50% of V = 0.50 * V
149
+
150
+ We know the initial acid amount and the final acid amount, so we can set up an equation:
151
+
152
+ Initial acid amount + Acid from added solution = Final acid amount
153
+ 3 liters + (70% of x) = 0.50 * (10 + x)
154
+
155
+ Now, let's solve for x:
156
+
157
+ 0.70x + 3 = 0.50 * 10 + 0.50x
158
+ 0.70x - 0.50x = 0.50 * 10 - 3
159
+ 0.20x = 5 - 3
160
+ 0.20x = 2
161
+ x = 2 / 0.20
162
+ x = 10 liters
163
+
164
+ So, you need to add 10 liters of a 70% acid solution to the initial 10-liter 30% acid solution to achieve a 50% acid mixture.
165
+ ```
166
+
167
+ **Evaluation Results:**
168
+ <table>
169
+
170
+ <thead>
171
+ <tr>
172
+ <th style="text-align:left; background-color: #001d6c; color: white;">Models</th>
173
+ <th style="text-align:center; background-color: #001d6c; color: white;">ArenaHard</th>
174
+ <th style="text-align:center; background-color: #001d6c; color: white;">Alpaca-Eval-2</th>
175
+ <th style="text-align:center; background-color: #001d6c; color: white;">MMLU</th>
176
+ <th style="text-align:center; background-color: #001d6c; color: white;">PopQA</th>
177
+ <th style="text-align:center; background-color: #001d6c; color: white;">TruthfulQA</th>
178
+ <th style="text-align:center; background-color: #001d6c; color: white;">BigBenchHard</th>
179
+ <th style="text-align:center; background-color: #001d6c; color: white;">DROP</th>
180
+ <th style="text-align:center; background-color: #001d6c; color: white;">GSM8K</th>
181
+ <th style="text-align:center; background-color: #001d6c; color: white;">HumanEval</th>
182
+ <th style="text-align:center; background-color: #001d6c; color: white;">HumanEval+</th>
183
+ <th style="text-align:center; background-color: #001d6c; color: white;">IFEval</th>
184
+ <th style="text-align:center; background-color: #001d6c; color: white;">AttaQ</th>
185
+ </tr></thead>
186
+ <tbody>
187
+ <tr>
188
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Llama-3.1-8B-Instruct</td>
189
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">36.43</td>
190
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">27.22</td>
191
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">69.15</td>
192
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">28.79</td>
193
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">52.79</td>
194
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">72.66</td>
195
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">61.48</td>
196
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">83.24</td>
197
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.32</td>
198
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">80.15</td>
199
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">79.10</td>
200
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">83.43</td>
201
+ </tr>
202
+
203
+ <tr>
204
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">DeepSeek-R1-Distill-Llama-8B</td>
205
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">17.17</td>
206
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">21.85</td>
207
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">45.80</td>
208
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">13.25</td>
209
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">47.43</td>
210
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">65.71</td>
211
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">44.46</td>
212
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">72.18</td>
213
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">67.54</td>
214
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">62.91</td>
215
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">66.50</td>
216
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">42.87</td>
217
+ </tr>
218
+
219
+ <tr>
220
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Qwen-2.5-7B-Instruct</td>
221
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">25.44</td>
222
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">30.34</td>
223
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">74.30</td>
224
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">18.12</td>
225
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">63.06</td>
226
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">70.40</td>
227
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">54.71</td>
228
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">84.46</td>
229
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">93.35</td>
230
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">89.91</td>
231
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">74.90</td>
232
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">81.90</td>
233
+ </tr>
234
+
235
+ <tr>
236
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">DeepSeek-R1-Distill-Qwen-7B</td>
237
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">10.36</td>
238
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">15.35</td>
239
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">50.72</td>
240
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">9.94</td>
241
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">47.14</td>
242
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">65.04</td>
243
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">42.76</td>
244
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">78.47</td>
245
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">79.89</td>
246
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">78.43</td>
247
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">59.10</td>
248
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">42.45</td>
249
+ </tr>
250
+
251
+ <tr>
252
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Granite-3.1-8B-Instruct</td>
253
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">37.58</td>
254
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">30.34</td>
255
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">66.77</td>
256
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">28.7</td>
257
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">65.84</td>
258
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">68.55</td>
259
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">50.78</td>
260
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">79.15</td>
261
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">89.63</td>
262
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.79</td>
263
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">73.20</td>
264
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.73</td>
265
+ </tr>
266
+
267
+
268
+ <tr>
269
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Granite-3.1-2B-Instruct</td>
270
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">23.3</td>
271
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">27.17</td>
272
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">57.11</td>
273
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">20.55</td>
274
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">59.79</td>
275
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">54.46</td>
276
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">18.68</td>
277
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">67.55</td>
278
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">79.45</td>
279
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">75.26</td>
280
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">63.59</td>
281
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">84.7</td>
282
+ </tr>
283
+
284
+ <tr>
285
+ <td style="text-align:left; background-color: #DAE8FF; color: black;">Granite-3.2-8B-Instruct</td>
286
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">55.25</td>
287
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">61.19</td>
288
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">66.79</td>
289
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">28.04</td>
290
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">66.92</td>
291
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">64.77</td>
292
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">50.95</td>
293
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">81.65</td>
294
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">89.35</td>
295
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.72</td>
296
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">74.31</td>
297
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">85.42</td>
298
+
299
+ </tr>
300
+
301
+ <tr>
302
+ <td style="text-align:left; background-color: #DAE8FF; color: black;"><b>Granite-3.2-2B-Instruct</b></td>
303
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">24.86</td>
304
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">34.51</td>
305
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">57.18</td>
306
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">20.56</td>
307
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">59.8</td>
308
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">52.27</td>
309
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">21.12</td>
310
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">67.02</td>
311
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">80.13</td>
312
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">73.39</td>
313
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">61.55</td>
314
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">83.23</td>
315
+ </tr>
316
+
317
+
318
+
319
+
320
+
321
+ </tbody></table>
322
+
323
+ **Training Data:**
324
+ 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.
325
+ <!-- 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). -->
326
+
327
+ **Infrastructure:**
328
+ We train Granite-3.2-2B-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.
329
+
330
+ **Ethical Considerations and Limitations:**
331
+ Granite-3.2-2B-Instruct builds upon Granite-3.1-2B-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-2B-Instruct](https://huggingface.co/ibm-granite/granite-3.1-2b-instruct) remain relevant.
332
+
333
+
334
+ **Resources**
335
+ - ⭐️ Learn about the latest updates with Granite: https://www.ibm.com/granite
336
+ - 📄 Get started with tutorials, best practices, and prompt engineering advice: https://www.ibm.com/granite/docs/
337
+ - 💡 Learn about the latest Granite learning resources: https://ibm.biz/granite-learning-resources
338
+
339
+ <!-- ## Citation
340
+ ```
341
+ @misc{granite-models,
342
+ author = {author 1, author2, ...},
343
+ title = {},
344
+ journal = {},
345
+ volume = {},
346
+ year = {2024},
347
+ url = {https://arxiv.org/abs/0000.00000},
348
+ }
349
+ ``` -->