GrizleeBer commited on
Commit
211db0a
·
verified ·
1 Parent(s): 9abe2b2

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,597 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: transformers
4
+ tags:
5
+ - language
6
+ - granite-4.1
7
+ ---
8
+
9
+ [![mof-class3-qualified](https://mot.isitopen.ai/modules/mof/assets/badge_class3_qualified.png)](https://mot.isitopen.ai/model/1160)
10
+
11
+ # Granite-4.1-3B
12
+
13
+ <!-- 📣 **Update [10-07-2025]:** Added a *default system prompt* to the chat template to guide the model towards more *professional, accurate, and safe* responses. -->
14
+
15
+ **Model Summary:**
16
+ Granite-4.1-3B is a 3B parameter long-context instruct model finetuned from *Granite-4.1-3B-Base* using a combination of open source instruction datasets with permissive license and internally collected synthetic datasets. Granite 4.1 models have gone through an improved post-training pipeline, including supervised finetuning and reinforcement learning alignment, resulting in enhanced tool calling, instruction following, and chat capabilities.
17
+
18
+ - **Developers:** Granite Team, IBM
19
+ - **HF Collection:** [Granite 4.1 Language Models HF Collection](https://huggingface.co/collections/ibm-granite/granite-41-language-models)
20
+ - **Technical Blog:** [Granite-4.1 Blog](https://huggingface.co/blog/ibm-granite/granite-4-1)
21
+ - **GitHub Repository:** [ibm-granite/granite-4.1-language-models](https://github.com/ibm-granite/granite-4.1-language-models)
22
+ - **Website**: [Granite Docs](https://www.ibm.com/granite/docs/)
23
+ - **Release Date**: April 29th, 2026
24
+ - **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
25
+
26
+ **Supported Languages:**
27
+ English, German, Spanish, French, Japanese, Portuguese, Arabic, Czech, Italian, Korean, Dutch, and Chinese. Users may finetune Granite 4.1 models for languages beyond these languages.
28
+
29
+ **Intended use:**
30
+ The model is designed to follow general instructions and can serve as the foundation for AI assistants across diverse domains, including business applications, as well as for LLM agents equipped with tool-use capabilities.
31
+
32
+ *Capabilities*
33
+ * Summarization
34
+ * Text classification
35
+ * Text extraction
36
+ * Question-answering
37
+ * Retrieval Augmented Generation (RAG)
38
+ * Code related tasks
39
+ * Function-calling tasks
40
+ * Multilingual dialog use cases
41
+ * Fill-In-the-Middle (FIM) code completions
42
+
43
+ <!-- <todo>Need to test the examples. (especially the tool calling and RAG ones)</todo>
44
+ -->
45
+
46
+ **Generation:**
47
+ This is a simple example of how to use Granite-4.1-3B model.
48
+
49
+ Install the following libraries:
50
+
51
+ ```shell
52
+ pip install torch torchvision torchaudio
53
+ pip install accelerate
54
+ pip install transformers
55
+ ```
56
+ Then, copy the snippet from the section that is relevant for your use case.
57
+
58
+ ```python
59
+ import torch
60
+ from transformers import AutoModelForCausalLM, AutoTokenizer
61
+
62
+ device = "cuda"
63
+ model_path = "ibm-granite/granite-4.1-3b"
64
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
65
+ # drop device_map if running on CPU
66
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
67
+ model.eval()
68
+ # change input text as desired
69
+ chat = [
70
+ { "role": "user", "content": "Please list one IBM Research laboratory located in the United States. You should only output its name and location." },
71
+ ]
72
+ chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
73
+ # tokenize the text
74
+ input_tokens = tokenizer(chat, return_tensors="pt").to(device)
75
+ # generate output tokens
76
+ output = model.generate(**input_tokens,
77
+ max_new_tokens=100)
78
+ # decode output tokens into text
79
+ output = tokenizer.batch_decode(output)
80
+ # print output
81
+ print(output[0])
82
+ ```
83
+
84
+ Expected output:
85
+ ```shell
86
+ <|start_of_role|>user<|end_of_role|>Please list one IBM Research laboratory located in the United States. You should only output its name and location.<|end_of_text|>
87
+ <|start_of_role|>assistant<|end_of_role|>Almaden Research Center, San Jose, California<|end_of_text|>
88
+ ```
89
+ <!-- 📣 **Update [2025-10-07]:** Added a *default system prompt* to the chat template to guide the model towards more *professional, accurate, and safe* responses. -->
90
+
91
+ **Tool-calling:**
92
+ Granite-4.1-3B comes with enhanced tool calling capabilities, enabling seamless integration with external functions and APIs. To define a list of tools please follow OpenAI's function [definition schema](https://platform.openai.com/docs/guides/function-calling?api-mode=responses#defining-functions).
93
+
94
+ This is an example of how to use Granite-4.1-3B model tool-calling ability:
95
+
96
+ ```python
97
+ import torch
98
+ from transformers import AutoModelForCausalLM, AutoTokenizer
99
+
100
+ device = "cuda"
101
+ model_path = "ibm-granite/granite-4.1-3b"
102
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
103
+ # drop device_map if running on CPU
104
+ model = AutoModelForCausalLM.from_pretrained(model_path, device_map=device)
105
+ model.eval()
106
+
107
+ tools = [
108
+ {
109
+ "type": "function",
110
+ "function": {
111
+ "name": "get_current_weather",
112
+ "description": "Get the current weather for a specified city.",
113
+ "parameters": {
114
+ "type": "object",
115
+ "properties": {
116
+ "city": {
117
+ "type": "string",
118
+ "description": "Name of the city"
119
+ }
120
+ },
121
+ "required": ["city"]
122
+ }
123
+ }
124
+ }
125
+ ]
126
+
127
+ # change input text as desired
128
+ chat = [
129
+ { "role": "user", "content": "What's the weather like in Boston right now?" },
130
+ ]
131
+ chat = tokenizer.apply_chat_template(chat, \
132
+ tokenize=False, \
133
+ tools=tools, \
134
+ add_generation_prompt=True)
135
+ # tokenize the text
136
+ input_tokens = tokenizer(chat, return_tensors="pt").to(device)
137
+ # generate output tokens
138
+ output = model.generate(**input_tokens,
139
+ max_new_tokens=100)
140
+ # decode output tokens into text
141
+ output = tokenizer.batch_decode(output)
142
+ # print output
143
+ print(output[0])
144
+ ```
145
+
146
+ Expected output:
147
+ ```shell
148
+ <|start_of_role|>system<|end_of_role|>You are a helpful assistant with access to the following tools. You may call one or more tools to assist with the user query.
149
+
150
+ You are provided with function signatures within <tools></tools> XML tags:
151
+ <tools>
152
+ {"type": "function", "function": {"name": "get_current_weather", "description": "Get the current weather for a specified city.", "parameters": {"type": "object", "properties": {"city": {"type": "string", "description": "Name of the city"}}, "required": ["city"]}}}
153
+ </tools>
154
+
155
+ For each tool call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
156
+ <tool_call>
157
+ {"name": <function-name>, "arguments": <args-json-object>}
158
+ </tool_call>. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.<|end_of_text|>
159
+ <|start_of_role|>user<|end_of_role|>What's the weather like in Boston right now?<|end_of_text|>
160
+ <|start_of_role|>assistant<|end_of_role|><tool_call>
161
+ {"name": "get_current_weather", "arguments": {"city": "Boston"}}
162
+ </tool_call><|end_of_text|>
163
+ ```
164
+
165
+ <!-- **Retrieval Augmented Generation:**
166
+ *Coming soon* -->
167
+
168
+ **Evaluation Results:**
169
+
170
+ <table>
171
+ <!-- <caption><b> All Results</b></caption> -->
172
+ <thead>
173
+ <tr>
174
+ <th style="text-align:left; background-color: #001d6c; color: white;">Benchmarks</th>
175
+ <th style="text-align:left; background-color: #001d6c; color: white;">Metric</th>
176
+ <th style="text-align:center; background-color: #001d6c; color: white;">3B Dense</th>
177
+ <th style="text-align:center; background-color: #001d6c; color: white;">8B Dense</th>
178
+ <th style="text-align:center; background-color: #001d6c; color: white;">30B Dense</th>
179
+ </tr>
180
+ </thead>
181
+ <tbody>
182
+ <tr>
183
+ <td colspan="5" style="text-align:center; background-color: #FFFFFF; color: #2D2D2D; font-style:italic;">
184
+ General Tasks
185
+ </td>
186
+ </tr>
187
+ <tr>
188
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MMLU</td>
189
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">5-shot</td>
190
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">67.02</td>
191
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">73.84</td>
192
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">80.16</td>
193
+ </tr>
194
+ <tr>
195
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MMLU-Pro</td>
196
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">5-shot, CoT</td>
197
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">49.83</td>
198
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">55.99</td>
199
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">64.09</td>
200
+ </tr>
201
+ <tr>
202
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">BBH</td>
203
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">3-shot, CoT</td>
204
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">75.83</td>
205
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">80.51</td>
206
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">83.74</td>
207
+ </tr>
208
+ <tr>
209
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">AGI EVAL</td>
210
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">0-shot, CoT</td>
211
+ <td style="text-align:right; background-color:#DAE8FF; color: #2D2D2D;">65.16</td>
212
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">72.43</td>
213
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">77.80</td>
214
+ </tr>
215
+ <tr>
216
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">GPQA</td>
217
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">0-shot, CoT</td>
218
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">31.70</td>
219
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">41.96</td>
220
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">45.76</td>
221
+ </tr>
222
+ <tr>
223
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">SimpleQA</td>
224
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;"></td>
225
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">3.68</td>
226
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">4.82</td>
227
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">6.81</td>
228
+ </tr>
229
+ <tr>
230
+ <td colspan="5" style="text-align:center; background-color: #FFFFFF; color: #2D2D2D; font-style:italic;">
231
+ Alignment Tasks
232
+ </td>
233
+ </tr>
234
+ <tr>
235
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">AlpacaEval 2.0</td>
236
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;"></td>
237
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">38.57</td>
238
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">50.08</td>
239
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">56.16</td>
240
+ </tr>
241
+ <tr>
242
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">IFEval Avg</td>
243
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;"></td>
244
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">82.30</td>
245
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">87.06</td>
246
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">89.65</td>
247
+ </tr>
248
+ <tr>
249
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">ArenaHard</td>
250
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;"></td>
251
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">37.80</td>
252
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">68.98</td>
253
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">71.02</td>
254
+ </tr>
255
+ <tr>
256
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MTBench Avg</td>
257
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;"></td>
258
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">7.57</td>
259
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">8.61</td>
260
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">8.61</td>
261
+ </tr>
262
+ <tr>
263
+ <td colspan="5" style="text-align:center; background-color: #FFFFFF; color: #2D2D2D; font-style:italic;">
264
+ Math Tasks
265
+ </td>
266
+ </tr>
267
+ <tr>
268
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">GSM8K</td>
269
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">8-shot</td>
270
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">86.88</td>
271
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">92.49</td>
272
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">94.16</td>
273
+ </tr>
274
+ <tr>
275
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">GSM Symbolic</td>
276
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">8-shot</td>
277
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">81.32</td>
278
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">83.70</td>
279
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">75.70</td>
280
+ </tr>
281
+ <tr>
282
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">Minerva Math</td>
283
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">0-shot, CoT</td>
284
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">67.94</td>
285
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">80.10</td>
286
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">81.32</td>
287
+ </tr>
288
+ <tr>
289
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">DeepMind Math</td>
290
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">0-shot, CoT</td>
291
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">64.64</td>
292
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">80.07</td>
293
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">81.93</td>
294
+ </tr>
295
+ <tr>
296
+ <td colspan="5" style="text-align:center; background-color: #FFFFFF; color: #2D2D2D; font-style:italic;">
297
+ Code Tasks
298
+ </td>
299
+ </tr>
300
+ <tr>
301
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">HumanEval</td>
302
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">pass@1</td>
303
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">81.71</td>
304
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">85.37</td>
305
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">88.41</td>
306
+ </tr>
307
+ <tr>
308
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">HumanEval+</td>
309
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">pass@1</td>
310
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">76.83</td>
311
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">79.88</td>
312
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">85.37</td>
313
+ </tr>
314
+ <tr>
315
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MBPP</td>
316
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">pass@1</td>
317
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">71.16</td>
318
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">87.30</td>
319
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">85.45</td>
320
+ </tr>
321
+ <tr>
322
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MBPP+</td>
323
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">pass@1</td>
324
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">62.17</td>
325
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">73.81</td>
326
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">73.54</td>
327
+ </tr>
328
+ <tr>
329
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">CRUXEval-O</td>
330
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">pass@1</td>
331
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">40.75</td>
332
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">47.63</td>
333
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">55.75</td>
334
+ </tr>
335
+ <tr>
336
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">BigCodeBench</td>
337
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">pass@1</td>
338
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">32.19</td>
339
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">35.00</td>
340
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">38.77</td>
341
+ </tr>
342
+ <tr>
343
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MULTIPLE</td>
344
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">pass@1</td>
345
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">52.54</td>
346
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">60.26</td>
347
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">62.31</td>
348
+ </tr>
349
+ <tr>
350
+ <tr>
351
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">Eval+ Avg</td>
352
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">pass@1</td>
353
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">67.05</td>
354
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">80.21</td>
355
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">82.66</td>
356
+ </tr>
357
+ <tr>
358
+ <td colspan="5" style="text-align:center; background-color: #FFFFFF; color: #2D2D2D; font-style:italic;">
359
+ Tool Calling Tasks
360
+ </td>
361
+ </tr>
362
+ <tr>
363
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">BFCL v3</td>
364
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;"></td>
365
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">60.80</td>
366
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">68.27</td>
367
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">73.68</td>
368
+ </tr>
369
+ <tr>
370
+ <td colspan="5" style="text-align:center; background-color: #FFFFFF; color: #2D2D2D; font-style:italic;">
371
+ Multilingual Tasks
372
+ </td>
373
+ </tr>
374
+ <tr>
375
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MMMLU</td>
376
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">5-shot</td>
377
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">57.61</td>
378
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">64.84</td>
379
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">73.71</td>
380
+ </tr>
381
+ <tr>
382
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">INCLUDE</td>
383
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">5-shot</td>
384
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">52.05</td>
385
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">58.89</td>
386
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">67.26</td>
387
+ </tr>
388
+ <tr>
389
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MGSM</td>
390
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">8-shot</td>
391
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">70.00</td>
392
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">82.32</td>
393
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">71.12</td>
394
+ </tr>
395
+ <tr>
396
+ <td colspan="6" style="text-align:center; background-color: #FFFFFF; color: #2D2D2D; font-style:italic;">
397
+ Safety
398
+ </td>
399
+ </tr>
400
+ <tr>
401
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">SALAD-Bench</td>
402
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;"></td>
403
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">93.95</td>
404
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">95.80</td>
405
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">96.41</td>
406
+ </tr>
407
+ <tr>
408
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">AttaQ</td>
409
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;"></td>
410
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">81.88</td>
411
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">81.19</td>
412
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">85.76</td>
413
+ </tr>
414
+ <tr>
415
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">Tulu3 Safety Eval Avg</td>
416
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;"></td>
417
+ <td style="text-align:right; background-color: #DAE8FF; color: #2D2D2D;">66.84</td>
418
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">75.57</td>
419
+ <td style="text-align:right; background-color: #FFFFFF; color: #2D2D2D;">78.19</td>
420
+ </tr>
421
+ </tbody></table>
422
+
423
+
424
+ <table>
425
+ <caption><b>Multilingual Benchmarks and the included languages:</b></caption>
426
+ <thead>
427
+ <tr>
428
+ <th style="text-align:left; background-color: #001d6c; color: white;">Benchmarks</th>
429
+ <th style="text-align:left; background-color: #001d6c; color: white;"># Langs</th>
430
+ <th style="text-align:center; background-color: #001d6c; color: white;">Languages</th>
431
+ </tr>
432
+ </thead>
433
+ <tbody>
434
+ <tr>
435
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MMMLU</td>
436
+ <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">11</td>
437
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">ar, de, en, es, fr, ja, ko, pt, zh, bn, hi</td>
438
+ </tr>
439
+ <tr>
440
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">INCLUDE</td>
441
+ <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">14</td>
442
+ <!-- <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">hindi, bengali, tamil, telugu, arabic, german, spanish, french, italian, japanese, korean, dutch, portuguese, chinese</td> -->
443
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">hi, bn, ta, te, ar, de, es, fr, it, ja, ko, nl, pt, zh</td>
444
+
445
+ </tr>
446
+ <tr>
447
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">MGSM</td>
448
+ <td style="text-align:center; background-color: #FFFFFF; color: #2D2D2D;">5</td>
449
+ <td style="text-align:left; background-color: #FFFFFF; color: #2D2D2D;">en, es, fr, ja, zh</td>
450
+ </tr>
451
+ </tbody>
452
+ </table>
453
+
454
+ **Model Architecture:**
455
+
456
+ Granite-4.1-3B baseline is built on a decoder-only dense transformer architecture. Core components of this architecture are: GQA, RoPE, MLP with SwiGLU, RMSNorm, and shared input/output embeddings.
457
+
458
+ <table>
459
+ <thead>
460
+ <tr>
461
+ <th style="text-align:left; background-color: #001d6c; color: white;">Model</th>
462
+ <th style="text-align:center; background-color: #001d6c; color: white;">3B Dense</th>
463
+ <th style="text-align:center; background-color: #001d6c; color: white;">8B Dense</th>
464
+ <th style="text-align:center; background-color: #001d6c; color: white;">30B Dense</th>
465
+ </tr></thead>
466
+ <tbody>
467
+ <tr>
468
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Embedding size</td>
469
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">2560</td>
470
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">4096</td>
471
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">4096</td>
472
+ </tr>
473
+ <tr>
474
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Number of layers</td>
475
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">40</td>
476
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">40</td>
477
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">64</td>
478
+ </tr>
479
+ <tr>
480
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Attention head size</td>
481
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">64</td>
482
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">128</td>
483
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">128</td>
484
+ </tr>
485
+ <tr>
486
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Number of attention heads</td>
487
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">40</td>
488
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">32</td>
489
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">32</td>
490
+ </tr>
491
+ <tr>
492
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Number of KV heads</td>
493
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">8</td>
494
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">8</td>
495
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">8</td>
496
+ </tr>
497
+ <!--<tr>
498
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Mamba2 state size</td>
499
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">-</td>
500
+ <td style="text-align:center; background-color: #DAE8FF; color: black;"></td>
501
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
502
+ </tr>
503
+ <tr>
504
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Number of Mamba2 heads</td>
505
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
506
+ <td style="text-align:center; background-color: #DAE8FF; color: black;"></td>
507
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
508
+ </tr>-->
509
+
510
+ <tr>
511
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">MLP / Shared expert hidden size</td>
512
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">8192</td>
513
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">12800</td>
514
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">32768</td>
515
+ </tr>
516
+ <!--<tr>
517
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Num. Experts</td>
518
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
519
+ <td style="text-align:center; background-color: #DAE8FF; color: black;"></td>
520
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
521
+ </tr>
522
+ <tr>
523
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Num. active Experts</td>
524
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
525
+ <td style="text-align:center; background-color: #DAE8FF; color: black;"></td>
526
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
527
+ </tr>
528
+ <tr>
529
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Expert hidden size</td>
530
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
531
+ <td style="text-align:center; background-color: #DAE8FF; color: black;"></td>
532
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
533
+ </tr>-->
534
+
535
+ <tr>
536
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">MLP activation</td>
537
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">SwiGLU</td>
538
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">SwiGLU</td>
539
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">SwiGLU</td>
540
+ </tr>
541
+
542
+ <tr>
543
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Sequence length</td>
544
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">131072</td>
545
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">131072</td>
546
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">131072</td>
547
+ </tr>
548
+ <tr>
549
+ <td style="text-align:left; background-color: #FFFFFF; color: black;">Position embedding</td>
550
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">RoPE</td>
551
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">RoPE</td>
552
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">RoPE</td>
553
+ </tr>
554
+ <tr>
555
+ <td style="text-align:left; background-color: #FFFFFF; color: black;"># Parameters</td>
556
+ <td style="text-align:center; background-color: #DAE8FF; color: black;">3B</td>
557
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">8B</td>
558
+ <td style="text-align:center; background-color: #FFFFFF; color: black;">30B</td>
559
+ </tr>
560
+ <!-- <tr>
561
+ <td style="text-align:left; background-color: #FFFFFF; color: black;"># Active parameters</td>
562
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
563
+ <td style="text-align:center; background-color: #DAE8FF; color: black;"></td>
564
+ <td style="text-align:center; background-color: #FFFFFF; color: black;"></td>
565
+ </tr>-->
566
+ </tbody></table>
567
+
568
+
569
+
570
+ **Training Data:**
571
+ 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) a select set of human-curated data.
572
+
573
+ **Supervised Fine-Tuning and Reinforcement Learning:**
574
+ Instruct model has been fine tuned with significantly improved SFT-pipeline and Reinforcement learning pipelines with high quality mix of various datasets as mentioned above. With rigorous SFT-RL cycles we have improved Granite-4.1 model's tool calling, instruction following and chat capabilities. For further details please check our [Granite-4.1 Blog]((https://huggingface.co/blog/ibm-granite/granite-4-1)).
575
+
576
+ **Infrastructure:**
577
+ We trained the Granite 4.1 Language Models utilizing an NVIDIA GB200 NVL72 cluster hosted in CoreWeave. Intra-rack communication occurs via the 72-GPU NVLink domain, and a non-blocking, full Fat-Tree NDR 400 Gb/s InfiniBand network provides inter-rack communication. This cluster provides a scalable and efficient infrastructure for training our models over thousands of GPUs.
578
+
579
+ **Ethical Considerations and Limitations:**
580
+ Granite 4.1 Instruction Models are primarily finetuned using instruction-response pairs mostly in English, but also multilingual data covering multiple languages. Although this model can handle multilingual dialog use cases, its performance might not be similar to English tasks. In such cases, 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. We urge the community to use this model with proper safety testing and tuning tailored for their specific tasks. To enhance safety in enterprise deployments, we recommend using Granite 4.1 Language models alongside [Granite Guardian](https://huggingface.co/ibm-granite/granite-guardian-4.1-8b), a model designed to detect and flag risks in inputs and outputs across key dimensions outlined in the IBM AI Risk Atlas.
581
+
582
+ **Resources**
583
+ - ⭐️ Learn about the latest updates with Granite: https://www.ibm.com/granite
584
+ - 📄 Get started with tutorials, best practices, and prompt engineering advice: https://www.ibm.com/granite/docs/
585
+ - 💡 Learn about the latest Granite learning resources: https://ibm.biz/granite-learning-resources
586
+
587
+ <!-- ## Citation
588
+ ```
589
+ @misc{granite-models,
590
+ author = {author 1, author2, ...},
591
+ title = {},
592
+ journal = {},
593
+ volume = {},
594
+ year = {2024},
595
+ url = {https://arxiv.org/abs/0000.00000},
596
+ }
597
+ ``` -->
adapter_index.json ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_info": {
3
+ "num_adapters": 13,
4
+ "base_model": "granite-4.1-3b"
5
+ },
6
+ "adapters": [
7
+ {
8
+ "adapter_index": 1,
9
+ "adapter_name": "citations",
10
+ "technology": "lora",
11
+ "control_token": {
12
+ "token": "<|citations|>",
13
+ "id": 100352
14
+ },
15
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-rag-r1.0/snapshots/6e4a75e35f1cb272e8d15b4615fb0a123398d1cf/citations/granite-4.1-3b/lora",
16
+ "io_config": "io_configs/citations/io.yaml"
17
+ },
18
+ {
19
+ "adapter_index": 2,
20
+ "adapter_name": "query_rewrite",
21
+ "technology": "lora",
22
+ "control_token": {
23
+ "token": "<|query_rewrite|>",
24
+ "id": 100353
25
+ },
26
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-rag-r1.0/snapshots/6e4a75e35f1cb272e8d15b4615fb0a123398d1cf/query_rewrite/granite-4.1-3b/lora",
27
+ "io_config": "io_configs/query_rewrite/io.yaml"
28
+ },
29
+ {
30
+ "adapter_index": 3,
31
+ "adapter_name": "query_clarification",
32
+ "technology": "lora",
33
+ "control_token": {
34
+ "token": "<|query_clarification|>",
35
+ "id": 100354
36
+ },
37
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-rag-r1.0/snapshots/6e4a75e35f1cb272e8d15b4615fb0a123398d1cf/query_clarification/granite-4.1-3b/lora",
38
+ "io_config": "io_configs/query_clarification/io.yaml"
39
+ },
40
+ {
41
+ "adapter_index": 4,
42
+ "adapter_name": "context_relevance",
43
+ "technology": "lora",
44
+ "control_token": {
45
+ "token": "<|context_relevance|>",
46
+ "id": 100355
47
+ },
48
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-rag-r1.0/snapshots/6e4a75e35f1cb272e8d15b4615fb0a123398d1cf/context_relevance/granite-4.1-3b/lora",
49
+ "io_config": "io_configs/context_relevance/io.yaml"
50
+ },
51
+ {
52
+ "adapter_index": 5,
53
+ "adapter_name": "hallucination_detection",
54
+ "technology": "lora",
55
+ "control_token": {
56
+ "token": "<|hallucination_detection|>",
57
+ "id": 100356
58
+ },
59
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-rag-r1.0/snapshots/6e4a75e35f1cb272e8d15b4615fb0a123398d1cf/hallucination_detection/granite-4.1-3b/lora",
60
+ "io_config": "io_configs/hallucination_detection/io.yaml"
61
+ },
62
+ {
63
+ "adapter_index": 6,
64
+ "adapter_name": "answerability",
65
+ "technology": "lora",
66
+ "control_token": {
67
+ "token": "<|answerability|>",
68
+ "id": 100357
69
+ },
70
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-rag-r1.0/snapshots/6e4a75e35f1cb272e8d15b4615fb0a123398d1cf/answerability/granite-4.1-3b/lora",
71
+ "io_config": "io_configs/answerability/io.yaml"
72
+ },
73
+ {
74
+ "adapter_index": 7,
75
+ "adapter_name": "uncertainty",
76
+ "technology": "lora",
77
+ "control_token": {
78
+ "token": "<|uncertainty|>",
79
+ "id": 100358
80
+ },
81
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-core-r1.0/snapshots/8f78babf3f0d5baba230464838050a71fe59dee5/uncertainty/granite-4.1-3b/lora",
82
+ "io_config": "io_configs/uncertainty/io.yaml"
83
+ },
84
+ {
85
+ "adapter_index": 8,
86
+ "adapter_name": "requirement-check",
87
+ "technology": "lora",
88
+ "control_token": {
89
+ "token": "<|requirement-check|>",
90
+ "id": 100359
91
+ },
92
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-core-r1.0/snapshots/8f78babf3f0d5baba230464838050a71fe59dee5/requirement-check/granite-4.1-3b/lora",
93
+ "io_config": "io_configs/requirement-check/io.yaml"
94
+ },
95
+ {
96
+ "adapter_index": 9,
97
+ "adapter_name": "context-attribution",
98
+ "technology": "lora",
99
+ "control_token": {
100
+ "token": "<|context-attribution|>",
101
+ "id": 100360
102
+ },
103
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-core-r1.0/snapshots/8f78babf3f0d5baba230464838050a71fe59dee5/context-attribution/granite-4.1-3b/lora",
104
+ "io_config": "io_configs/context-attribution/io.yaml"
105
+ },
106
+ {
107
+ "adapter_index": 10,
108
+ "adapter_name": "factuality-detection",
109
+ "technology": "lora",
110
+ "control_token": {
111
+ "token": "<|factuality-detection|>",
112
+ "id": 100361
113
+ },
114
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-guardian-r1.0/snapshots/882ccf11cf1e4cdc3a66044f17872e55078dbc85/factuality-detection/granite-4.1-3b/lora",
115
+ "io_config": "io_configs/factuality-detection/io.yaml"
116
+ },
117
+ {
118
+ "adapter_index": 11,
119
+ "adapter_name": "policy-guardrails",
120
+ "technology": "lora",
121
+ "control_token": {
122
+ "token": "<|policy-guardrails|>",
123
+ "id": 100362
124
+ },
125
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-guardian-r1.0/snapshots/882ccf11cf1e4cdc3a66044f17872e55078dbc85/policy-guardrails/granite-4.1-3b/lora",
126
+ "io_config": "io_configs/policy-guardrails/io.yaml"
127
+ },
128
+ {
129
+ "adapter_index": 12,
130
+ "adapter_name": "factuality-correction",
131
+ "technology": "lora",
132
+ "control_token": {
133
+ "token": "<|factuality-correction|>",
134
+ "id": 100363
135
+ },
136
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-guardian-r1.0/snapshots/882ccf11cf1e4cdc3a66044f17872e55078dbc85/factuality-correction/granite-4.1-3b/lora",
137
+ "io_config": "io_configs/factuality-correction/io.yaml"
138
+ },
139
+ {
140
+ "adapter_index": 13,
141
+ "adapter_name": "guardian-core",
142
+ "technology": "lora",
143
+ "control_token": {
144
+ "token": "<|guardian-core|>",
145
+ "id": 100364
146
+ },
147
+ "original_path": "/proj/dmfexp/lastrasl/hfhub/hub/models--ibm-granite--granitelib-guardian-r1.0/snapshots/882ccf11cf1e4cdc3a66044f17872e55078dbc85/guardian-core/granite-4.1-3b/lora",
148
+ "io_config": "io_configs/guardian-core/io.yaml"
149
+ }
150
+ ]
151
+ }
chat_template.jinja ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set adapter_map = {
2
+ 'citations': {'token': '<|citations|>', 'type': 'lora'},
3
+ 'query_rewrite': {'token': '<|query_rewrite|>', 'type': 'lora'},
4
+ 'query_clarification': {'token': '<|query_clarification|>', 'type': 'lora'},
5
+ 'context_relevance': {'token': '<|context_relevance|>', 'type': 'lora'},
6
+ 'hallucination_detection': {'token': '<|hallucination_detection|>', 'type': 'lora'},
7
+ 'answerability': {'token': '<|answerability|>', 'type': 'lora'},
8
+ 'uncertainty': {'token': '<|uncertainty|>', 'type': 'lora'},
9
+ 'requirement-check': {'token': '<|requirement-check|>', 'type': 'lora'},
10
+ 'context-attribution': {'token': '<|context-attribution|>', 'type': 'lora'},
11
+ 'factuality-detection': {'token': '<|factuality-detection|>', 'type': 'lora'},
12
+ 'policy-guardrails': {'token': '<|policy-guardrails|>', 'type': 'lora'},
13
+ 'factuality-correction': {'token': '<|factuality-correction|>', 'type': 'lora'},
14
+ 'guardian-core': {'token': '<|guardian-core|>', 'type': 'lora'}
15
+ } %}
16
+ {#- Look up adapter token, type, and invocation text from adapter_name -#}
17
+ {%- set adapter_token = '' %}
18
+ {%- set adapter_type = '' %}
19
+ {%- set adapter_invocation_text = '' %}
20
+ {%- if adapter_name is defined and adapter_name in adapter_map %}
21
+ {%- set adapter_token = adapter_map[adapter_name]['token'] %}
22
+ {%- set adapter_type = adapter_map[adapter_name]['type'] %}
23
+ {%- if adapter_map[adapter_name]['type'] == 'alora' %}
24
+ {%- set adapter_invocation_text = adapter_map[adapter_name]['invocation_text'] %}
25
+ {%- endif %}
26
+ {%- endif %}
27
+
28
+ {%- set tools_system_message_prefix = 'You are a helpful assistant with access to the following tools. You may call one or more tools to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>' %}
29
+ {%- set tools_system_message_suffix = '\n</tools>\n\nFor each tool call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call>. If a tool does not exist in the provided list of tools, notify the user that you do not have the ability to fulfill the request.' %}
30
+ {%- set documents_system_message_prefix = 'You are a helpful assistant with access to the following documents. You may use one or more documents to assist with the user query.\n\nYou are given a list of documents within <documents></documents> XML tags:\n<documents>' %}
31
+ {%- set documents_system_message_suffix = '\n</documents>\n\nWrite the response to the user\'s input by strictly aligning with the facts in the provided documents. If the information needed to answer the question is not available in the documents, inform the user that the question cannot be answered based on the available data.' %}
32
+ {%- if available_tools is defined and available_tools %}
33
+ {%- set tools = available_tools %}
34
+ {%- endif %}
35
+ {%- set ns = namespace(tools_system_message=tools_system_message_prefix,
36
+ documents_system_message=documents_system_message_prefix,
37
+ system_message=''
38
+ ,
39
+ adapter_token=adapter_token,
40
+ adapter_type=adapter_type,
41
+ adapter_invocation_text=adapter_invocation_text,
42
+ alora_target_idx=-1
43
+ ) %}
44
+ {%- if tools %}
45
+ {%- for tool in tools %}
46
+ {%- set ns.tools_system_message = ns.tools_system_message + '\n' + (tool | tojson) %}
47
+ {%- endfor %}
48
+ {%- set ns.tools_system_message = ns.tools_system_message + tools_system_message_suffix %}
49
+ {%- else %}
50
+ {%- set ns.tools_system_message = '' %}
51
+ {%- endif %}
52
+ {%- if documents %}
53
+ {%- for document in documents %}
54
+ {%- set ns.documents_system_message = ns.documents_system_message + '\n' + (document | tojson) %}
55
+ {%- endfor %}
56
+ {%- set ns.documents_system_message = ns.documents_system_message + documents_system_message_suffix %}
57
+ {%- else %}
58
+ {%- set ns.documents_system_message = '' %}
59
+ {%- endif %}
60
+ {#- For lora adapters: insert activation token at the very beginning -#}
61
+ {%- if ns.adapter_token and ns.adapter_type == 'lora' %}
62
+ {{- ns.adapter_token }}
63
+ {%- endif %}
64
+
65
+ {%- if messages[0].role == 'system' %}
66
+ {%- if messages[0].content is string %}
67
+ {%- set ns.system_message = messages[0].content %}
68
+ {%- elif messages[0].content is iterable %}
69
+ {%- for entry in messages[0].content %}
70
+ {%- if entry.type== 'text' %}
71
+ {%- if ns.system_message != '' %}
72
+ {%- set ns.system_message = ns.system_message + '\n' %}
73
+ {%- endif %}
74
+ {%- set ns.system_message = ns.system_message + entry.text %}
75
+ {%- endif %}
76
+ {%- endfor %}
77
+ {%- endif %}
78
+ {%- if tools and documents %}
79
+ {%- set ns.system_message = ns.system_message + '\n\n' + ns.tools_system_message + '\n\n' + ns.documents_system_message %}
80
+ {%- elif tools %}
81
+ {%- set ns.system_message = ns.system_message + '\n\n' + ns.tools_system_message %}
82
+ {%- elif documents %}
83
+ {%- set ns.system_message = ns.system_message + '\n\n' + ns.documents_system_message %}
84
+ {%- endif %}
85
+ {%- else %}
86
+ {%- if tools and documents %}
87
+ {%- set ns.system_message = ns.tools_system_message + '\n\n' + ns.documents_system_message %}
88
+ {%- elif tools %}
89
+ {%- set ns.system_message = ns.tools_system_message %}
90
+ {%- elif documents %}
91
+ {%- set ns.system_message = ns.documents_system_message %}
92
+ {%- endif %}
93
+ {%- endif %}
94
+ {%- if ns.system_message %}
95
+ {{- '<|start_of_role|>system<|end_of_role|>' + ns.system_message + '<|end_of_text|>\n' }}
96
+ {%- endif %}
97
+ {#- ALoRA Pass 1: find the last user message containing the invocation text.
98
+ ns.alora_target_idx stays -1 when the invocation sequence is the assistant role
99
+ token sequence (not present in any user message); the fallback insertion below
100
+ handles that case. -#}
101
+ {%- if ns.adapter_type == 'alora' and ns.adapter_invocation_text %}
102
+ {%- for _msg in messages %}
103
+ {%- if _msg.role == 'user' %}
104
+ {%- if _msg.content is string and ns.adapter_invocation_text in _msg.content %}
105
+ {%- set ns.alora_target_idx = loop.index0 %}
106
+ {%- elif _msg.content is not string and _msg.content is iterable %}
107
+ {%- set _msg_idx = loop.index0 %}
108
+ {%- for _entry in _msg.content %}
109
+ {%- if _entry.type == 'text' and ns.adapter_invocation_text in _entry.text %}
110
+ {%- set ns.alora_target_idx = _msg_idx %}
111
+ {%- endif %}
112
+ {%- endfor %}
113
+ {%- endif %}
114
+ {%- endif %}
115
+ {%- endfor %}
116
+ {%- endif %}
117
+ {%- for message in messages %}
118
+ {%- set content = namespace(val='') %}
119
+ {%- if message.content is string %}
120
+ {%- set content.val = message.content %}
121
+ {%- else %}
122
+ {%- if message.content is iterable %}
123
+ {%- for entry in message.content %}
124
+ {%- if entry.type== 'text' %}
125
+ {%- if content.val != '' %}
126
+ {%- set content.val = content.val + '\n' %}
127
+ {%- endif %}
128
+ {%- set content.val = content.val + entry.text %}
129
+ {%- endif %}
130
+ {%- endfor %}
131
+ {%- endif %}
132
+ {%- endif %}
133
+ {#- ALoRA Pass 2: inject activation token before invocation text in the target message -#}
134
+ {%- if loop.index0 == ns.alora_target_idx %}
135
+ {%- set _parts = content.val.rsplit(ns.adapter_invocation_text, 1) %}
136
+ {%- if _parts | length > 1 %}
137
+ {%- set content.val = _parts[0] + ns.adapter_token + ns.adapter_invocation_text + _parts[1] %}
138
+ {%- endif %}
139
+ {%- endif %}
140
+ {%- if (message.role == 'user') or (message.role == 'system' and not loop.first) %}
141
+ {{- '<|start_of_role|>' + message.role + '<|end_of_role|>' + content.val + '<|end_of_text|>\n' }}
142
+ {%- elif message.role == 'assistant' %}
143
+ {{- '<|start_of_role|>' + message.role + '<|end_of_role|>' + content.val }}
144
+ {%- if message.tool_calls %}
145
+ {%- for tool_call in message.tool_calls %}
146
+ {%- if (loop.first and content.val) or (not loop.first) %}
147
+ {{- '\n' }}
148
+ {%- endif %}
149
+ {%- if tool_call.function %}
150
+ {%- set tool_call = tool_call.function %}
151
+ {%- endif %}
152
+ {{- '<tool_call>\n{"name": "' }}
153
+ {{- tool_call.name }}
154
+ {{- '", "arguments": ' }}
155
+ {%- if tool_call.arguments is string %}
156
+ {{- tool_call.arguments }}
157
+ {%- else %}
158
+ {{- tool_call.arguments | tojson }}
159
+ {%- endif %}
160
+ {{- '}\n</tool_call>' }}
161
+ {%- endfor %}
162
+ {%- endif %}
163
+ {{- '<|end_of_text|>\n' }}
164
+ {%- elif message.role == 'tool' %}
165
+ {%- if loop.first or (messages[loop.index0 - 1].role != 'tool') %}
166
+ {{- '<|start_of_role|>user<|end_of_role|>' }}
167
+ {%- endif %}
168
+ {{- '\n<tool_response>\n' }}
169
+ {{- content.val }}
170
+ {{- '\n</tool_response>' }}
171
+ {%- if loop.last or (messages[loop.index0 + 1].role != 'tool') %}
172
+ {{- '<|end_of_text|>\n' }}
173
+ {%- endif %}
174
+ {%- endif %}
175
+ {%- endfor %}
176
+ {#- ALoRA fallback: insert activation token right before generation prompt.
177
+ Only fires when Pass 1 found no user message with the invocation text
178
+ (alora_target_idx == -1), meaning the adapter activates at the assistant
179
+ role token boundary rather than inside a user message. -#}
180
+ {%- if ns.adapter_token and ns.adapter_type == 'alora' and ns.alora_target_idx == -1 %}
181
+ {{- ns.adapter_token }}
182
+ {%- endif %}
183
+ {%- if add_generation_prompt %}
184
+ {{- '<|start_of_role|>assistant<|end_of_role|>' }}
185
+ {%- endif %}
compose_report.json ADDED
The diff for this file is too large to render. See raw diff
 
config.json ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "adapter_names": [
3
+ "citations",
4
+ "query_rewrite",
5
+ "query_clarification",
6
+ "context_relevance",
7
+ "hallucination_detection",
8
+ "answerability",
9
+ "uncertainty",
10
+ "requirement-check",
11
+ "context-attribution",
12
+ "factuality-detection",
13
+ "policy-guardrails",
14
+ "factuality-correction",
15
+ "guardian-core"
16
+ ],
17
+ "adapter_ranks": [
18
+ 16,
19
+ 32,
20
+ 32,
21
+ 16,
22
+ 16,
23
+ 16,
24
+ 32,
25
+ 64,
26
+ 16,
27
+ 32,
28
+ 16,
29
+ 32,
30
+ 32
31
+ ],
32
+ "adapter_third_party": [
33
+ "citations",
34
+ "query_rewrite",
35
+ "query_clarification",
36
+ "context_relevance",
37
+ "hallucination_detection",
38
+ "answerability",
39
+ "uncertainty",
40
+ "requirement-check",
41
+ "context-attribution",
42
+ "factuality-detection",
43
+ "policy-guardrails",
44
+ "factuality-correction",
45
+ "guardian-core"
46
+ ],
47
+ "adapter_token_ids": [
48
+ 100352,
49
+ 100353,
50
+ 100354,
51
+ 100355,
52
+ 100356,
53
+ 100357,
54
+ 100358,
55
+ 100359,
56
+ 100360,
57
+ 100361,
58
+ 100362,
59
+ 100363,
60
+ 100364
61
+ ],
62
+ "architectures": [
63
+ "GraniteSwitchForCausalLM"
64
+ ],
65
+ "attention_bias": false,
66
+ "attention_dropout": 0.0,
67
+ "attention_multiplier": 0.015625,
68
+ "bos_token_id": 100257,
69
+ "control_dims": 32,
70
+ "control_token_gain": 15.0,
71
+ "dtype": "bfloat16",
72
+ "embedding_multiplier": 12.0,
73
+ "eos_token_id": 100257,
74
+ "fused_add_norm": false,
75
+ "hidden_act": "silu",
76
+ "hidden_size": 2560,
77
+ "hiding_groups": {
78
+ "all_controls": [
79
+ "citations",
80
+ "query_rewrite",
81
+ "query_clarification",
82
+ "context_relevance",
83
+ "hallucination_detection",
84
+ "answerability",
85
+ "uncertainty",
86
+ "requirement-check",
87
+ "context-attribution",
88
+ "factuality-detection",
89
+ "policy-guardrails",
90
+ "factuality-correction",
91
+ "guardian-core"
92
+ ]
93
+ },
94
+ "hiding_policy": {
95
+ "answerability": [
96
+ "all_controls"
97
+ ],
98
+ "base": [
99
+ "all_controls"
100
+ ],
101
+ "citations": [
102
+ "all_controls"
103
+ ],
104
+ "context-attribution": [
105
+ "all_controls"
106
+ ],
107
+ "context_relevance": [
108
+ "all_controls"
109
+ ],
110
+ "factuality-correction": [
111
+ "all_controls"
112
+ ],
113
+ "factuality-detection": [
114
+ "all_controls"
115
+ ],
116
+ "guardian-core": [
117
+ "all_controls"
118
+ ],
119
+ "hallucination_detection": [
120
+ "all_controls"
121
+ ],
122
+ "policy-guardrails": [
123
+ "all_controls"
124
+ ],
125
+ "query_clarification": [
126
+ "all_controls"
127
+ ],
128
+ "query_rewrite": [
129
+ "all_controls"
130
+ ],
131
+ "requirement-check": [
132
+ "all_controls"
133
+ ],
134
+ "uncertainty": [
135
+ "all_controls"
136
+ ]
137
+ },
138
+ "initializer_range": 0.1,
139
+ "intermediate_size": 8192,
140
+ "layer_types": [
141
+ "attention",
142
+ "attention",
143
+ "attention",
144
+ "attention",
145
+ "attention",
146
+ "attention",
147
+ "attention",
148
+ "attention",
149
+ "attention",
150
+ "attention",
151
+ "attention",
152
+ "attention",
153
+ "attention",
154
+ "attention",
155
+ "attention",
156
+ "attention",
157
+ "attention",
158
+ "attention",
159
+ "attention",
160
+ "attention",
161
+ "attention",
162
+ "attention",
163
+ "attention",
164
+ "attention",
165
+ "attention",
166
+ "attention",
167
+ "attention",
168
+ "attention",
169
+ "attention",
170
+ "attention",
171
+ "attention",
172
+ "attention",
173
+ "attention",
174
+ "attention",
175
+ "attention",
176
+ "attention",
177
+ "attention",
178
+ "attention",
179
+ "attention",
180
+ "attention",
181
+ "attention"
182
+ ],
183
+ "logits_scaling": 10.0,
184
+ "lora_target_modules": [
185
+ "o_proj",
186
+ "qkv_proj",
187
+ "shared_input_linear",
188
+ "shared_output_linear"
189
+ ],
190
+ "mamba_chunk_size": 256,
191
+ "mamba_conv_bias": true,
192
+ "mamba_d_conv": 4,
193
+ "mamba_d_head": 40,
194
+ "mamba_d_state": 256,
195
+ "mamba_expand": 2,
196
+ "mamba_n_groups": 1,
197
+ "mamba_n_heads": 128,
198
+ "mamba_proj_bias": false,
199
+ "max_lora_rank": 64,
200
+ "max_position_embeddings": 131072,
201
+ "model_type": "granite_switch",
202
+ "num_adapters": 13,
203
+ "num_attention_heads": 40,
204
+ "num_experts_per_tok": 2,
205
+ "num_hidden_layers": 41,
206
+ "num_key_value_heads": 8,
207
+ "num_local_experts": 0,
208
+ "output_router_logits": false,
209
+ "pad_token_id": 100256,
210
+ "position_embedding_type": "rope",
211
+ "projection_head_dim": 64,
212
+ "residual_multiplier": 0.22,
213
+ "rms_norm_eps": 1e-05,
214
+ "rope_parameters": {
215
+ "rope_theta": 10000000,
216
+ "rope_type": "default"
217
+ },
218
+ "router_aux_loss_coef": 0.001,
219
+ "shared_intermediate_size": 8192,
220
+ "switch_head_dim": 32,
221
+ "tie_word_embeddings": true,
222
+ "time_step_limit": [
223
+ 0.0,
224
+ {
225
+ "__float__": "Infinity"
226
+ }
227
+ ],
228
+ "time_step_max": 0.1,
229
+ "time_step_min": 0.001,
230
+ "transformers_version": "5.6.2",
231
+ "use_cache": true,
232
+ "vocab_size": 100365
233
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 100257,
4
+ "eos_token_id": 100257,
5
+ "output_attentions": false,
6
+ "output_hidden_states": false,
7
+ "pad_token_id": 100256,
8
+ "transformers_version": "5.6.2",
9
+ "use_cache": true
10
+ }
io_configs/answerability/io.yaml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: answerability
2
+ # Model name string, or null to use whatever is provided in the chat completion request.
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "type": "string",
8
+ "enum": ["answerable", "unanswerable"]
9
+ }
10
+ transformations:
11
+ # Convert scalar value to a record for consistency with other intrinsics
12
+ - type: nest
13
+ input_path: []
14
+ field_name: "answerability"
15
+ instruction: ~
16
+ parameters:
17
+ temperature: 0.0
18
+ # "unanswerable" can be 6 tokens at high temperatures
19
+ max_completion_tokens: 6
20
+ # No sentence boundary detection
21
+ sentence_boundaries: ~
io_configs/citations/io.yaml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: citations
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "$defs": {
8
+ "_MODEL_OUTPUT_ENTRY": {
9
+ "properties": {
10
+ "r": {
11
+ "minimum": 0,
12
+ "title": "R",
13
+ "type": "integer"
14
+ },
15
+ "c": {
16
+ "items": {
17
+ "minimum": 0,
18
+ "type": "integer"
19
+ },
20
+ "title": "C",
21
+ "type": "array"
22
+ }
23
+ },
24
+ "required": [
25
+ "r",
26
+ "c"
27
+ ],
28
+ "title": "_MODEL_OUTPUT_ENTRY",
29
+ "type": "object"
30
+ }
31
+ },
32
+ "items": {
33
+ "$ref": "#/$defs/_MODEL_OUTPUT_ENTRY"
34
+ },
35
+ "title": "_MODEL_OUTPUT",
36
+ "type": "array"
37
+ }
38
+ transformations:
39
+ # Explode the list of document sentences in each citation
40
+ - type: explode
41
+ input_path: [] # Zero-length path means match root element
42
+ target_field: "c"
43
+ # Model may repeat itself; drop the resulting duplicates.
44
+ - type: drop_duplicates
45
+ input_path: [] # Zero-length path means match root element
46
+ target_fields: ["r", "c"]
47
+ # Replace sentence number with sentence location and contents.
48
+ # Do this first for sentences from the last turn, then for sentences from documents.
49
+ - type: decode_sentences
50
+ source: "last_message"
51
+ input_path: [~, "r"] # Null in path means wildcard
52
+ # New fields to add for each sentence
53
+ output_names:
54
+ begin: "response_begin"
55
+ end: "response_end"
56
+ text: "response_text"
57
+ - type: decode_sentences
58
+ source: "documents"
59
+ input_path: [~, "c"] # Null in path means wildcard
60
+ # New fields to add for each sentence
61
+ output_names:
62
+ document_id: "citation_doc_id"
63
+ begin: "citation_begin"
64
+ end: "citation_end"
65
+ text: "citation_text"
66
+ # Remove fields that we no longer need
67
+ - type: project
68
+ input_path: []
69
+ retained_fields:
70
+ - "response_begin"
71
+ - "response_end"
72
+ - "response_text"
73
+ - "citation_doc_id"
74
+ - "citation_begin"
75
+ - "citation_end"
76
+ - "citation_text"
77
+ # Merge adjacent document spans
78
+ - type: merge_spans
79
+ input_path: []
80
+ group_fields: ["response_begin", "response_end", "response_text", "citation_doc_id"]
81
+ begin_field: "citation_begin"
82
+ end_field: "citation_end"
83
+ text_field: "citation_text"
84
+
85
+ instruction: >
86
+ Split the last assistant response into individual sentences.
87
+ For each sentence in the response, identify the statement IDs from the below
88
+ documents that it references. Ensure that your output includes all response
89
+ sentence IDs, and for each response sentence ID, provide the list of corresponding
90
+ referring document sentence IDs. The output must be a json structure.
91
+ parameters:
92
+ temperature: 0.0
93
+ max_completion_tokens: 4096
94
+ sentence_boundaries:
95
+ # Mapping from string location to sentence delimiter prefix
96
+ last_message: "r" # <r0>, <r1>, etc.
97
+ documents: "c"
98
+
io_configs/context-attribution/io.yaml ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: context-attribution
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "$defs": {
8
+ "_MODEL_OUTPUT_ENTRY": {
9
+ "properties": {
10
+ "r": {
11
+ "minimum": 0,
12
+ "title": "R",
13
+ "type": "integer"
14
+ },
15
+ "c": {
16
+ "items": {
17
+ "minimum": 0,
18
+ "type": "integer"
19
+ },
20
+ "title": "C",
21
+ "type": "array"
22
+ }
23
+ },
24
+ "required": [
25
+ "r",
26
+ "c"
27
+ ],
28
+ "title": "_MODEL_OUTPUT_ENTRY",
29
+ "type": "object"
30
+ }
31
+ },
32
+ "items": {
33
+ "$ref": "#/$defs/_MODEL_OUTPUT_ENTRY"
34
+ },
35
+ "title": "_MODEL_OUTPUT",
36
+ "type": "array"
37
+ }
38
+ transformations:
39
+ # Explode lists of context sentence indices
40
+ - type: explode
41
+ input_path: [] # Zero-length path means match root element
42
+ target_field: "c"
43
+ # Model may repeat itself; drop the resulting duplicates.
44
+ - type: drop_duplicates
45
+ input_path: [] # Zero-length path means match root element
46
+ target_fields: ["r", "c"]
47
+ # Replace sentence number with sentence location and contents.
48
+ # Do this first for sentences from the last turn, then for sentences from context.
49
+ - type: decode_sentences
50
+ source: "last_message"
51
+ input_path: [~, "r"] # Null in path means wildcard
52
+ # New fields to add for each sentence
53
+ output_names:
54
+ begin: "response_begin"
55
+ end: "response_end"
56
+ text: "response_text"
57
+ - type: decode_sentences
58
+ source:
59
+ - "documents"
60
+ - "all_but_last_message"
61
+ input_path: [~, "c"] # Null in path means wildcard
62
+ # New fields to add for each sentence
63
+ output_names:
64
+ document_id: "attribution_doc_id"
65
+ message_index: "attribution_msg_index"
66
+ begin: "attribution_begin"
67
+ end: "attribution_end"
68
+ text: "attribution_text"
69
+ # Remove fields that we no longer need
70
+ - type: project
71
+ input_path: []
72
+ retained_fields:
73
+ - "response_begin"
74
+ - "response_end"
75
+ - "response_text"
76
+ - "attribution_doc_id"
77
+ - "attribution_msg_index"
78
+ - "attribution_begin"
79
+ - "attribution_end"
80
+ - "attribution_text"
81
+
82
+ instruction: >
83
+ You provided the last assistant response above based on context, which may include documents and/or previous conversation turns.
84
+ Your response is divided into sentences, numbered in the format <r0> sentence 0 <r1> sentence 1 ...
85
+ Sentences in the context are also numbered: <c0> sentence 0 <c1> sentence 1 ...
86
+ For each response sentence, please list the context sentences that were most important for you to generate the response sentence.
87
+ Provide your answer in JSON format, as an array of JSON objects, where each object has two members:
88
+ "r" with the response sentence number as the value, and "c" with an array of context sentence numbers as the value.
89
+ An example of such an array of objects is [{{"r": 0, "c": [3, 1, 4]}}, {{"r": 1, "c": [1, 5]}}].
90
+ List the context sentences in order from most important to least important.
91
+ Ensure that you include an object for each response sentence, even if the corresponding array of context sentence numbers is empty.
92
+ Answer with only the JSON and do not explain.
93
+ parameters:
94
+ max_completion_tokens: 4096
95
+ temperature: 0.0
96
+ sentence_boundaries:
97
+ # Mapping from string location to sentence delimiter prefix
98
+ last_message: "r" # <r0>, <r1>, etc.
99
+ documents: "c"
100
+ all_but_last_message: "c"
io_configs/context_relevance/io.yaml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: context_relevance
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "title": "ContextRelevanceOutput",
8
+ "type": "object",
9
+ "properties": {
10
+ "context_relevance": {
11
+ "type": "string",
12
+ "description": "Context relevancy judgment.",
13
+ "enum": ["relevant", "irrelevant", "partially relevant"]
14
+ }
15
+ },
16
+ "required": ["context_relevance"]
17
+ }
18
+ # Additional turn of instructions to add to the chat
19
+ instruction: |
20
+ DOCUMENT: {document_content}
21
+ # Data transformations to perform during post-processing
22
+ transformations: ~
23
+ parameters:
24
+ temperature: 0.0
25
+ sentence_boundaries: ~
io_configs/factuality-correction/io.yaml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Model name string, or null to use whatever is provided in the chat completion request.
2
+ name: factuality-correction
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "title": "Factuality Correction Intrinsic",
8
+ "type": "object",
9
+ "properties": {
10
+ "correction": {
11
+ "type": "string"
12
+ }
13
+ },
14
+ "required": ["correction"]
15
+ }
16
+ transformations: ~
17
+ instruction: ~
18
+ parameters:
19
+ # corrected response can several hundred tokens at high temperatures
20
+ max_completion_tokens: 4096
21
+ temperature: 0.0
22
+ # No sentence boundary detection
23
+ sentence_boundaries: ~
io_configs/factuality-detection/io.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Model name string, or null to use whatever is provided in the chat completion request.
2
+ name: factuality-detection
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "title": "Factuality Detection Intrinsic",
8
+ "type": "object",
9
+ "properties": {
10
+ "score": {
11
+ "type": "string",
12
+ "enum": ["yes", "no"]
13
+ }
14
+ },
15
+ "required": ["score"],
16
+ "additionalProperties": false
17
+ }
18
+ transformations: ~
19
+ instruction: ~
20
+ parameters:
21
+ max_completion_tokens: 20
22
+ temperature: 0.0
23
+ # No sentence boundary detection
24
+ sentence_boundaries: ~
io_configs/guardian-core/io.yaml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: guardian-core
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "type": "object",
8
+ "properties": {
9
+ "score": {
10
+ "type": "string",
11
+ "enum": ["yes", "no"]
12
+ }
13
+ },
14
+ "required": ["score"],
15
+ "additionalProperties": false
16
+ }
17
+ # Output transformation rules to apply
18
+ transformations:
19
+ - type: likelihood
20
+ categories_to_values:
21
+ "yes": 1.0
22
+ "no": 0.0
23
+ input_path: ["score"]
24
+ # Convert scalar value to a record for consistency with other intrinsics
25
+ - type: nest
26
+ input_path: []
27
+ field_name: "guardian"
28
+ instruction: ~
29
+ parameters:
30
+ max_completion_tokens: 15
31
+ temperature: 0.0
32
+ sentence_boundaries: ~
io_configs/hallucination_detection/io.yaml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: hallucination_detection
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "$defs": {
8
+ "HallucinationOutputEntry": {
9
+ "properties": {
10
+ "r": {
11
+ "minimum": 0,
12
+ "title": "Sentence Num",
13
+ "type": "integer"
14
+ },
15
+ "f": {
16
+ "title": "Is Faithful",
17
+ "type": "string",
18
+ "enum": ["faithful", "partial", "unfaithful", "NA"]
19
+ },
20
+ "e": {
21
+ "title": "Reasoning",
22
+ "type": "string"
23
+ }
24
+ },
25
+ "required": [
26
+ "r",
27
+ "e",
28
+ "f"
29
+ ],
30
+ "title": "HallucinationOutputEntry",
31
+ "type": "object"
32
+ }
33
+ },
34
+ "items": {
35
+ "$ref": "#/$defs/HallucinationOutputEntry"
36
+ },
37
+ "title": "HallucinationOutput",
38
+ "type": "array"
39
+ }
40
+ transformations:
41
+ # Replace sentence number with sentence location and contents
42
+ - type: decode_sentences
43
+ source: "last_message"
44
+ input_path: [~, "r"] # Null in path means wildcard
45
+ # New fields to add for each sentence
46
+ output_names:
47
+ begin: "response_begin"
48
+ end: "response_end"
49
+ text: "response_text"
50
+ # Remove fields that we no longer need and rename some of the fields.
51
+ - type: project
52
+ input_path: []
53
+ retained_fields:
54
+ "response_begin": "response_begin"
55
+ "response_end": "response_end"
56
+ "response_text": "response_text"
57
+ "f": "faithfulness"
58
+ "e": "explanation"
59
+ instruction: >
60
+ Split the last assistant response into individual sentences.
61
+ For each sentence in the last assistant response, identify the faithfulness
62
+ by comparing with the provided documents and generate the faithfulness reasoning
63
+ and faithfulness decision.
64
+ Ensure that your output includes all response sentence IDs,
65
+ and for each response sentence ID, provide the corresponding faithfulness
66
+ reasoning and faithfulness decision.
67
+ The output must be a json structure.
68
+ parameters:
69
+ # Current LoRA can be quite verbose in its explanations.
70
+ max_completion_tokens: 4096
71
+ temperature: 0.0
72
+ sentence_boundaries:
73
+ last_message: "i"
io_configs/policy-guardrails/io.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: policy-guardrails
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "title": "Policy Guardrails Intrinsic",
8
+ "type": "object",
9
+ "properties": {
10
+ "score": {
11
+ "type": "string",
12
+ "enum": ["Yes", "No","Ambiguous"]
13
+ }
14
+ },
15
+ "required": ["score"],
16
+ "additionalProperties": false
17
+ }
18
+ transformations: ~
19
+ instruction: ~
20
+ parameters:
21
+ temperature: 0.0
22
+ max_completion_tokens: 20
23
+ # No sentence boundary detection
24
+ sentence_boundaries: ~
io_configs/query_clarification/io.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: query_clarification
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "properties": {
8
+ "clarification": {
9
+ "title": "clarification",
10
+ "type": "string"
11
+ }
12
+ },
13
+ "required": [
14
+ "clarification"
15
+ ],
16
+ "title": "QueryClarificationOutput",
17
+ "type": "object"
18
+ }
19
+ transformations: ~
20
+ instruction: ~
21
+ parameters:
22
+ max_completion_tokens: 1024
23
+ temperature: 0.0
24
+ sentence_boundaries: false
io_configs/query_rewrite/io.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: query_rewrite
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "properties": {
8
+ "rewritten_question": {
9
+ "title": "Rewritten Question",
10
+ "type": "string"
11
+ }
12
+ },
13
+ "required": [
14
+ "rewritten_question"
15
+ ],
16
+ "title": "QueryRewriteOutput",
17
+ "type": "object"
18
+ }
19
+ transformations: ~
20
+ instruction: ~
21
+ parameters:
22
+ max_completion_tokens: 1024
23
+ temperature: 0.0
24
+ sentence_boundaries: false
io_configs/requirement-check/io.yaml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: requirement-check
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "type": "object",
8
+ "properties": {
9
+ "score": {
10
+ "type": "string",
11
+ "enum": ["yes", "no"]
12
+ }
13
+ },
14
+ "required": ["score"],
15
+ "additionalProperties": false
16
+ }
17
+ # Output transformation rules to apply
18
+ transformations:
19
+ - type: likelihood
20
+ categories_to_values:
21
+ "yes": 1.0
22
+ "no": 0.0
23
+ input_path: ["score"]
24
+ # Convert scalar value to a record for consistency with other intrinsics
25
+ - type: nest
26
+ input_path: []
27
+ field_name: "requirement_check"
28
+ instruction: ~
29
+ parameters:
30
+ max_completion_tokens: 15
31
+ temperature: 0.0
32
+ sentence_boundaries: ~
io_configs/uncertainty/io.yaml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: uncertainty
2
+ # Model name string, or null to use whatever is provided in the chat completion request
3
+ model: ~
4
+ # JSON schema of the model's output
5
+ response_format: |
6
+ {
7
+ "type": "object",
8
+ "properties": {
9
+ "score": {
10
+ "type": "string",
11
+ "enum": ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
12
+ }
13
+ },
14
+ "required": ["score"],
15
+ "additionalProperties": false
16
+ }
17
+ # Output transformation rules to apply
18
+ transformations:
19
+ - type: likelihood
20
+ categories_to_values:
21
+ # Each 1-digit output maps to 0.1 * <output> + 0.05
22
+ "0": 0.05
23
+ "1": 0.15
24
+ "2": 0.25
25
+ "3": 0.35
26
+ "4": 0.45
27
+ "5": 0.55
28
+ "6": 0.65
29
+ "7": 0.75
30
+ "8": 0.85
31
+ "9": 0.95
32
+ input_path: ["score"]
33
+ # Convert scalar value to a record for consistency with other intrinsics
34
+ - type: project
35
+ input_path: []
36
+ retained_fields:
37
+ score: "certainty"
38
+ instruction: ~
39
+ parameters:
40
+ max_completion_tokens: 15
41
+ temperature: 0.0
42
+ sentence_boundaries: ~
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a3f64677efd51cba02b9f473401798d7286517f4d1c20b400a18fb5df39f054e
3
+ size 10043422843
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|end_of_text|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|end_of_text|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|pad|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<|unk|>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|end_of_text|>",
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|end_of_text|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|citations|>",
10
+ "<|query_rewrite|>",
11
+ "<|query_clarification|>",
12
+ "<|context_relevance|>",
13
+ "<|hallucination_detection|>",
14
+ "<|answerability|>",
15
+ "<|uncertainty|>",
16
+ "<|requirement-check|>",
17
+ "<|context-attribution|>",
18
+ "<|factuality-detection|>",
19
+ "<|policy-guardrails|>",
20
+ "<|factuality-correction|>",
21
+ "<|guardian-core|>"
22
+ ],
23
+ "is_local": true,
24
+ "local_files_only": false,
25
+ "model_max_length": 1000000000000000019884624838656,
26
+ "pad_token": "<|pad|>",
27
+ "padding_side": "left",
28
+ "tokenizer_class": "GPT2Tokenizer",
29
+ "unk_token": "<|unk|>"
30
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff