DarshanDeshpande
commited on
Commit
•
7d717d1
1
Parent(s):
83af613
Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,174 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
|
|
|
|
|
|
|
10 |
|
11 |
|
12 |
## Model Details
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
- **Developed by:** [More Information Needed]
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
|
28 |
-
### Model Sources
|
29 |
|
30 |
<!-- Provide the basic links for the model. -->
|
31 |
|
32 |
-
- **Repository:** [
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
-
|
36 |
-
## Uses
|
37 |
-
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
-
### Direct Use
|
41 |
-
|
42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
-
|
52 |
-
### Out-of-Scope Use
|
53 |
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
-
|
64 |
-
### Recommendations
|
65 |
-
|
66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
-
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
|
70 |
## How to Get Started with the Model
|
|
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
## Training Details
|
77 |
-
|
78 |
-
### Training Data
|
79 |
-
|
80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
|
88 |
-
|
|
|
89 |
|
90 |
-
|
|
|
91 |
|
|
|
|
|
92 |
|
93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
|
95 |
-
|
96 |
|
97 |
-
|
98 |
|
99 |
-
|
|
|
|
|
|
|
100 |
|
101 |
-
|
|
|
|
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
|
129 |
-
|
|
|
130 |
|
131 |
-
|
132 |
|
|
|
|
|
|
|
|
|
133 |
|
|
|
|
|
|
|
134 |
|
135 |
-
|
|
|
|
|
|
|
|
|
136 |
|
137 |
-
|
138 |
|
139 |
-
|
|
|
|
|
|
|
140 |
|
141 |
-
|
|
|
|
|
|
|
|
|
142 |
|
143 |
-
|
144 |
|
145 |
-
|
146 |
|
147 |
-
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
|
153 |
-
|
154 |
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
-
|
|
|
|
|
158 |
|
159 |
-
|
|
|
160 |
|
161 |
-
|
162 |
|
163 |
-
|
164 |
|
165 |
-
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
|
189 |
-
|
190 |
|
191 |
-
|
|
|
192 |
|
193 |
-
##
|
|
|
194 |
|
195 |
-
|
|
|
|
|
196 |
|
197 |
## Model Card Contact
|
198 |
-
|
199 |
-
[
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- text-generation
|
5 |
+
- pytorch
|
6 |
+
- small-evaluator
|
7 |
+
- Patronus AI
|
8 |
+
- evaluation
|
9 |
+
- hallucination-detection
|
10 |
+
license: cc-by-nc-4.0
|
11 |
+
language:
|
12 |
+
- en
|
13 |
+
base_model:
|
14 |
+
- microsoft/Phi-3.5-mini-instruct
|
15 |
+
pipeline_tag: text-generation
|
16 |
---
|
17 |
|
18 |
+
# Patronus GLIDER
|
|
|
|
|
19 |
|
20 |
+
GLIDER is a fine tuned phi-3.5-mini-instruct which can be used as a general purpose evaluation model to judge texts, conversations and RAG setups according to arbitrary, user defined criteria and rubric scale.
|
21 |
+
This model was trained using a combination of synthetic and domain adapted data from popular datasets like Mocha, FinQA, Realtoxicity, etc. The training data for this model covers over 183 metrics and 683+ domains including finance, medicine, and many more.
|
22 |
+
The maximum sequence length is 8192 tokens but the model can support longer texts as well (tested upto 12,000 tokens).
|
23 |
|
24 |
|
25 |
## Model Details
|
26 |
|
27 |
+
- **Model Type:** GLIDER is a fine-tuned version of microsoft/Phi-3.5-mini-instruct model.
|
28 |
+
- **Language:** Primarily English but supports Korean, Kazakh, Hindi, Bengali, Spanish, Indonesian, German, French, Arabic, Russian, Thai, Turkish, Ukraninan, Romainian and more.
|
29 |
+
- **Developed by:** Patronus AI
|
30 |
+
- **Paper:** [TBD]
|
31 |
+
- **License:** [https://creativecommons.org/licenses/by-nc/4.0/](https://creativecommons.org/licenses/by-nc/4.0/)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
+
### Model Sources
|
34 |
|
35 |
<!-- Provide the basic links for the model. -->
|
36 |
|
37 |
+
- **Repository:** [https://github.com/patronus-ai/slm-evaluator](https://github.com/patronus-ai/slm-evaluator)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
## How to Get Started with the Model
|
41 |
+
To use the model, we recommend using the following prompt:
|
42 |
|
43 |
+
```
|
44 |
+
PROMPT = """Analyze the following pass criteria carefully and score the text based on the rubric defined below.
|
45 |
+
|
46 |
+
To perform this evaluation, you must:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
+
1. Understand the text tags, pass criteria and rubric thoroughly.
|
49 |
+
2. Review the finer details of the text and the rubric.
|
50 |
+
3. Compare the tags to be evaluated to the score descriptions in the rubric.
|
51 |
+
4. Pay close attention to small details that might impact the final score and form accurate associations between tags and pass criteria.
|
52 |
+
5. Write a detailed reasoning justifying your evaluation in a bullet point format.
|
53 |
+
6. The reasoning must summarize the overall strengths and weaknesses of the output while quoting exact phrases from the output wherever required.
|
54 |
+
7. Output a list of words or phrases that you believe are the most important in determining the score.
|
55 |
+
8. Assign a final score based on the scoring rubric.
|
56 |
|
57 |
+
Data to evaluate:
|
58 |
+
{data}
|
59 |
|
60 |
+
Pass Criteria:
|
61 |
+
{pass_criteria}
|
62 |
|
63 |
+
Rubric:
|
64 |
+
{rubric}
|
65 |
|
66 |
+
Your output must in the following format:
|
67 |
+
<reasoning>
|
68 |
+
[Detailed reasoning justifying your evaluation in a bullet point format according to the specifics defined above]
|
69 |
+
</reasoning>
|
70 |
+
<highlight>
|
71 |
+
[List of words or phrases that you believe are the most important in determining the score]
|
72 |
+
</highlight>
|
73 |
+
<score>
|
74 |
+
[The final integer score assigned based on the scoring rubric]
|
75 |
+
</score>
|
76 |
+
```
|
77 |
|
78 |
+
Since the model supports arbitrary number of inputs and outputs, the data can be structured in any one of the following ways:
|
79 |
|
80 |
+
1. Conversational data:
|
81 |
|
82 |
+
```
|
83 |
+
data = """<SYSTEM PROMPT>
|
84 |
+
{system_prompt}
|
85 |
+
</SYSTEM PROMPT>
|
86 |
|
87 |
+
<USER PROMPT>
|
88 |
+
{user_prompt}
|
89 |
+
</USER PROMPT>
|
90 |
|
91 |
+
<ASSISTANT REPLY>
|
92 |
+
{assistant_response}
|
93 |
+
</ASSISTANT REPLY>
|
94 |
+
"""
|
95 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
+
This template can be adapted for arbitrary number of conversations by simply appending a numeric turn number as "<USER PROMPT 1>", "<USER PROMPT 2>" and so on.
|
98 |
+
Ensure that you specify the exact tags that you want the model to judge in the pass criteria
|
99 |
|
100 |
+
2. RAG system evaluation
|
101 |
|
102 |
+
```
|
103 |
+
data = """<CONTEXT>
|
104 |
+
{retrieved_context}
|
105 |
+
</CONTEXT>
|
106 |
|
107 |
+
<USER INPUT>
|
108 |
+
{user_input}
|
109 |
+
</USER INPUT>
|
110 |
|
111 |
+
<MODEL OUTPUT>
|
112 |
+
{model_output}
|
113 |
+
</MODEL OUTPUT>
|
114 |
+
"""
|
115 |
+
```
|
116 |
|
117 |
+
3. General purpose evaluations
|
118 |
|
119 |
+
```
|
120 |
+
data = """<USER INPUT>
|
121 |
+
{input}
|
122 |
+
</USER INPUT>
|
123 |
|
124 |
+
<MODEL OUTPUT>
|
125 |
+
{output}
|
126 |
+
</MODEL OUTPUT>
|
127 |
+
"""
|
128 |
+
```
|
129 |
|
130 |
+
Note that these XML tags can be changed according to your convenience and task
|
131 |
|
132 |
+
## Inference
|
133 |
|
134 |
+
To run inference, you can use HF pipeline:
|
|
|
|
|
|
|
|
|
135 |
|
136 |
+
```
|
137 |
|
138 |
+
model_name = 'PatronusAI/glider'
|
139 |
+
pipe = pipeline(
|
140 |
+
"text-generation",
|
141 |
+
model=model_name,
|
142 |
+
max_new_tokens=2048,
|
143 |
+
device="cuda",
|
144 |
+
return_full_text=False
|
145 |
+
)
|
146 |
|
147 |
+
messages = [
|
148 |
+
{"role": "user", "content": prompt},
|
149 |
+
]
|
150 |
|
151 |
+
result = pipe(messages)
|
152 |
+
print(result[0]['generated_text'])
|
153 |
|
154 |
+
```
|
155 |
|
156 |
+
Since the model is trained in chat format, ensure that you pass the prompt as a user message.
|
157 |
|
158 |
+
## Evaluation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
|
160 |
+
The model was evaluated on several popular datasets:
|
161 |
|
162 |
+
<img src="https://i.imgur.com/wsv3COh.png" alt="Likert Rating Results" width="50%"/>
|
163 |
+
<img src="https://i.imgur.com/xmxREho.png" alt="Pairwise Comparisons" width="50%"/>
|
164 |
|
165 |
+
## Citation
|
166 |
+
If you are using the model, cite using
|
167 |
|
168 |
+
```
|
169 |
+
[Paper citation]
|
170 |
+
```
|
171 |
|
172 |
## Model Card Contact
|
173 |
+
[@darshandeshpande](https://huggingface.co/darshandeshpande)
|
174 |
+
[@RebeccaQian1](https://huggingface.co/RebeccaQian1)
|