Dongfu Jiang commited on
Commit
3acf731
1 Parent(s): 58300f4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +142 -55
README.md CHANGED
@@ -1,7 +1,25 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
4
 
 
5
 
6
  ## TIGERScore
7
 
@@ -10,7 +28,13 @@ license: mit
10
 
11
  ## Introduction
12
 
13
- We present TIGERScore, a **T**rained metric that follows **I**nstruction **G**uidance to perform **E**xplainable, and **R**eference-free evaluation over a wide spectrum of text generation tasks. TIGERScore is guided by natural language instruction to provide error analysis to pinpoint the mistakes in the generated text. Our metric is based on LLaMA-2, trained on our meticulously curated instruction-tuning dataset MetricInstruct which covers 6 text generation tasks and 23 text generation datasets. As a reference-free metric, its correlation can even surpass the best existing reference-based metrics. To further qualitatively assess the rationale generated by our metric, we conduct human evaluation on the generated explanations and found that the explanations are 70.8% accurate. Through these experimental results, we believe TIGERScore demonstrates the possibility of building universal explainable metrics to evaluate any text generation task.
 
 
 
 
 
 
14
 
15
  ## Training Data
16
 
@@ -22,12 +46,73 @@ The models are fine-tuned with the MetricInstruct dataset using the original Lla
22
 
23
  ## Evaluation
24
 
25
- TIGERScore significantly surpasses traditional metrics, i.e. BLUE, ROUGE, BARTScore, and BLEURT, and emerging LLM-based metrics as reference-free metrics. Though our dataset was originally sourced from ChatGPT, our distilled model actually outperforms ChatGPT itself, which proves the effectiveness of our filtering strategy. On the unseen task of story generation, TIGERScore also demonstrates reasonable generalization capability.
26
-
27
- | Tasks→ | Summarization | Translation | Data2Text | Long-form QA | MathQA | Instruction Following | Story-Gen | Average |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  |-------------------------------------------|----------------|----------------|----------------|-----------------|----------------|----------------|----------------|----------------|
 
29
  | GPT-3.5-turbo (few-shot) | **38.50** | 40.53 | 40.20 | 29.33 | **66.46** | 23.20 | 4.77 | 34.71 |
30
  | GPT-4 (zero-shot) | 36.46 | **43.87** | **44.04** | **48.95** | 51.71 | **58.53** | **32.48** | **45.15** |
 
31
  | BLEU | 11.98 | 19.73 | 33.29 | 11.38 | 21.12 | **46.61** | -1.17 | 20.42 |
32
  | ROUGE-2f | 14.53 | 17.83 | 35.49 | 16.83 | 22.12 | 44.56 | 2.34 | 21.96 |
33
  | InstructScore | 26.33 | 47.30 | 43.93 | 21.62 | -4.15 | 16.19 | 16.13 | 23.91 |
@@ -38,6 +123,7 @@ TIGERScore significantly surpasses traditional metrics, i.e. BLUE, ROUGE, BARTSc
38
  | BLEURT | 17.30 | 48.41 | **48.76** | 33.26 | 3.53 | 36.46 | 27.52 | 30.75 |
39
  | UniEval(summ) | **47.52** | 21.90 | 38.38 | **41.83** | 19.78 | 16.02 | **44.46** | 32.84 |
40
  | COMET-22 | 33.75 | **56.35** | 33.92 | 35.28 | -5.53 | 46.13 | 39.20 | **34.16** |
 
41
  | BARTScore-para (src-hypo) | **38.68** | 9.60 | 32.26 | 26.86 | -2.70 | 5.92 | 20.55 | 18.74 |
42
  | BARTScore-cnn (src-hypo) | 35.50 | 12.83 | 34.33 | 40.96 | 1.50 | 25.43 | 33.48 | 26.29 |
43
  | Llama-2-13b-chat-0-shot | 28.53 | 14.38 | 29.24 | 19.91 | 1.08 | 21.37 | 26.78 | 20.18 |
