Update tokenizer_config.json
#4
by
javiccano - opened
- README.md +21 -39
- tokenizer_config.json +1 -1
README.md
CHANGED
|
@@ -15,11 +15,10 @@ base_model:
|
|
| 15 |
|
| 16 |
- **Developers:** IBM Research
|
| 17 |
- **GitHub Repository:** [ibm-granite/granite-guardian](https://github.com/ibm-granite/granite-guardian)
|
| 18 |
-
- **Cookbook:** [Granite Guardian Factuality Detection Recipes](https://github.
|
| 19 |
- **Website:** [Granite Guardian Docs](https://www.ibm.com/granite/docs/models/guardian/)
|
| 20 |
-
- **Paper:** [Granite Guardian](https://arxiv.org/abs/2412.07724)
|
| 21 |
-
- **
|
| 22 |
-
- **Release Date**: December, 2025
|
| 23 |
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
| 24 |
|
| 25 |
## Usage
|
|
@@ -27,7 +26,7 @@ base_model:
|
|
| 27 |
|
| 28 |
Granite Guardian is useful for risk detection use-cases which are applicable across a wide-range of enterprise applications.
|
| 29 |
|
| 30 |
-
Granite-guardian-3.2-8b-factuality-
|
| 31 |
|
| 32 |
### Risk Definitions
|
| 33 |
|
|
@@ -35,20 +34,21 @@ The model is specifically designed to detect assistant messages containing only
|
|
| 35 |
|
| 36 |
- **Factuality**: Assistant message is factually incorrect relative to the information provided in the context. This risk arises when the response includes a small fraction of atomic units such as claims or facts that are not supported by or directly contradicted by some part of the context. A factually incorrect response might include incorrect information not supported by or directly contradicted by the context, it might misstate facts, misinterpret the context, or provide erroneous details.
|
| 37 |
|
| 38 |
-
The detector manages both
|
| 39 |
|
| 40 |
This model is part of an ongoing research effort focused on post-generation mitigation and remains experimental and under active development. We are committed to continuous improvement and welcome constructive feedback to enhance its performance and capabilities.
|
| 41 |
|
| 42 |
|
| 43 |
### Limitations
|
| 44 |
|
| 45 |
-
It is important to note that there is no built-in safeguard to guarantee that the detection output response will always be correct. As with other generative models, safety assurance relies on offline evaluations (see [Evaluations](#evaluations)), and we expect, but cannot ensure, that the label meets safety standards.
|
| 46 |
|
| 47 |
|
| 48 |
### Using Granite Guardian and Factuality Detection
|
| 49 |
|
| 50 |
[Granite Guardian Cookbooks](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks) offers an excellent starting point for working with guardian models, providing a variety of examples that demonstrate how the models can be configured for different risk detection scenarios.
|
| 51 |
- [Quick Start Guide](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.2/quick_start_vllm.ipynb) provides steps to start using Granite Guardian for detecting risks in prompts (user message), responses (assistant message), RAG use cases, or agentic workflows.
|
|
|
|
| 52 |
- [Detailed Guide](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.2/detailed_guide_vllm.ipynb) explores different risk dimensions in depth and shows how to assess custom risk definitions with Granite Guardian. For finer-grained control over token-level risk probabilities and thresholding, please also consult this cookbook.
|
| 53 |
|
| 54 |
|
|
@@ -66,9 +66,6 @@ import torch
|
|
| 66 |
import math
|
| 67 |
from transformers import AutoTokenizer
|
| 68 |
from vllm import LLM, SamplingParams
|
| 69 |
-
import jinja2
|
| 70 |
-
warnings.filterwarnings("ignore")
|
| 71 |
-
os.environ["VLLM_LOGGING_LEVEL"] = "ERROR"
|
| 72 |
|
| 73 |
def get_probabilities(logprobs):
|
| 74 |
safe_token_prob = 1e-50
|
|
@@ -118,21 +115,16 @@ def transform_dataset_for_chat_format(
|
|
| 118 |
context, response
|
| 119 |
):
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
|
|
|
|
|
|
| 123 |
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
dataset = {
|
| 132 |
-
"formatted_chat": tokenizer.apply_chat_template(
|
| 133 |
-
dataset["chat"], tokenize=False, add_generation_prompt=True
|
| 134 |
-
)
|
| 135 |
-
}
|
| 136 |
|
| 137 |
return dataset
|
| 138 |
|
|
@@ -151,16 +143,6 @@ safe_token = "No"
|
|
| 151 |
risky_token = "Yes"
|
| 152 |
|
| 153 |
|
| 154 |
-
if os.getenv("HF_HOME") is None:
|
| 155 |
-
base_path = os.path.dirname(__file__)
|
| 156 |
-
hf_cache_dir = f"{base_path}/hf_cache"
|
| 157 |
-
|
| 158 |
-
if not os.path.isdir(hf_cache_dir):
|
| 159 |
-
os.mkdir(hf_cache_dir)
|
| 160 |
-
else:
|
| 161 |
-
hf_cache_dir = None
|
| 162 |
-
|
| 163 |
-
|
| 164 |
# Load models
|
| 165 |
model = LLM(
|
| 166 |
model=model_path_name,
|
|
@@ -191,7 +173,7 @@ chat = transform_dataset_for_chat_format(
|
|
| 191 |
)
|
| 192 |
|
| 193 |
with torch.no_grad():
|
| 194 |
-
output = model.generate(chat
|
| 195 |
|
| 196 |
label, prob_of_risk = parse_output(output[0])
|
| 197 |
print(f"# risk detected? : {label}")
|
|
@@ -231,7 +213,7 @@ Is the last assistant message harmful based on the risk definition? Your answer
|
|
| 231 |
```
|
| 232 |
### Scope of Use
|
| 233 |
|
| 234 |
-
- The **Granite Guardian 3.2 8B Factuality Detector** is intended for use cases that involve the safe detection of LLM responses.
|
| 235 |
|
| 236 |
The Granite Guardian detector must <ins>only</ins> be used strictly for the prescribed scoring mode, which generates yes/no outputs based on the specified template. Any deviation from this intended use may lead to unexpected, potentially unsafe, or harmful outputs. The model may also be prone to such behaviour via adversarial attacks.
|
| 237 |
- The **Factuality Detector** is intended for use cases that involve the detection of factuality.
|
|
@@ -243,9 +225,9 @@ The Granite Guardian detector must <ins>only</ins> be used strictly for the pres
|
|
| 243 |
|
| 244 |
Granite Guardian 3.2 8B Factuality Detector was trained using synthetic data that was generated from [ELI5-Category](https://huggingface.co/datasets/rexarski/eli5_category) using FactCorrector. The ELI5-Category QA dataset is a smaller but newer and categorized version of the original ELI5 dataset. It is an English-language dataset of questions and answers gathered from the [r/explainlikeimfive](https://www.reddit.com/r/explainlikeimfive/) subreddit where users ask factual questions requiring paragraph-length or longer answers. After 2017, a tagging system was introduced to this subreddit so that the questions can be categorized into different topics according to their tags. This includes the following categories: engineering, physics, chemistry, technology, mathematics, biology, economics, culture, repost, earth science, pyschology, and other.
|
| 245 |
|
| 246 |
-
In particular, FactCorrector takes the response of a large language model (LLM) as input and refine it using feedback from FactReasoner. FactReasoner evaluates the LLM's response against the factuality of every atom of the response based on the retrieved contexts from the Google API and assigns a factuality score. Based on this score, FactCorrector determines whether the response needs adjustment. If the score is lower than 0.8, the system generates a correction of the response by prompting the LLM again, this time incorporating the possible relations between every atom and context: entailment, contradiction, or equivalence. The LLM used in the pipeline was `Mixtral-8x22B-Instruct-v0.1`.
|
| 247 |
|
| 248 |
-

|
| 18 |
+
- **Cookbook:** [Granite Guardian Factuality Detection Recipes](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.2/factuality_detection_guide_vllm.ipynb)
|
| 19 |
- **Website:** [Granite Guardian Docs](https://www.ibm.com/granite/docs/models/guardian/)
|
| 20 |
+
- **Paper:** [Granite Guardian](https://arxiv.org/abs/2412.07724) [FactReasoner: A Probabilistic Approach to Long-Form Factuality Assessment for Large Language Models](https://arxiv.org/abs/2502.18573)
|
| 21 |
+
- **Release Date**: February, 2026
|
|
|
|
| 22 |
- **License:** [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
| 23 |
|
| 24 |
## Usage
|
|
|
|
| 26 |
|
| 27 |
Granite Guardian is useful for risk detection use-cases which are applicable across a wide-range of enterprise applications.
|
| 28 |
|
| 29 |
+
Granite-guardian-3.2-8b-factuality-detection takes an input consisting of an original `response` generated by a Large Language Model (LLM) and a `context`, and generates a `label`, meaning that the response is unfactual ("Yes") or factual ("No") according to the `context` provided.
|
| 30 |
|
| 31 |
### Risk Definitions
|
| 32 |
|
|
|
|
| 34 |
|
| 35 |
- **Factuality**: Assistant message is factually incorrect relative to the information provided in the context. This risk arises when the response includes a small fraction of atomic units such as claims or facts that are not supported by or directly contradicted by some part of the context. A factually incorrect response might include incorrect information not supported by or directly contradicted by the context, it might misstate facts, misinterpret the context, or provide erroneous details.
|
| 36 |
|
| 37 |
+
The detector manages both factual and unfactual cases.
|
| 38 |
|
| 39 |
This model is part of an ongoing research effort focused on post-generation mitigation and remains experimental and under active development. We are committed to continuous improvement and welcome constructive feedback to enhance its performance and capabilities.
|
| 40 |
|
| 41 |
|
| 42 |
### Limitations
|
| 43 |
|
| 44 |
+
It is important to note that there is no built-in safeguard to guarantee that the detection output response will always be correct. As with other generative models, safety assurance relies on offline evaluations (see [Evaluations](#evaluations)), and we expect, but cannot ensure, that the label meets safety standards. Moreover, this model is specifically optimized for factuality risk. For comprehensive detection of a broader range of risks, users should utilize the latest Granite Guardian model.
|
| 45 |
|
| 46 |
|
| 47 |
### Using Granite Guardian and Factuality Detection
|
| 48 |
|
| 49 |
[Granite Guardian Cookbooks](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks) offers an excellent starting point for working with guardian models, providing a variety of examples that demonstrate how the models can be configured for different risk detection scenarios.
|
| 50 |
- [Quick Start Guide](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.2/quick_start_vllm.ipynb) provides steps to start using Granite Guardian for detecting risks in prompts (user message), responses (assistant message), RAG use cases, or agentic workflows.
|
| 51 |
+
- [Factuality Detection Cookbook](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.2/factuality_detection_guide_vllm.ipynb) provides steps to start using Granite Guardian for detecting factuality in responses.
|
| 52 |
- [Detailed Guide](https://github.com/ibm-granite/granite-guardian/tree/main/cookbooks/granite-guardian-3.2/detailed_guide_vllm.ipynb) explores different risk dimensions in depth and shows how to assess custom risk definitions with Granite Guardian. For finer-grained control over token-level risk probabilities and thresholding, please also consult this cookbook.
|
| 53 |
|
| 54 |
|
|
|
|
| 66 |
import math
|
| 67 |
from transformers import AutoTokenizer
|
| 68 |
from vllm import LLM, SamplingParams
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
def get_probabilities(logprobs):
|
| 71 |
safe_token_prob = 1e-50
|
|
|
|
| 115 |
context, response
|
| 116 |
):
|
| 117 |
|
| 118 |
+
messages = [
|
| 119 |
+
{"role": "context", "content": context},
|
| 120 |
+
{"role": "assistant", "content": response},
|
| 121 |
+
]
|
| 122 |
|
| 123 |
+
dataset = tokenizer.apply_chat_template(
|
| 124 |
+
messages,
|
| 125 |
+
tokenize=False,
|
| 126 |
+
add_generation_prompt=True,
|
| 127 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
|
| 129 |
return dataset
|
| 130 |
|
|
|
|
| 143 |
risky_token = "Yes"
|
| 144 |
|
| 145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
# Load models
|
| 147 |
model = LLM(
|
| 148 |
model=model_path_name,
|
|
|
|
| 173 |
)
|
| 174 |
|
| 175 |
with torch.no_grad():
|
| 176 |
+
output = model.generate(chat, sampling_params, use_tqdm=False)
|
| 177 |
|
| 178 |
label, prob_of_risk = parse_output(output[0])
|
| 179 |
print(f"# risk detected? : {label}")
|
|
|
|
| 213 |
```
|
| 214 |
### Scope of Use
|
| 215 |
|
| 216 |
+
- The **Granite Guardian 3.2 8B Factuality Detector** is intended for use cases that involve the safe detection of LLM responses. The [temperature parameter](https://www.ibm.com/think/topics/llm-temperature) of 0 generates more deterministic responses, while higher values introduce greater randomness and creativity. We found that a temperature value of 0 produces coherent outputs, but users can adjust it based on the level of variability they require and the needs of their application.
|
| 217 |
|
| 218 |
The Granite Guardian detector must <ins>only</ins> be used strictly for the prescribed scoring mode, which generates yes/no outputs based on the specified template. Any deviation from this intended use may lead to unexpected, potentially unsafe, or harmful outputs. The model may also be prone to such behaviour via adversarial attacks.
|
| 219 |
- The **Factuality Detector** is intended for use cases that involve the detection of factuality.
|
|
|
|
| 225 |
|
| 226 |
Granite Guardian 3.2 8B Factuality Detector was trained using synthetic data that was generated from [ELI5-Category](https://huggingface.co/datasets/rexarski/eli5_category) using FactCorrector. The ELI5-Category QA dataset is a smaller but newer and categorized version of the original ELI5 dataset. It is an English-language dataset of questions and answers gathered from the [r/explainlikeimfive](https://www.reddit.com/r/explainlikeimfive/) subreddit where users ask factual questions requiring paragraph-length or longer answers. After 2017, a tagging system was introduced to this subreddit so that the questions can be categorized into different topics according to their tags. This includes the following categories: engineering, physics, chemistry, technology, mathematics, biology, economics, culture, repost, earth science, pyschology, and other.
|
| 227 |
|
| 228 |
+
In particular, FactCorrector takes the response of a large language model (LLM) as input and refine it using feedback from [FactReasoner](https://arxiv.org/abs/2502.18573). [FactReasoner](https://arxiv.org/abs/2502.18573) evaluates the LLM's response against the factuality of every atom of the response based on the retrieved contexts from the Google API and assigns a factuality score. Based on this score, FactCorrector determines whether the response needs adjustment. If the score is lower than 0.8, the system generates a correction of the response by prompting the LLM again, this time incorporating the possible relations between every atom and context: entailment, contradiction, or equivalence. The LLM used in the pipeline was `Mixtral-8x22B-Instruct-v0.1`.
|
| 229 |
|
| 230 |
+

|
| 231 |
|
| 232 |
The training, validation, and test sets contained 14,017 samples, 1,752 samples, and 1,753 samples, respectively, of which 50% were original answers from ELI5-Category, and 50% were generated `Mixtral-8x22B-Instruct-v0.1` using the following prompt:
|
| 233 |
|
|
|
|
| 280 |
|
| 281 |
## Model Creators
|
| 282 |
|
| 283 |
+
**Javier Carnerero Cano, Radu Marinescu, Massimiliano Pronesti, Tigran Tchrakian, Yufang Hou, Elizabeth Daly, Alessandra Pascale**
|
tokenizer_config.json
CHANGED
|
@@ -185,7 +185,7 @@
|
|
| 185 |
"<|tool_call|>"
|
| 186 |
],
|
| 187 |
"bos_token": "<|end_of_text|>",
|
| 188 |
-
"chat_template": "{%- if messages[0]['role'] == 'system' %}\n {%- set system_message = messages[0]['content'] %}\n {%- set loop_messages = messages[1:] %}\n{%- else %}\n {%- set system_message = \"Knowledge Cutoff Date: April 2024.\nToday's Date: \" + strftime_now('%B %d, %Y') + \".\nYou are Granite, developed by IBM.\" %}\n {%- if tools and documents %}\n {%- set system_message = system_message + \" You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. 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.\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.\" %}\n {%- elif tools %}\n {%- set system_message = system_message + \" You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. 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.\" %}\n {%- elif documents %}\n {%- set system_message = system_message + \" Write 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.\" %}\n {%- elif thinking %}\n {%- set system_message = system_message + \" You are a helpful AI assistant.\nRespond to every user query in a comprehensive and detailed way. You can write down your thoughts and reasoning process before responding. In the thought process, engage in a comprehensive cycle of analysis, summarization, exploration, reassessment, reflection, backtracing, and iteration to develop well-considered thinking process. In the response section, based on various attempts, explorations, and reflections from the thoughts section, systematically present the final solution that you deem correct. The response should summarize the thought process. Write your thoughts after 'Here is my thought process:' and write your response after 'Here is my response:' for each user query.\" %}\n {%- else %}\n {%- set system_message = system_message + \" You are a helpful AI assistant.\" %} \n {%- endif %}\n {%- if 'citations' in controls and documents %}\n {%- set system_message = system_message + '\n\nIn your response, use the symbols <co> and </co> to indicate when a fact comes from a document in the search result, e.g <co>0</co> for a fact from document 0. Afterwards, list all the citations with their corresponding documents in an ordered list.' %}\n {%- endif %}\n {%- if 'hallucinations' in controls and documents %}\n {%- set system_message = system_message + '\n\nFinally, after the response is written, include a numbered list of sentences from the response that are potentially hallucinated and not based in the documents.' %}\n {%- endif %}\n {%- set loop_messages = messages %}\n{%- endif %}\n{{- '<|start_of_role|>system<|end_of_role|>' + system_message + '<|end_of_text|>\n' }}\n{%- if tools %}\n {{- '<|start_of_role|>tools<|end_of_role|>' }}\n {{- tools | tojson(indent=4) }}\n {{- '<|end_of_text|>\n' }}\n{%- endif %}\n{%- if documents %}\n {{- '<|start_of_role|>documents<|end_of_role|>' }}\n {%- for document in documents %}\n {{- 'Document ' + loop.index0 | string + '\n' }}\n {{- document['text'] }}\n {%- if not loop.last %}\n {{- '\n\n'}}\n {%- endif%}\n {%- endfor %}\n {{- '<|end_of_text|>\n' }}\n{%- endif %}\n{%- for message in loop_messages %}\n {{- '<|start_of_role|>' + message['role'] + '<|end_of_role|>' + message['content'] + '<|end_of_text|>\n' }}\n {%- if loop.last and add_generation_prompt %}\n {{- '<|start_of_role|>assistant' }}\n {%- if controls %}\n {{- ' ' + controls | tojson()}}\n {%- endif %}\n {{- '<|end_of_role|>' }}\n {%- endif %}\n{%- endfor %}",
|
| 189 |
"clean_up_tokenization_spaces": true,
|
| 190 |
"eos_token": "<|end_of_text|>",
|
| 191 |
"errors": "replace",
|
|
|
|
| 185 |
"<|tool_call|>"
|
| 186 |
],
|
| 187 |
"bos_token": "<|end_of_text|>",
|
| 188 |
+
"chat_template": "{%- if messages[0]['role'] == 'system' %}\n {%- set system_message = messages[0]['content'] %}\n {%- set loop_messages = messages[1:] %}\n{%- else %}\n {%- set system_message = \"Knowledge Cutoff Date: April 2024.\nToday's Date: \" + strftime_now('%B %d, %Y') + \".\nYou are Granite, developed by IBM.\" %}\n {%- if tools and documents %}\n {%- set system_message = system_message + \" You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. 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.\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.\" %}\n {%- elif tools %}\n {%- set system_message = system_message + \" You are a helpful AI assistant with access to the following tools. When a tool is required to answer the user's query, respond with <|tool_call|> followed by a JSON list of tools used. 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.\" %}\n {%- elif documents %}\n {%- set system_message = system_message + \" Write 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.\" %}\n {%- elif thinking %}\n {%- set system_message = system_message + \" You are a helpful AI assistant.\nRespond to every user query in a comprehensive and detailed way. You can write down your thoughts and reasoning process before responding. In the thought process, engage in a comprehensive cycle of analysis, summarization, exploration, reassessment, reflection, backtracing, and iteration to develop well-considered thinking process. In the response section, based on various attempts, explorations, and reflections from the thoughts section, systematically present the final solution that you deem correct. The response should summarize the thought process. Write your thoughts after 'Here is my thought process:' and write your response after 'Here is my response:' for each user query.\" %}\n {%- else %}\n {%- set system_message = system_message + \" You are a helpful AI assistant.\" %} \n {%- endif %}\n {%- if 'citations' in controls and documents %}\n {%- set system_message = system_message + '\n\nIn your response, use the symbols <co> and </co> to indicate when a fact comes from a document in the search result, e.g <co>0</co> for a fact from document 0. Afterwards, list all the citations with their corresponding documents in an ordered list.' %}\n {%- endif %}\n {%- if 'hallucinations' in controls and documents %}\n {%- set system_message = system_message + '\n\nFinally, after the response is written, include a numbered list of sentences from the response that are potentially hallucinated and not based in the documents.' %}\n {%- endif %}\n {%- set loop_messages = messages %}\n{%- endif %}\n{%- set ns = namespace(ctx=\"\", judged=none) -%}\n{%- for m in messages -%}\n{%- if m['role'] == 'context' and ns.ctx == \"\" -%}\n{%- set ns.ctx = m['content'] -%}\n{%- endif -%}\n{%- if m['role'] == 'assistant' -%}\n{%- set ns.judged = m -%}\n{%- endif -%}\n{%- endfor -%}\n{%- if ns.judged is none -%}\n{%- set ns.judged = messages[-1] -%}\n{%- endif -%}\n{%- set task_prompt -%}\nYou are a safety agent trying to help determine if the assistant message poses a potential harm based on the provided risk definition and the given context.\n\n<start_of_conversation>\nContext: {{ ns.ctx }}\nAssistant Message: {{ ns.judged['content'] }}\n<end_of_conversation>\n\nOur safety risk definition is defined below:\n<start_of_risk_definition>\n- 'Assistant' message is factually incorrect relative to the information provided in the 'Context'. This risk arises when the assistant's message includes a small fraction of atomic units such as claims or facts that are not supported by or directly contradicted by some part of the 'Context'. A factually incorrect response might include incorrect information not supported by or directly contradicted by the context, it might misstate facts, misinterpret the context, or provide erroneous details.\n<end_of_risk_definition>\n\nIs the last assistant message harmful based on the risk definition? Your answer must be either 'Yes' or 'No'.\n{%- endset -%}\n{%- set loop_messages = [{'role':'user','content': task_prompt}] -%}\n{{- '<|start_of_role|>system<|end_of_role|>' + system_message + '<|end_of_text|>\n' }}\n{%- if tools %}\n {{- '<|start_of_role|>tools<|end_of_role|>' }}\n {{- tools | tojson(indent=4) }}\n {{- '<|end_of_text|>\n' }}\n{%- endif %}\n{%- if documents %}\n {{- '<|start_of_role|>documents<|end_of_role|>' }}\n {%- for document in documents %}\n {{- 'Document ' + loop.index0 | string + '\n' }}\n {{- document['text'] }}\n {%- if not loop.last %}\n {{- '\n\n'}}\n {%- endif%}\n {%- endfor %}\n {{- '<|end_of_text|>\n' }}\n{%- endif %}\n{%- for message in loop_messages %}\n {{- '<|start_of_role|>' + message['role'] + '<|end_of_role|>' + message['content'] + '<|end_of_text|>\n' }}\n {%- if loop.last and add_generation_prompt %}\n {{- '<|start_of_role|>assistant' }}\n {%- if controls %}\n {{- ' ' + controls | tojson()}}\n {%- endif %}\n {{- '<|end_of_role|>' }}\n {%- endif %}\n{%- endfor %}",
|
| 189 |
"clean_up_tokenization_spaces": true,
|
| 190 |
"eos_token": "<|end_of_text|>",
|
| 191 |
"errors": "replace",
|