Update README.md
Browse files
README.md
CHANGED
@@ -6,7 +6,7 @@ pipeline_tag: text-generation
|
|
6 |
library_name: transformers
|
7 |
---
|
8 |
|
9 |
-
# Granite 3.0 8B Instruct - Intrinsics LoRA
|
10 |
|
11 |
Welcome to Granite Experiments!
|
12 |
|
@@ -15,7 +15,7 @@ Think of Experiments as a preview of what's to come. These projects are still un
|
|
15 |
|
16 |
## Model Summary
|
17 |
|
18 |
-
**Granite Intrinsics 3.0 8b Instruct
|
19 |
providing access to the Uncertainty, Hallucination Detection, and Safety Exception intrinsics in addition to retaining the full abilities of the [ibm-granite/granite-3.0-8b-instruct](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct) model.
|
20 |
|
21 |
- **Developer:** IBM Research
|
@@ -48,7 +48,7 @@ The Safety Exception intrinsic was designed as a binary classifier that analyses
|
|
48 |
|
49 |
This is an experimental LoRA testing new functionality being developed for IBM's Granite LLM family. We are welcoming the community to test it out and give us feedback, but we are NOT recommending this model be used for real deployments at this time. Stay tuned for more updates on the Granite roadmap.
|
50 |
|
51 |
-
**Granite Intrinsics 3.0 8b
|
52 |
with the added ability to generate the three specified intrinsics.
|
53 |
|
54 |
|
@@ -88,7 +88,58 @@ we can evaluate the certainty and hallucination status of this reply by invoking
|
|
88 |
|
89 |
|
90 |
### Intrinsics Example with PDL
|
91 |
-
Given a hosted instance of **Granite Intrinsics 3.0 8b Instruct
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
```python
|
93 |
defs:
|
94 |
apply_template:
|
@@ -107,15 +158,14 @@ defs:
|
|
107 |
with: "\n"
|
108 |
get_intrinsic:
|
109 |
function:
|
110 |
-
context: [{role: str, content: str}]
|
111 |
intrinsic: str
|
112 |
return:
|
113 |
lastOf:
|
114 |
- call: apply_template
|
115 |
def: mycontext
|
116 |
args:
|
117 |
-
context: ${
|
118 |
-
- model: granite-8b-
|
119 |
parameters:
|
120 |
api_key: EMPTY
|
121 |
api_base: API_BASE
|
@@ -126,66 +176,127 @@ defs:
|
|
126 |
|
|
127 |
${ mycontext }
|
128 |
<|start_of_role|>${ intrinsic }<|end_of_role|>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
|
132 |
-
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
|
137 |
-
Disability housing grants for Veterans
|
138 |
-
We offer housing grants for Veterans and service members with certain service - connected disabilities so they can buy or change a home to meet their needs and live more independently. Changing a home might involve installing ramps or widening doorways. Find out if you re eligible for a disability housing grant and how to apply.
|
139 |
|
140 |
-
|
141 |
-
You may be able to get an SAH grant if you re using the grant money to buy, build, or change your permanent home a home you plan to live in for a long time and you meet both of the requirements listed below. Both of these must be true. You: Own or will own the home , and Have a qualifying service - connected disability Qualifying service - connected disabilities include : The loss or loss of use of more than one limb The loss or loss of use of a lower leg along with the residuals lasting effects of an organic natural disease or injury Blindness in both eyes having only light perception along with the loss or loss of use of a leg Certain severe burns The loss or loss of use of one or both lower extremities feet or legs after September 11 , 2001, that makes it so you can t balance or walk without the help of braces, crutches, canes, or a wheelchair Note : Only 30 Veterans and service members each fiscal year FY can qualify for a grant based on the loss of extremities after September 11 , 2001. If you qualify for but don t receive a grant in 2019 because the cap was reached , you may be able to use this benefit in FY 2020 or future years if the law continues to give us the authority to offer these grants and we don t go beyond the new FY cap. For FY 2019 , you may be able to get up to 3 grants for a total of up to $85,645 through the SAH grant program. Learn more about how to apply for a housing grant
|
142 |
|
143 |
-
|
144 |
-
|
145 |
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
|
|
149 |
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
contribute: []
|
159 |
-
args:
|
160 |
-
context: ${ pdl_context }
|
161 |
-
intrinsic: safety
|
162 |
-
- role: system
|
163 |
-
text: ${ system_prompt }
|
164 |
-
- if: ${ safety != "Y" }
|
165 |
-
then:
|
166 |
-
text:
|
167 |
-
- "\n\nDocuments: ${ document }\n\n ${ query }"
|
168 |
-
- model: openai/granite-8b-intrinsics-v1
|
169 |
-
def: answer
|
170 |
-
parameters: {api_key: EMPTY, api_base: API_BASE, temperature: 0, stop: "\n"}
|
171 |
-
- call: get_intrinsic
|
172 |
-
def: certainty
|
173 |
-
contribute: []
|
174 |
-
args:
|
175 |
-
context: ${ pdl_context }
|
176 |
-
intrinsic: certainty
|
177 |
-
- call: get_intrinsic
|
178 |
-
def: hallucination
|
179 |
-
contribute: []
|
180 |
-
args:
|
181 |
-
context: ${ pdl_context }
|
182 |
-
intrinsic: hallucination
|
183 |
-
- "\nCertainty: ${ certainty }"
|
184 |
-
- "\nHallucination: ${ hallucination }"
|
185 |
-
```
|
186 |
-
### Intrinsics Example with SGLang
|
187 |
-
The below SGLang implementation uses the SGLang fork at [https://github.com/frreiss/sglang/tree/granite](https://github.com/frreiss/sglang/tree/granite) that supports Granite models.
|
188 |
|
|
|
|
|
|
|
189 |
|
190 |
|
191 |
#### Notes
|
@@ -204,20 +315,20 @@ red-teamed examples.
|
|
204 |
## Evaluation
|
205 |
We evaluate the performance of the intrinsics themselves and the RAG performance of the model.
|
206 |
|
207 |
-
We first find that the performance of the intrinsics in our shared model **Granite Instrinsics 3.0 8b
|
208 |
versus the baseline procedure of maintaining 3 separate instrinsic models. Here, percent error is shown for the Hallucination Detection and Safety Exception intrinsics as they have
|
209 |
binary output, and Mean Absolute Error (MAE) is shown for the Uncertainty Intrinsic as it outputs numbers 0 to 9. For all, lower is better. Performance is calculated on a randomly drawn 400 sample validation set from each intrinsic's dataset.
|
210 |
|
211 |
|
212 |
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6602ffd971410cf02bf42c06/NsvMpweFjmjIhWFaKtI-K.png)
|
213 |
|
214 |
-
We then find that RAG performance of **Granite Instrinsics 3.0 8b
|
215 |
|
216 |
|
217 |
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6602ffd971410cf02bf42c06/hyOlQmXPirlCYeILLBXhc.png)
|
218 |
|
219 |
## Training Details
|
220 |
-
The **Granite Instrinsics 3.0 8b
|
221 |
|
222 |
|
223 |
|
|
|
6 |
library_name: transformers
|
7 |
---
|
8 |
|
9 |
+
# Granite 3.0 8B Instruct - Intrinsics LoRA v0.1
|
10 |
|
11 |
Welcome to Granite Experiments!
|
12 |
|
|
|
15 |
|
16 |
## Model Summary
|
17 |
|
18 |
+
**Granite Intrinsics 3.0 8b Instruct v0.1** is a LoRA adapter for [ibm-granite/granite-3.0-8b-instruct](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct),
|
19 |
providing access to the Uncertainty, Hallucination Detection, and Safety Exception intrinsics in addition to retaining the full abilities of the [ibm-granite/granite-3.0-8b-instruct](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct) model.
|
20 |
|
21 |
- **Developer:** IBM Research
|
|
|
48 |
|
49 |
This is an experimental LoRA testing new functionality being developed for IBM's Granite LLM family. We are welcoming the community to test it out and give us feedback, but we are NOT recommending this model be used for real deployments at this time. Stay tuned for more updates on the Granite roadmap.
|
50 |
|
51 |
+
**Granite Intrinsics 3.0 8b v0.1** is lightly tuned so that its behavior closely mimics that of [ibm-granite/granite-3.0-8b-instruct](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct),
|
52 |
with the added ability to generate the three specified intrinsics.
|
53 |
|
54 |
|
|
|
88 |
|
89 |
|
90 |
### Intrinsics Example with PDL
|
91 |
+
Given a hosted instance of **Granite Intrinsics 3.0 8b Instruct v0.1** at `API_BASE` (insert the host address here), this uses the [PDL language](https://github.com/IBM/prompt-declaration-language) to implement the RAG intrinsic invocation scenario described above.
|
92 |
+
|
93 |
+
First, create a file `intrinsics.pdl` with the following content.
|
94 |
+
```python
|
95 |
+
defs:
|
96 |
+
system_prompt: "You are an AI language model developed by IBM Research. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior."
|
97 |
+
|
98 |
+
rag_prompt: "Provide a short response to the user's question based on the information present in the documents. If the documents lack the necessary details, inform the user that the question cannot be answered."
|
99 |
+
|
100 |
+
document:
|
101 |
+
|
|
102 |
+
Disability housing grants for Veterans
|
103 |
+
We offer housing grants for Veterans and service members with certain service - connected disabilities so they can buy or change a home to meet their needs and live more independently. Changing a home might involve installing ramps or widening doorways. Find out if you re eligible for a disability housing grant and how to apply.
|
104 |
+
|
105 |
+
Can I get a Specially Adapted Housing (SAH) grant and how much funding does this grant offer?
|
106 |
+
You may be able to get an SAH grant if you re using the grant money to buy, build, or change your permanent home a home you plan to live in for a long time and you meet both of the requirements listed below. Both of these must be true. You: Own or will own the home , and Have a qualifying service - connected disability Qualifying service - connected disabilities include : The loss or loss of use of more than one limb The loss or loss of use of a lower leg along with the residuals lasting effects of an organic natural disease or injury Blindness in both eyes having only light perception along with the loss or loss of use of a leg Certain severe burns The loss or loss of use of one or both lower extremities feet or legs after September 11 , 2001, that makes it so you can t balance or walk without the help of braces, crutches, canes, or a wheelchair Note : Only 30 Veterans and service members each fiscal year FY can qualify for a grant based on the loss of extremities after September 11 , 2001. If you qualify for but don t receive a grant in 2019 because the cap was reached , you may be able to use this benefit in FY 2020 or future years if the law continues to give us the authority to offer these grants and we don t go beyond the new FY cap. For FY 2019 , you may be able to get up to 3 grants for a total of up to $85,645 through the SAH grant program. Learn more about how to apply for a housing grant
|
107 |
+
|
108 |
+
Can I get a Special Housing Adaptation (SHA) grant and how much funding does this grant offer?
|
109 |
+
You may be able to get an SHA grant if you re using the grant money to buy, build, or change your permanent home a home you plan to live in for a long time and you meet both of the requirements listed below. Both of these must be true : You or a family member own or will own the home , and You have a qualifying service - connected disability Qualifying service - connected disabilities include : Blindness in both eyes with 20/200 visual acuity or less The loss or loss of use of both hands Certain severe burns Certain respiratory or breathing injuries For FY 2019 , you may be able to get up to 3 grants for a total of up to $17,130 through the SHA grant program. Learn more about how to apply for a housing grant \n\nWhat if I need money to make changes to a family member s home that I m living in for a short period of time? \nYou may be able to get a Temporary Residence Adaptation TRA grant if you meet both of the requirements listed below. Both of these must be true. You: Qualify for an SAH or SHA grant see above , and Are living temporarily in a family member s home that needs changes to meet your needs If you qualify for an SAH grant , you can get up to $37,597 through the TRA grant program for FY 2019. If you qualify for an SHA grant , you can get up to $6,713 through the TRA grant program for FY 2019.
|
110 |
+
|
111 |
+
Apply for an SAH, SHA, or TRA grant
|
112 |
+
You can apply online right now by going to our eBenefits website. You ll need to sign in to eBenefits with your DS Logon basic or premium account. If you don t have a DS Logon account , you can register for one on the site. Go to eBenefits to apply.
|
113 |
+
|
114 |
+
|
115 |
+
query: How much funding does the SAH grant offer?
|
116 |
+
text:
|
117 |
+
- include: intrinsics-defs.pdl
|
118 |
+
- defs:
|
119 |
+
unsafe:
|
120 |
+
call: get_safety
|
121 |
+
args:
|
122 |
+
query: ${ query }
|
123 |
+
- role: system
|
124 |
+
text: ${ system_prompt }
|
125 |
+
contribute: [context]
|
126 |
+
- if: ${ unsafe == "N" }
|
127 |
+
then:
|
128 |
+
text:
|
129 |
+
- "\n\nDocuments: ${ document }\n\n ${ query }\n"
|
130 |
+
- model: openai/granite-8b-intrinsics-v2-20241203
|
131 |
+
def: answer
|
132 |
+
parameters: {api_key: EMPTY, api_base: API_BASE, temperature: 0, stop: "\n"}
|
133 |
+
- defs: ## Implicit fork of context
|
134 |
+
certainty:
|
135 |
+
call: get_certainty
|
136 |
+
hallucination:
|
137 |
+
call: get_hallucination
|
138 |
+
- "\nCertainty: ${ certainty }"
|
139 |
+
- "\nHallucination: ${ hallucination }"
|
140 |
+
```
|
141 |
+
Next, create a file `intrinsics-defs.pdl` with the following content.
|
142 |
+
|
143 |
```python
|
144 |
defs:
|
145 |
apply_template:
|
|
|
158 |
with: "\n"
|
159 |
get_intrinsic:
|
160 |
function:
|
|
|
161 |
intrinsic: str
|
162 |
return:
|
163 |
lastOf:
|
164 |
- call: apply_template
|
165 |
def: mycontext
|
166 |
args:
|
167 |
+
context: ${ pdl_context }
|
168 |
+
- model: granite-intrinsics-3.0-8b-instruct-v0.1
|
169 |
parameters:
|
170 |
api_key: EMPTY
|
171 |
api_base: API_BASE
|
|
|
176 |
|
|
177 |
${ mycontext }
|
178 |
<|start_of_role|>${ intrinsic }<|end_of_role|>
|
179 |
+
|
180 |
+
get_safety:
|
181 |
+
function:
|
182 |
+
query: str
|
183 |
+
return:
|
184 |
+
lastOf:
|
185 |
+
- ${ query }
|
186 |
+
- call: apply_template
|
187 |
+
def: mycontext
|
188 |
+
args:
|
189 |
+
context: ${ pdl_context }
|
190 |
+
- call: get_intrinsic
|
191 |
+
args:
|
192 |
+
intrinsic: safety
|
193 |
|
194 |
+
get_hallucination:
|
195 |
+
function:
|
196 |
+
return:
|
197 |
+
call: get_intrinsic
|
198 |
+
args:
|
199 |
+
intrinsic: hallucination
|
200 |
+
|
201 |
+
get_certainty:
|
202 |
+
function:
|
203 |
+
return:
|
204 |
+
call: get_intrinsic
|
205 |
+
args:
|
206 |
+
intrinsic: certainty
|
207 |
+
```
|
208 |
|
209 |
+
To run the example, in the command line run `pdl intrinsics.pdl` after installing the PDL CLI (`pip install prompt-declaration-language`).
|
210 |
|
211 |
+
### Intrinsics Example with SGLang
|
212 |
+
The below SGLang implementation uses the SGLang fork at [https://github.com/frreiss/sglang/tree/granite](https://github.com/frreiss/sglang/tree/granite) that supports Granite models.
|
|
|
|
|
|
|
213 |
|
214 |
+
```python
|
|
|
215 |
|
216 |
+
import sglang as sgl
|
217 |
+
from sglang.lang.chat_template import get_chat_template
|
218 |
|
219 |
+
@sgl.function
|
220 |
+
def safety_check (s, question):
|
221 |
+
s += sgl.user(question)
|
222 |
+
s += "<|start_of_role|>safety<|end_of_role|>" + sgl.gen("safety", temperature=0, max_tokens=1)
|
223 |
+
|
224 |
+
# print ("\n====== Safety check state =======\n")
|
225 |
+
# print (s)
|
226 |
+
# print ("\n")
|
227 |
+
|
228 |
+
|
229 |
+
# Input data
|
230 |
+
system_prompt = "You are an AI language model developed by IBM Research. You are a cautious assistant. You carefully follow instructions. You are helpful and harmless and you follow ethical guidelines and promote positive behavior."
|
231 |
+
|
232 |
+
rag_prompt = "Provide a short response to the user's question based on the information present in the documents. If the documents lack the necessary details, inform the user that the question cannot be answered."
|
233 |
+
|
234 |
+
document = """Disability housing grants for Veterans
|
235 |
+
We offer housing grants for Veterans and service members with certain service - connected disabilities so they can buy or change a home to meet their needs and live more independently. Changing a home might involve installing ramps or widening doorways. Find out if you re eligible for a disability housing grant and how to apply.
|
236 |
+
|
237 |
+
Can I get a Specially Adapted Housing (SAH) grant and how much funding does this grant offer?
|
238 |
+
You may be able to get an SAH grant if you re using the grant money to buy, build, or change your permanent home a home you plan to live in for a long time and you meet both of the requirements listed below. Both of these must be true. You: Own or will own the home , and Have a qualifying service - connected disability Qualifying service - connected disabilities include : The loss or loss of use of more than one limb The loss or loss of use of a lower leg along with the residuals lasting effects of an organic natural disease or injury Blindness in both eyes having only light perception along with the loss or loss of use of a leg Certain severe burns The loss or loss of use of one or both lower extremities feet or legs after September 11 , 2001, that makes it so you can t balance or walk without the help of braces, crutches, canes, or a wheelchair Note : Only 30 Veterans and service members each fiscal year FY can qualify for a grant based on the loss of extremities after September 11 , 2001. If you qualify for but don t receive a grant in 2019 because the cap was reached , you may be able to use this benefit in FY 2020 or future years if the law continues to give us the authority to offer these grants and we don t go beyond the new FY cap. For FY 2019 , you may be able to get up to 3 grants for a total of up to $85,645 through the SAH grant program. Learn more about how to apply for a housing grant
|
239 |
+
|
240 |
+
Can I get a Special Housing Adaptation (SHA) grant and how much funding does this grant offer?
|
241 |
+
You may be able to get an SHA grant if you re using the grant money to buy, build, or change your permanent home a home you plan to live in for a long time and you meet both of the requirements listed below. Both of these must be true : You or a family member own or will own the home , and You have a qualifying service - connected disability Qualifying service - connected disabilities include : Blindness in both eyes with 20/200 visual acuity or less The loss or loss of use of both hands Certain severe burns Certain respiratory or breathing injuries For FY 2019 , you may be able to get up to 3 grants for a total of up to $17,130 through the SHA grant program. Learn more about how to apply for a housing grant \n\nWhat if I need money to make changes to a family member s home that I m living in for a short period of time? \nYou may be able to get a Temporary Residence Adaptation TRA grant if you meet both of the requirements listed below. Both of these must be true. You: Qualify for an SAH or SHA grant see above , and Are living temporarily in a family member s home that needs changes to meet your needs If you qualify for an SAH grant , you can get up to $37,597 through the TRA grant program for FY 2019. If you qualify for an SHA grant , you can get up to $6,713 through the TRA grant program for FY 2019.
|
242 |
+
|
243 |
+
Apply for an SAH, SHA, or TRA grant
|
244 |
+
You can apply online right now by going to our eBenefits website. You ll need to sign in to eBenefits with your DS Logon basic or premium account. If you don t have a DS Logon account , you can register for one on the site. Go to eBenefits to apply.
|
245 |
+
"""
|
246 |
+
|
247 |
+
query = "How much funding does the SAH grant offer?"
|
248 |
+
|
249 |
+
|
250 |
+
# The following function processes a chat between a user and an assistant.
|
251 |
+
# For simplicity, this assumes a fixed document, but in a true RAG setting, the
|
252 |
+
# documents will be retrieved dynamically based on the user turns.
|
253 |
+
@sgl.function
|
254 |
+
def main_chat_flow (s, doc, query):
|
255 |
+
s += sgl.system (system_prompt)
|
256 |
+
|
257 |
+
# Safety check on query
|
258 |
+
state = safety_check (question=query)
|
259 |
+
print (f"Safety Output: {state["safety"]} for question: {query}\n")
|
260 |
+
|
261 |
+
# RAG answer generation
|
262 |
+
s += sgl.user(rag_prompt + "\n\nDocuments: " + doc + "\n\n" + query)
|
263 |
+
s += sgl.assistant (sgl.gen ("answer", stop="\n", temperature=0, max_tokens=200))
|
264 |
+
answer = s["answer"]
|
265 |
+
print (f"Assistant: {answer}\n")
|
266 |
+
|
267 |
+
# Hallucination check in parallel with uncertainty quantification for the generated answer
|
268 |
+
forks = s.fork(2)
|
269 |
+
for i, f in enumerate(forks):
|
270 |
+
if (i == 0):
|
271 |
+
f += "<|start_of_role|>hallucination<|end_of_role|>"
|
272 |
+
f += sgl.gen("hallucination", temperature=0, max_tokens=1)
|
273 |
+
# print ("\n====== Fork 0 state =======\n")
|
274 |
+
# print (f)
|
275 |
+
# print ("\n")
|
276 |
+
else:
|
277 |
+
f += "<|start_of_role|>certainty<|end_of_role|>"
|
278 |
+
f += sgl.gen("certainty", temperature=0, max_tokens=1)
|
279 |
+
# print ("\n====== Fork 1 state =======\n")
|
280 |
+
# print (f)
|
281 |
+
# print ("\n")
|
282 |
+
|
283 |
+
print (f"Hallucination Output: {forks [0]["hallucination"]} for answer: {answer}\n")
|
284 |
+
print (f"Certainty Output: {forks [1]["certainty"]} for answer: {answer}\n")
|
285 |
|
286 |
+
|
287 |
|
288 |
+
if __name__ == "__main__":
|
289 |
+
model_path = "ibm-granite/granite-intrinsics-3.0-8b-lora-v0.1"
|
290 |
+
|
291 |
+
# Setting the model_path to the granite model, and chat template to be the granite template
|
292 |
+
# This assumes "granite3-instruct" chat template has been registered in "sglang/lang/chat_template.py"
|
293 |
+
runtime = sgl.Runtime(model_path=model_path)
|
294 |
+
runtime.endpoint.chat_template = get_chat_template("granite3-instruct")
|
295 |
+
sgl.set_default_backend(runtime)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
|
297 |
+
state = main_chat_flow (doc=document, query=query)
|
298 |
+
|
299 |
+
```
|
300 |
|
301 |
|
302 |
#### Notes
|
|
|
315 |
## Evaluation
|
316 |
We evaluate the performance of the intrinsics themselves and the RAG performance of the model.
|
317 |
|
318 |
+
We first find that the performance of the intrinsics in our shared model **Granite Instrinsics 3.0 8b v0.1** is not degraded
|
319 |
versus the baseline procedure of maintaining 3 separate instrinsic models. Here, percent error is shown for the Hallucination Detection and Safety Exception intrinsics as they have
|
320 |
binary output, and Mean Absolute Error (MAE) is shown for the Uncertainty Intrinsic as it outputs numbers 0 to 9. For all, lower is better. Performance is calculated on a randomly drawn 400 sample validation set from each intrinsic's dataset.
|
321 |
|
322 |
|
323 |
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6602ffd971410cf02bf42c06/NsvMpweFjmjIhWFaKtI-K.png)
|
324 |
|
325 |
+
We then find that RAG performance of **Granite Instrinsics 3.0 8b v0.1** does not suffer with respect to the base model [ibm-granite/granite-3.0-8b-instruct](https://huggingface.co/ibm-granite/granite-3.0-8b-instruct). Here we evaluate the RAGBench benchmark on RAGAS faithfulness and correction metrics.
|
326 |
|
327 |
|
328 |
![image/png](https://cdn-uploads.huggingface.co/production/uploads/6602ffd971410cf02bf42c06/hyOlQmXPirlCYeILLBXhc.png)
|
329 |
|
330 |
## Training Details
|
331 |
+
The **Granite Instrinsics 3.0 8b v0.1** model is a LoRA adapter finetuned to provide 3 desired intrinsic outputs - Uncertainty Quantification, Hallucination Detection, and Safety.
|
332 |
|
333 |
|
334 |
|