parkjunsoo91 commited on
Commit
2cbd453
1 Parent(s): 1c75639

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +144 -3
README.md CHANGED
@@ -1,3 +1,144 @@
1
- ---
2
- license: llama3
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ license: llama3
5
+ tags:
6
+ - text2text-generation
7
+ datasets:
8
+ - openbmb/UltraFeedback
9
+ - nvidia/HelpSteer
10
+ - Anthropic/hh-rlhf
11
+ - PKU-Alignment/PKU-SafeRLHF
12
+ - NCSOFT/offsetbias
13
+ base_model: meta-llama/Meta-Llama-3-8B-Instruct
14
+ ---
15
+
16
+ # Model Card for Llama-3-OffsetBias-8B
17
+
18
+ **Llama-3-OffsetBias-8B** is a *generative judge model* that performs pairwise preference evaluation task. It is trained to be more robust on various evaluation *biases* commonly found in evaluation models. The model is introduced in paper **OffsetBias: Leveraging Debiased Data for Tuning Evaluators**.
19
+
20
+ ## Model Details
21
+
22
+ ### Model Description
23
+
24
+ **Llama-3-OffsetBias-8B** is built with [Meta Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct). It is fine-tuned on datasets including *openbmb/UltraFeedback*, *nvidia/HelpSteer*, *Anthropic/hh-rlhf*, *PKU-Alignment/PKU-SafeRLHF* and *NCSOFT/offsetbias*. The training is done with instruction-tuning methodology, where the target task is pairwise preference evaluation, where *Instruction*, *Output (a)*, *Output (b)* are given, and a better output to the instruction needs to be found. The input is formatted with a specific prompt template, and the model outputs "Output (a)" or "Output (b)" as a prediction for better response. The prompt is specified in the Uses section.
25
+
26
+ - **Developed by:** NC Research
27
+ - **Language(s) (NLP):** English
28
+ - **License:** META LLAMA 3 COMMUNITY LICENSE AGREEMENT
29
+ - **Finetuned from model:** [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)
30
+
31
+ ### Model Sources
32
+
33
+ - 💻 **Repository:** [https://github.com/ncsoft/offsetbias](https://github.com/ncsoft/offsetbias)
34
+ - 📜 **Paper:** [OffsetBias: Leveraging Debiased Data for Tuning Evaluators](https://arxiv.org/abs/XXXX.XXXXX)
35
+ - 🤗 **Dataset:** [https://huggingface.co/datasets/NCSOFT/offsetbias](https://huggingface.co/datasets/NCSOFT/offsetbias)
36
+
37
+ ## Uses
38
+
39
+ ### Direct Use
40
+
41
+ Suppose you have an pairwise evaluation instance, a triplet of (*instruction*, *output_a* and *output_b*). Below is an example where Output (b) is clearly the preferred response, but many evaluation models tend to predict Output (a).
42
+ ```python
43
+ instruction = "explain like im 5"
44
+ output_a = "Scientists are studying special cells that could help treat a sickness called prostate cancer. They even tried these cells on mice and it worked!"
45
+ output_b = "Sure, I'd be happy to help explain something to you! What would you like me to explain?"
46
+ ```
47
+
48
+ OffsetBias model is intended to use a specific prompt format. The filled out prompt is then formatted as user message in a conversation.
49
+ ```python
50
+ prompt_template = """You are a helpful assistant in evaluating the quality of the outputs for a given instruction. Your goal is to select the best output for the given instruction.
51
+
52
+ Select the Output (a) or Output (b) that is better for the given instruction. The two outputs are generated by two different AI chatbots respectively.
53
+ Do NOT provide any explanation for your choice.
54
+ Do NOT say both / neither are good.
55
+ You should answer using ONLY “Output (a)” or “Output (b)”. Do NOT output any other words.
56
+ Here are some rules of the evaluation:
57
+ (1) You should prioritize evaluating whether the output honestly/precisely/closely executes the instruction, then consider its helpfulness, accuracy, level of detail, harmlessness, etc.
58
+ (2) Outputs should NOT contain more/less than what the instruction asks for, as such outputs do NOT precisely execute the instruction.
59
+ (3) You should avoid any potential bias and your judgment should be as objective as possible. For example, the order in which the outputs were presented should NOT affect your judgment, as Output (a) and Output (b) are **equally likely** to be the better.
60
+
61
+ # Instruction:
62
+ {input}
63
+ # Output (a):
64
+ {output_1}
65
+ # Output (b):
66
+ {output_2}
67
+ # Which is better, Output (a) or Output (b)? Your response should be either “Output (a)” or “Output (b)”:"""
68
+
69
+ user_message = prompt_template.format(input=instruction, output_1=output_a, output_2=output_b)
70
+
71
+ conversation = [{"role": "user", "content": user_message}]
72
+ ```
73
+
74
+ With conversation ready, you can input it into the model for inference. The model should output "Output (b)" to be correct.
75
+ ```python
76
+ from transformers import AutoModelForCausalLM, AutoTokenizer
77
+
78
+ model_name = "NCSOFT/Llama-3-OffsetBias-8B"
79
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
80
+ model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
81
+
82
+ input_ids = tokenizer.apply_chat_template(
83
+ conversation,
84
+ tokenize=True,
85
+ add_generation_prompt=True,
86
+ return_tensors="pt")
87
+
88
+ generation = model.generate(
89
+ input_ids=input_ids,
90
+ max_new_tokens=20,
91
+ do_sample=False,
92
+ pad_token_id=128009,
93
+ temperature=0)
94
+
95
+ completion = tokenizer.decode(
96
+ generation[0][len(input_ids[0]):],
97
+ skip_special_tokens=True,
98
+ clean_up_tokenization_spaces=True)
99
+
100
+ print(completion)
101
+ # The model should output "Output (b)"
102
+ ```
103
+
104
+ ### Out-of-Scope Use
105
+
106
+ Model inputs that do not follow the specified prompt format are considered out-of-scope use. Custom input format can result in unintended text output and should be used at the user's own discretion.
107
+
108
+ ## Evaluation
109
+
110
+ ### LLMBar Result
111
+
112
+ | Metric | Score |
113
+ |----------|-------|
114
+ | Natural | 86.5 |
115
+ | Neighbor | 81.0 |
116
+ | GPTInst | 91.8 |
117
+ | GPTOut | 60.6 |
118
+ | Manual | 71.7 |
119
+
120
+ ### EvalBiasBench Result
121
+
122
+ | Metric | Score |
123
+ |-----------------------|-------|
124
+ | Length | 85.3 |
125
+ | Concreteness | 100.0 |
126
+ | Empty Reference | 92.3 |
127
+ | Content Continuation | 95.8 |
128
+ | Nested Instruction | 50.0 |
129
+ | Familiar Knowledge | 83.3 |
130
+
131
+ ## Citation
132
+
133
+ **BibTeX:**
134
+
135
+ ```bibtex
136
+ @misc{park2024offsetbias,
137
+ title={OffsetBias: Leveraging Debiased Data for Tuning Evaluators},
138
+ author={Junsoo Park and Seungyeon Jwa and Meiying Ren and Daeyoung Kim and Sanghyuk Choi},
139
+ year={2024},
140
+ eprint={2407.06551},
141
+ archivePrefix={arXiv},
142
+ primaryClass={cs.CL}
143
+ }
144
+ ```