@@ -46,68 +132,69 @@ TIGERScore significantly surpasses traditional metrics, i.e. BLUE, ROUGE, BARTSc
46
  | TIGERScore-7B (ours) | 35.11 | 41.50 | 42.39 | **47.11** | 21.23 | 43.57 | 39.26 | 38.60 |
47
  | TIGERScore-13B (ours) | 36.81 | 44.99 | **45.88** | 46.22 | **23.32** | **47.03** | **46.36** | **41.52** |
48
  | Δ (ours - best reference-free) | -2 | -3 | +12 | +5 | +9 | +14 | +13 | +16 |
 
49
 
50
- ## Formatting
51
 
 
52
 
53
- To format the data fields into a single prompt for finetuning or testing, We provide the following code for users to refer:
54
- ```python
55
- FINETUNE_INST = "You are evaluating errors in a model-generated output for a given instruction."
56
- FINETUNE_INPUT = """\
57
- Instruction: ${generation_instruction}
58
- ${input_context}
59
-
60
-
61
- Model-generated Output:
62
- ${hypothesis_output}
63
-
64
-
65
- For each error you give in the response, please also elaborate the following information:
66
- - error location (the words that are wrong in the output)
67
- - error aspect it belongs to.
68
- - explanation why it's an error, and the correction suggestions.
69
- - severity of the error ("Major" or "Minor").
70
- - reduction of score (between 0.5 and 5 given the severity of the error)
71
-
72
- Your evaluation output:
73
- """
74
- inst_part = Template(FINETUNE_INST)
75
- inst_part = inst_part.substitute(task=task)
76
- input_part = Template(FINETUNE_INPUT)
77
- input_part = input_part.substitute(
78
- generation_instruction=instruction,
79
- input_context=input_context,
80
- hypothesis_output=hypo_output
81
- )
82
- prompt = (inst_part + "\n" + input_part).strip("\n ") + "\n"
83
- encodings = tigerscore_tokenizer(prompt, return_tensors="pt")
84
- input_ids = encodings["input_ids"].to(tigerscore_model.device)
85
- attention_mask = encodings["attention_mask"].to(tigerscore_model.device)
86
  ```
87
 
88
- Example of formatted prompt:
89
- ```txt
90
- You are evaluating errors in a model-generated output for a given instruction.
91
- Instruction: Translate the following text from German to English.
92
- Der künftige EM-Cheforganisator Philipp Lahm soll laut Grindel im DFB-Präsidium mitarbeiten.
93
-
94
-
95
- Model-generated Output:
96
- According to Grindel, the future head of the European Championships, Philipp Lahm, is to participate in the DFB Presidency.
97
-
98
 
99
- For each error you give in the response, please also elaborate the following information:
100
- - error location (the words that are wrong in the output)
101
- - error aspect it belongs to.
102
- - explanation why it's an error, and the correction suggestions.
103
- - severity of the error ("Major" or "Minor").
104
- - reduction of score (between 0.5 and 5 given the severity of the error)
 
 
 
105
 
106
- Your evaluation output:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  ```
108
 
 
 
109
  ## Citation
