aashish1904
commited on
Commit
•
9b975f7
1
Parent(s):
50b6574
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,161 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
---
|
3 |
+
|
4 |
+
license: other
|
5 |
+
base_model: meta-llama/Meta-Llama-3.1-8B-Instruct
|
6 |
+
pipeline_tag: text-generation
|
7 |
+
|
8 |
+
---
|
9 |
+
|
10 |
+
[![QuantFactory Banner](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)](https://hf.co/QuantFactory)
|
11 |
+
|
12 |
+
|
13 |
+
# QuantFactory/Skywork-Critic-Llama-3.1-8B-GGUF
|
14 |
+
This is quantized version of [Skywork/Skywork-Critic-Llama-3.1-8B](https://huggingface.co/Skywork/Skywork-Critic-Llama-3.1-8B) created using llama.cpp
|
15 |
+
|
16 |
+
# Original Model Card
|
17 |
+
|
18 |
+
|
19 |
+
<div align="center">
|
20 |
+
<img src="misc/misc_fig.jpg" width="400"/>
|
21 |
+
🤗 <a href="https://huggingface.co/Skywork" target="_blank">Hugging Face</a> • 🤖 <a href="https://modelscope.cn/organization/Skywork" target="_blank">ModelScope</a>
|
22 |
+
<br>
|
23 |
+
<br>
|
24 |
+
<br>
|
25 |
+
</div>
|
26 |
+
|
27 |
+
# Introduction to Skywork Critic Series Models
|
28 |
+
|
29 |
+
[**Skywork-Critic-Llama3.1-70B**](https://huggingface.co/Skywork/Skywork-Critic-Llama3.1-70B) and [**Skywork-Critic-Llama3.1-8B**](https://huggingface.co/Skywork/Skywork-Critic-Llama-3.1-8B), developed by the [SkyworkAI](https://huggingface.co/Skywork) Alignment Team, are advanced judge models that excel at pairwise preference evaluation. These models compare and assess input pairs, offering nuanced judgments on their relative quality or suitability. Leveraging their deep understanding of language and context, Skywork-Critic models provide valuable insights for various applications, including data improvement, evaluation, and reward modeling.
|
30 |
+
|
31 |
+
# Training Details
|
32 |
+
|
33 |
+
|
34 |
+
Skywork-Critic-Llama3.1-70B and Skywork-Critic-Llama3.1-8B are built on Meta [Llama-3.1-70B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-70B-Instruct) and [Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) respectively. These models have undergone fine-tuning using a diverse array of high-quality datasets, including:
|
35 |
+
- **Cleaned open-source data**: We utilize a high-quality subset of [HelpSteer2](https://huggingface.co/datasets/nvidia/HelpSteer2), [OffsetBias](https://huggingface.co/datasets/NCSOFT/offsetbias), [WildGuard (adversarial)](https://huggingface.co/allenai/wildguard) and Magpie DPO series([Ultra](https://huggingface.co/datasets/argilla/magpie-ultra-v0.1),[Pro (Llama-3.1)](https://huggingface.co/datasets/Magpie-Align/Magpie-Llama-3.1-Pro-DPO-100K-v0.1),[Pro](https://huggingface.co/datasets/Magpie-Align/Magpie-Pro-DPO-100K-v0.1),[Air](https://huggingface.co/datasets/Magpie-Align/Magpie-Air-DPO-100K-v0.1)). For more details, please refer to our [Skywork-Reward-Preference-80K-v0.1 dataset](https://huggingface.co/datasets/Skywork/Skywork-Reward-Preference-80K-v0.1). Additionally, we integrate several open-source, high-quality critic datasets such as [Open-Critic-GPT](https://huggingface.co/datasets/Vezora/Open-Critic-GPT) into our training process.
|
36 |
+
- **In-house human annotation data**: This includes both pointwise scoring across many dimensions for a single response and pairwise comparisons between two responses. Each dimension incorporates a rationale for the assigned score.
|
37 |
+
- **Synthetic critic data**: We use a similar appoarch to [**self-taught**](https://arxiv.org/abs/2408.02666). Specifically, we employed two methods to generate inferior responses for a given instruction: 1) Creating a similar instruction and then generating a response for this new instruction. 2) Introducing subtle errors into high-quality responses.
|
38 |
+
- **Critic-related chat data**: We incorporate critic-related chat data to maintain the model's conversational capabilities.
|
39 |
+
|
40 |
+
The training employs instruction-tuning methodology, focusing on pairwise preference evaluation and general chat tasks. We have conducted a thorough verification process to ensure our training dataset does not contain any test set information from RewardBench, maintaining the integrity of our evaluation results.
|
41 |
+
|
42 |
+
|
43 |
+
# RewardBench Leaderboard for Generative Models
|
44 |
+
|
45 |
+
We evaluate our models on [RewardBench](https://huggingface.co/spaces/allenai/reward-bench) using the [official test script](https://github.com/allenai/reward-bench).
|
46 |
+
|
47 |
+
As of September 2024, Skywork-Critic-Llama3.1-70B **ranks first** on RewardBench for generative models across all sizes, while Skywork-Critic-Llama3.1-8B tops the list for generative models under 10B parameters. (Note: An asterisk (*) indicates an open-source model.)
|
48 |
+
|
49 |
+
| Model | Chat | Chat Hard | Safety | Reasoning | Overall Score |
|
50 |
+
| ------------------------------- | :---: | :-------: | :----: | :-------: | :---: |
|
51 |
+
| **Skywork-Critic-Llama3.1-70B** * | **96.6** | **87.9** | **93.1** | **95.5** | **93.3** |
|
52 |
+
| Salesforce/SFR-LLaMa-3.1-70B-Judge-r | 96.9 | 84.8 | 91.6 | 97.6 | 92.7 |
|
53 |
+
| Salesforce/SFR-nemo-12B-Judge-r | 97.2 | 82.2 | 86.5 | 95.1 | 90.3 |
|
54 |
+
| **Skywork-Critic-Llama3.1-8B** * | **93.6** | **81.4** | **91.1** | **89.8** | **89.0** |
|
55 |
+
| Salesforce/SFR-LLaMa-3.1-8B-Judge-r | 95.5 | 77.7 | 86.2 | 95.1 | 88.7 |
|
56 |
+
| facebook/Self-taught-Llama-3-70B | 96.9 | 84.0 | 91.1 | 82.5 | 88.6 |
|
57 |
+
| google/gemini-1.5-pro-0514 | 92.3 | 80.6 | 87.9 | 92.0 | 88.2 |
|
58 |
+
| openai/gpt-4o-2024-08-06 | 96.1 | 76.1 | 88.1 | 86.6 | 86.7 |
|
59 |
+
| openai/gpt-4-0125-preview | 95.3 | 74.3 | 87.6 | 86.9 | 86.0 |
|
60 |
+
| openai/gpt-4-turbo-2024-04-09 | 95.3 | 75.4 | 87.6 | 82.7 | 85.2 |
|
61 |
+
| Anthropic/claude-3-5-sonnet-20240620 | 96.4 | 74.0 | 81.6 | 84.7 | 84.2 |
|
62 |
+
| meta-llama/Meta-Llama-3.1-70B-Instruct * | 97.2 | 70.2 | 82.8 | 86.0 | 84.0 |
|
63 |
+
| NCSOFT/Llama-3-OffsetBias-8B * | 92.5 | 80.3 | 86.8 | 76.4 | 84.0 |
|
64 |
+
|
65 |
+
|
66 |
+
# Demo Code
|
67 |
+
Below is an example of obtaining the critic of two conversations.
|
68 |
+
|
69 |
+
```python
|
70 |
+
import torch
|
71 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
72 |
+
|
73 |
+
# An Example Case
|
74 |
+
prompt = "Jane has 12 apples. She gives 4 apples to her friend Mark, then buys 1 more apple, and finally splits all her apples equally among herself and her 2 siblings. How many apples does each person get?"
|
75 |
+
responseA = "1. Jane starts with 12 apples and gives 4 to Mark. 12 - 4 = 8. Jane now has 8 apples.\n2. Jane buys 1 more apple. 8 + 1 = 9. Jane now has 9 apples.\n3. Jane splits the 9 apples equally among herself and her 2 siblings (3 people in total). 9 ÷ 3 = 3 apples each. Each person gets 3 apples."
|
76 |
+
responseB = "1. Jane starts with 12 apples and gives 4 to Mark. 12 - 4 = 8. Jane now has 8 apples.\n2. Jane buys 1 more apple. 8 + 1 = 9. Jane now has 9 apples.\n3. Jane splits the 9 apples equally among her 2 siblings (2 people in total). 9 ÷ 2 = 4.5 apples each. Each person gets 4 apples."
|
77 |
+
|
78 |
+
# feed a natural language prompt to generative model
|
79 |
+
prompt_template = """Please act as an impartial judge and evaluate the quality of the responses provided by two AI assistants to the user question displayed below. You should choose the assistant that follows the user\'s instructions and answers the user\'s question better.
|
80 |
+
Your evaluation should consider factors such as the helpfulness, relevance, accuracy, depth, creativity, and level of detail of their responses. Avoid any position biases and ensure that the order in which the responses were presented does not influence your decision. Do not allow the length of the responses to influence your evaluation. Do not favor certain names of the assistants. Be as objective as possible.
|
81 |
+
Please directly output your final verdict by strictly following this format: "[[A]]" if assistant A is better, "[[B]]" if assistant B is better.
|
82 |
+
|
83 |
+
[User Question]
|
84 |
+
{input}
|
85 |
+
|
86 |
+
[The Start of Assistant A's Answer]
|
87 |
+
{response_a}
|
88 |
+
[The End of Assistant A's Answer]
|
89 |
+
|
90 |
+
[The Start of Assistant B's Answer]
|
91 |
+
{response_b}
|
92 |
+
[The End of Assistant B's Answer]
|
93 |
+
"""
|
94 |
+
|
95 |
+
user_message = prompt_template.format(input=prompt, response_a=responseA, response_b=responseB)
|
96 |
+
|
97 |
+
conversation = [{"role": "user", "content": user_message}]
|
98 |
+
|
99 |
+
model_name = "Skywork/Skywork-Critic-Llama3.1-70B"
|
100 |
+
model = AutoModelForCausalLM.from_pretrained(
|
101 |
+
model_name,
|
102 |
+
torch_dtype="auto",
|
103 |
+
device_map="auto"
|
104 |
+
)
|
105 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
106 |
+
|
107 |
+
input_ids = tokenizer.apply_chat_template(
|
108 |
+
conversation,
|
109 |
+
tokenize=True,
|
110 |
+
add_generation_prompt=True,
|
111 |
+
return_tensors="pt").to(model.device)
|
112 |
+
|
113 |
+
generation = model.generate(
|
114 |
+
input_ids=input_ids,
|
115 |
+
max_new_tokens=2048,
|
116 |
+
do_sample=False,
|
117 |
+
pad_token_id=128009,
|
118 |
+
temperature=0)
|
119 |
+
|
120 |
+
completion = tokenizer.decode(
|
121 |
+
generation[0][len(input_ids[0]):],
|
122 |
+
skip_special_tokens=True,
|
123 |
+
clean_up_tokenization_spaces=True)
|
124 |
+
|
125 |
+
print(completion)
|
126 |
+
|
127 |
+
# Output:
|
128 |
+
# The generative model should output "[[A]]"
|
129 |
+
|
130 |
+
```
|
131 |
+
|
132 |
+
# Declaration and License Agreement
|
133 |
+
|
134 |
+
## Declaration
|
135 |
+
|
136 |
+
We hereby declare that the Skywork model should not be used for any activities that pose a threat to national or societal security or engage in unlawful actions. Additionally, we request users not to deploy the Skywork model for internet services without appropriate security reviews and records. We hope that all users will adhere to this principle to ensure that technological advancements occur in a regulated and lawful environment.
|
137 |
+
|
138 |
+
We have done our utmost to ensure the compliance of the data used during the model's training process. However, despite our extensive efforts, due to the complexity of the model and data, there may still be unpredictable risks and issues. Therefore, if any problems arise as a result of using the Skywork open-source model, including but not limited to data security issues, public opinion risks, or any risks and problems arising from the model being misled, abused, disseminated, or improperly utilized, we will not assume any responsibility.
|
139 |
+
|
140 |
+
## License Agreement
|
141 |
+
|
142 |
+
The community usage of Skywork model requires [Skywork Community License](https://github.com/SkyworkAI/Skywork-Reward/blob/main/misc/Skywork%20Community%20License.pdf). The Skywork model supports commercial use. If you plan to use the Skywork model or its derivatives for commercial purposes, you must abide by terms and conditions within [Skywork Community License](https://github.com/SkyworkAI/Skywork-Reward/blob/main/misc/Skywork%20Community%20License.pdf).
|
143 |
+
|
144 |
+
# Contact
|
145 |
+
If you have any questions or feedback, don't hesitate to reach out to our friendly team at <[email protected]> or <[email protected]>. Liang Zhao leads this project.
|
146 |
+
|
147 |
+
# Citation
|
148 |
+
|
149 |
+
If you find our work helpful, please feel free to cite us using the following BibTeX entry:
|
150 |
+
|
151 |
+
```bibtex
|
152 |
+
@misc{skyworkcritic2024,
|
153 |
+
title={Skywork Critic Model Series},
|
154 |
+
author={Shiwen, Tu and Liang, Zhao and Liu, Chris Yuhao and Zeng, Liang and Liu, Yang},
|
155 |
+
year={2024},
|
156 |
+
month={September},
|
157 |
+
howpublished={\url{https://huggingface.co/Skywork}},
|
158 |
+
url={https://huggingface.co/Skywork},
|
159 |
+
}
|
160 |
+
```
|
161 |
+
|