110
 
 
111
  ```
112
  @article{jiang2023TIGERScore,
113
  title={TIGERScore: Towards Building Explainable Metric for All Text Generation Tasks},
 
1
  ---
2
  license: mit
3
+ datasets:
4
+ - TIGER-Lab/MetricInstruct
5
+ language:
6
+ - en
7
+ - zh
8
+ - ru
9
+ - cs
10
+ metrics:
11
+ - pearsonr
12
+ - spearmanr
13
+ pipeline_tag: text2text-generation
14
+ tags:
15
+ - Text Evaluation
16
+ - Metric
17
+ - LLM Metric
18
+ - LlamaCPP
19
+ - GGUF
20
  ---
21
 
22
+ This is the Llama.cpp 4-bit quantization version of [🤗TIGERScore-7B](https://huggingface.co/TIGER-Lab/TIGERScore-7B-V1.2) that is able to run on pure CPU devices.
23
 
24
  ## TIGERScore
25
 
 
28
 
29
  ## Introduction
30
 
31
+ We present TIGERScore, a **T**rained metric that follows **I**nstruction **G**uidance to perform **E**xplainable, and **R**eference-free evaluation over a wide spectrum of text generation tasks. Our metric is based on LLaMA-2, trained on our meticulously curated instruction-tuning dataset [MetricInstruct](https://huggingface.co/datasets/TIGER-Lab/MetricInstruct) which covers 6 text generation tasks and 23 text generation datasets.
32
+
33
+ Existing automatic metrics are lagging and suffer from issues like 1) **Dependency on references**, 2) **Limited to specific domains**, 3) **Lack of attribution**. Contrary to them, TIGERScore is designed to be driven by natural language instruction and provide detailed error analysis to pinpoint the mistakes in the generated text.
34
+
35
+ Specifically, TIGERScore takes an instruction, an associated input context along with a hypothesis output that might contain errors. Then, TIGERScore will evaluate this hypothesis output and list several errors, each consisting of the error location, aspect, explanation and penalty scores (score reduced, starting from 0). The sum of the reduced scores is taken as the overall rating of this output.
36
+
37
+ As a reference-free metric, its correlation can even surpass the best existing reference-based metrics. We believe TIGERScore demonstrates the possibility of building universal explainable metrics to evaluate any text generation task.
38
 
39
  ## Training Data
40
 
 
46
 
47
  ## Evaluation
48
 
49
+ Experiments show that TIGERScore surpasses existing baseline metrics in correlation with human ratings on all 6 held-in tasks and 1 held-out task, achiving the highest overall performance. We hope the emergence of TIGERScore can promote the research in the LLM community as a powerful, interpretable, and easy-to-use metric.
50
+
51
+ ### Kendall Results
52
+ | Tasks⟶ | Summarization | Translation | Data2Text | Long-form QA | MathQA | Instruction Following | Story-Gen | Average |
53
+ |----------------------------------------|-----------|-----------|-----------------|-----------|-----------|-----------|-----------|-----------|
54
+ | | | | GPT-based | Metrics | | | | |
55
+ | GPT-3.5-turbo (few-shot) | **30.45** | 32.3 | 30.38 | 20.91 | **58.57** | 17.73 | 3.26 | 27.65 |
56
+ | GPT-4 (zero-shot) | 29.32 | **35.38** | **32.26** | **35.85** | 46.63 | **49.5** | **25.69** | **36.38** |
57
+ | | | | Reference-based | Metrics | | | | |
58
+ | BLEU | 8.71 | 14.5 | 23.13 | 7.73 | 17.25 | 35.92 | -0.89 | 15.19 |
59
+ | ROUGE-2f | 10.67 | 13.19 | 24.74 | 11.73 | 18.07 | 34.59 | 1.78 | 16.4 |
60
+ | InstructScore | 20.86 | 40.44 | 30.21 | 15.64 | -3.87 | 13.87 | 13.5 | 18.66 |
61
+ | GPTScore-ref | 10.8 | 18.74 | 27.47 | 22.13 | 14.86 | 25.4 | 12.78 | 18.88 |
62
+ | BARTScore-cnn (hypo-ref) | 10 | 21.06 | 27.04 | 20.67 | **19.07** | 24.7 | 18.58 | 20.16 |
63
+ | BARTScore-para (hypo-ref) | 10.41 | 24.9 | 28.42 | 20.24 | 14.1 | 26.13 | 12.11 | 19.47 |
64
+ | BERTScore | 17.39 | 31.57 | 30.74 | 17.7 | 9.41 | 35.61 | 2 | 20.63 |
65
+ | BLEURT | 12.69 | 36.12 | **34.48** | 23.11 | 2.88 | 27.94 | 19.18 | 22.34 |
66
+ | UniEval (summ) | **35.89** | 16.08 | 28.56 | **29.32** | 16.15 | 11.93 | **31.22** | 24.17 |
67
+ | COMET-22 | 25.01 | **42.79** | 23.43 | 24.66 | -4.52 | **36.17** | 27.52 | **25.01** |
68
+ | | | | Reference-free |Metrics | | | | |
69
+ | BARTScore-para (src-hypo) | 29.12 | 7.01 | 22.32 | 18.8 | -2.21 | 4.26 | 14.15 | 13.35 |
70
+ | BARTScore-cnn (src-hypo) | 26.63 | 9.4 | 23.69 | 28.93 | 1.23 | 19.09 | 23.29 | 18.89 |
71
+ | Llama-2-13b-chat-0-shot | 25.22 | 11.79 | 23.45 | 15.96 | 1.08 | 19.5 | 21.52 | 16.93 |
72
+ | COMETKiwi | 11.87 | 36.37 | 19.08 | 12.23 | -9.38 | 26.46 | 12.78 | 15.63 |
73
+ | GPTScore-src | 28.2 | 6.5 | 19.81 | 27.64 | 11.64 | 20.04 | 16.36 | 18.6 |
74
+ | TigerScore-7B | 28.79 | 33.65 | 32.44 | 33.93 | 19.98 | 38.13 | 29.72 | 30.95 |
75
+ | TigerScore-13B | **31.29** | **36.5** | **36.43** | **33.17** | **21.58** | **41.84** | **35.33** | **33.73** |
76
+ | ∆ (ours - best reference-free) | +2 | +0 | +13 | +4 | +10 | +15 | +14 | +15 |
77
+ | ∆ (ours - best reference-based) | -4 | -6 | +2 | +4 | +2 | +5 | +4 | +8 |
78
+
79
+ ### Pearson Results
80
+
81
+ | Tasks⟶ | Summarization | Translation | Data2Text | Long-form QA | MathQA | Instruction Following | Story-Gen | Average |
82
+ |-------------------------------|-----------|-----------|-----------------|-----------|-----------|-----------|-----------|-----------|
83
+ | | | | GPT-based | Metrics | | | | |
84
+ | GPT-3.5-turbo (few-shot) | **45.53** | **43.77** | **47.76** | 29.84 | **61.26** | 15.36 | 7.8 | 35.9 |
85
+ | GPT-4 (zero-shot) | 40.75 | 33.92 | 46.83 | **49.3** | 54.98 | **60.45** | **37.74** | **46.28** |
86
+ | | | | Reference-based | Metrics | | | | |
87
+ | BLEU | 11.66 | 17.47 | 34.29 | 18.21 | 18.12 | 29.47 | -0.64 | 18.37 |
88
+ | ROUGE-2f | 16.03 | 16.26 | 35.85 | 19.66 | 20.69 | 33.49 | 2.88 | 20.69 |
89
+ | InstructScore | 27.4 | 51.55 | 47.28 | 20.59 | 0.36 | 20.98 | 12.81 | 25.85 |
90
+ | GPTScore-ref | 13.47 | 21.05 | 48.7 | 33.4 | 18.22 | 29.66 | 18.94 | 26.2 |
91
+ | BARTScore-cnn (hypo-ref) | 16.67 | 23.56 | 45.08 | 32.78 | **23.09** | 26.57 | 27.61 | 27.91 |
92
+ | BARTScore-para (hypo-ref) | 19.73 | 29.04 | 47.89 | 32.7 | 17.33 | 30.2 | 17.76 | 27.81 |
93
+ | BERTScore | 26.26 | 37.65 | 48.22 | 26.39 | 11.19 | 45.58 | 4.08 | 28.48 |
94
+ | BLEURT | 17.27 | 43 | **54.32** | 34.26 | 3.98 | 39.15 | 27.89 | 31.41 |
95
+ | UniEval (summ) | **53.22** | 23.11 | 51.14 | **36.95** | 17.69 | 30.87 | **44.88** | 36.84 |
96
+ | COMET-22 | 35.32 | **58.46** | 43.82 | 36.79 | -5.58 | **49.68** | 40.12 | **36.94** |
97
+ | | | | Reference-free | Metrics | | | | |
98
+ | BARTScore-para (src-hypo) | 43.11 | 6.96 | 37.82 | 29.86 | -0.41 | 19.37 | 19.99 | 22.38 |
99
+ | BARTScore-cnn (src-hypo) | 39.72 | 9.53 | 45.43 | 41.48 | 3.28 | 34.97 | 33.51 | 29.7 |
100
+ | Llama-2-13b-chat-0-shot | 29.59 | 9.09 | 41.32 | 21.67 | 2.8 | 22.71 | 21.13 | 21.19 |
101
+ | COMETKiwi | 14.22 | **50.91** | 23.63 | 22.59 | -13.35 | 34.46 | 19.12 | 21.65 |
102
+ | GPTScore-src | 41.71 | 6.82 | 41.19 | 39.79 | 13.99 | 27.59 | 23.22 | 27.76 |
103
+ | TigerScore-7B | 43.95 | 37.7 | 49.13 | **46.1** | 21.77 | 38.26 | 39.9 | 39.54 |
104
+ | TigerScore-13B | **44.21** | 41.54 | **52.87** | 44.76 | **24.41** | **47.52** | **47.66** | **43.28** |
105
+ | ∆ (ours - best reference-free) | +1 | -9 | +7 | +5 | +10 | +20 | +14 | +13 |
106
+ | ∆ (ours - best reference-based) | -9 | -17 | -2 | +9 | +1 | -2 | +3 | +6 |
107
+
108
+ ### Spearman Results
109
+
110
+ | Tasks⟶ | Summarization | Translation | Data2Text | Long-form QA | MathQA | Instruction Following | Story-Gen | Average |
111
  |-------------------------------------------|----------------|----------------|----------------|-----------------|----------------|----------------|----------------|----------------|
112
+ | | | | GPT-based | Metrics | | | | |
113
  | GPT-3.5-turbo (few-shot) | **38.50** | 40.53 | 40.20 | 29.33 | **66.46** | 23.20 | 4.77 | 34.71 |
114
  | GPT-4 (zero-shot) | 36.46 | **43.87** | **44.04** | **48.95** | 51.71 | **58.53** | **32.48** | **45.15** |
115
+ | | | | Reference-based | Metrics | | | | |
116
  | BLEU | 11.98 | 19.73 | 33.29 | 11.38 | 21.12 | **46.61** | -1.17 | 20.42 |
117
  | ROUGE-2f | 14.53 | 17.83 | 35.49 | 16.83 | 22.12 | 44.56 | 2.34 | 21.96 |
118
  | InstructScore | 26.33 | 47.30 | 43.93 | 21.62 | -4.15 | 16.19 | 16.13 | 23.91 |
 
123
  | BLEURT | 17.30 | 48.41 | **48.76** | 33.26 | 3.53 | 36.46 | 27.52 | 30.75 |
124
  | UniEval(summ) | **47.52** | 21.90 | 38.38 | **41.83** | 19.78 | 16.02 | **44.46** | 32.84 |
125
  | COMET-22 | 33.75 | **56.35** | 33.92 | 35.28 | -5.53 | 46.13 | 39.20 | **34.16** |
126
+ | | | | Reference-free | Metrics | | | | |
127
  | BARTScore-para (src-hypo) | **38.68** | 9.60 | 32.26 | 26.86 | -2.70 | 5.92 | 20.55 | 18.74 |
128
  | BARTScore-cnn (src-hypo) | 35.50 | 12.83 | 34.33 | 40.96 | 1.50 | 25.43 | 33.48 | 26.29 |
129
  | Llama-2-13b-chat-0-shot | 28.53 | 14.38 | 29.24 | 19.91 | 1.08 | 21.37 | 26.78 | 20.18 |
 
132
  | TIGERScore-7B (ours) | 35.11 | 41.50 | 42.39 | **47.11** | 21.23 | 43.57 | 39.26 | 38.60 |
133
  | TIGERScore-13B (ours) | 36.81 | 44.99 | **45.88** | 46.22 | **23.32** | **47.03** | **46.36** | **41.52** |
134
  | Δ (ours - best reference-free) | -2 | -3 | +12 | +5 | +9 | +14 | +13 | +16 |
135
+ | ∆ (ours - best reference-based) | -9 | -11 | -3 | +5 | -0 | +0 | +2 | +7 |
136
 
137
+ ## Usage
138
 
139
+ TIGERScore can be easily loaded in 2 lines of codes, and provides a friendly scoring interface function.
140
 
141
+ To use TIGERScore, first install `tigerscore` with
142
+ ```bash
143
+ pip install git+https://github.com/TIGER-AI-Lab/TIGERScore.git
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  ```
145
 
146
+ Then load the tigerscore model variates according to you needs.
147
+ ```python
148
+ # set up scorer
149
+ from tigerscore import TIGERScorer
150
+ scorer = TIGERScorer(model_name="TIGER-Lab/TIGERScore-7B-GGUF", use_llamacpp=True) # 4 bit quantization on CPU
151
+ # scorer = TIGERScorer(model_name="TIGER-Lab/TIGERScore-7B") # on GPU
152
+ # scorer = TIGERScorer(model_name="TIGER-Lab/TIGERScore-7B", quantized=True) # 4 bit quantization on GPU
153
+ # scorer = TIGERScorer(model_name="TIGER-Lab/TIGERScore-7B", use_vllm=True) # VLLM on GPU, Recommended for faster evaluation (0.2s per instance)
154
+ ```
 
155
 
156
+ After loading, you can easily get errors of the provided **hypothesis output** given the **instruction** and **input context**
157
+ ```python
158
+ # example
159
+ instruction = "Write an apology letter."
160
+ input_context = "Reason: You canceled a plan at the last minute due to illness."
161
+ hypo_output = "Hey [Recipient],\n\nI'm really sorry for ditching our plan. I suddenly got an opportunity for a vacation so I took it. I know this might have messed up your plans and I regret that.\n\nDespite being under the weather, I would rather go for an adventure. I hope you can understand my perspective and I hope this incident doesn't change anything between us.\n\nWe can reschedule our plan for another time. Sorry again for the trouble.\n\nPeace out,\n[Your Name]\n\n---"
162
+ results = scorer.score([instruction], [hypo_output], [input_context])
163
+ print(results)
164
+ ```
165
 
166
+ Results are a list of errors with detailed explanations and reasonable penalty scores:
167
+ ```json
168
+ [
169
+ {
170
+ "num_errors": 2,
171
+ "score": -7.0,
172
+ "errors": {
173
+ "error_0": {
174
+ "location": " \"I suddenly got an opportunity for a vacation so I took it.\"",
175
+ "aspect": " Misunderstanding context",
176
+ "explanation": " The error lies in the context of the reason for cancelling the plan. The original reason was due to illness, but in the incorrect output, it is stated that the cancellation was due to a vacation opportunity, which is a misunderstanding of the context. The correction would be to stick to the original reason for cancelling.",
177
+ "severity": "Major",
178
+ "score_reduction": "5.0"
179
+ },
180
+ "error_1": {
181
+ "location": " \"I hope you can understand my perspective and I hope this incident doesn't change anything between us.\"",
182
+ "aspect": " Inappropriate tone",
183
+ "explanation": " The tone of this sentence is too casual and lacks regret or apology. It's important to maintain a formal and regretful tone in an apology letter. The sentence could be corrected to something like \"I hope you can find it in your heart to forgive me and let this incident not strain our relationship.\"",
184
+ "severity": "Minor",
185
+ "score_reduction": "2.0"
186
+ }
187
+ },
188
+ "raw_output": " The model-generated output contains 2 errors, with a total score reduction of 7.0.\nError location 1: ..."
189
+ }
190
+ ]
191
  ```
192
 
193
+ Check more usage at our [Github Usage Doc](https://github.com/TIGER-AI-Lab/TIGERScore#usage). Have Fun!
194
+
195
  ## Citation
196
 
197
+ If you find our work useful, please cite our paper:
198
  ```
199
  @article{jiang2023TIGERScore,
200
  title={TIGERScore: Towards Building Explainable Metric for All Text Generation Tasks},