Skip to content

Commit aac65c9

Browse files
Clean freebase_qa, craigslist_bargains, health_fact, hyperpartisan_news_detection (#660)
* Added metrics to all tasks. Reduced original task assignment to minimal closed book QA prompt * Updated all QA prompts to indicate original task * craigslist_bargins: - updated non-original tasks to use answer choices and added accuracy as the metric - some prompts generate a lot of extra whitespace, which I assume can be dealt with in preprocessing health_fact: - added answer choices and metrics to relevant prompts - cleaned up prompt names * hyperpartisan_news_detection (byarticle, bypublisher): - cleaned up prompt names (they are all paraphrases of the same prompt) - added metrics and answer_choices to prompts * Fix choices format in prompt for craigslist_bargain. * Clean health_fact. * Clean hyperpartisan by article. * Rename prompts for hyperpartisan by publisher. Co-authored-by: Stephen Bach <stephenhbach@gmail.com>
1 parent 415a493 commit aac65c9

File tree

5 files changed

+197
-191
lines changed

5 files changed

+197
-191
lines changed

promptsource/templates/craigslist_bargains/templates.yaml

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dataset: craigslist_bargains
22
templates:
33
145dd841-b971-4550-bc88-305ad3278d58: !Template
4-
answer_choices: null
4+
answer_choices: good ||| bad ||| incomplete
55
id: 145dd841-b971-4550-bc88-305ad3278d58
66
jinja: 'The following conversation is a negotiation on craigslist. The first speaker
77
is the buyer, and the second speaker is the seller.
@@ -33,32 +33,33 @@ templates:
3333
3434
{% if final_price == -1 %}
3535
36-
incomplete
36+
{{answer_choices[2]}}
3737
3838
{% elif ((final_price - agent_info["Target"][0]) | abs) == ((final_price - agent_info["Target"][1])
3939
| abs) %}
4040
41-
good
41+
{{answer_choices[0]}}
4242
4343
{% elif ((final_price - agent_info["Target"][0]) | abs) < ((final_price - agent_info["Target"][1])
4444
| abs) %}
4545
46-
bad
46+
{{answer_choices[1]}}
4747
4848
{% elif ((final_price - agent_info["Target"][0]) | abs) > ((final_price - agent_info["Target"][1])
4949
| abs) %}
5050
51-
good
51+
{{answer_choices[0]}}
5252
5353
{% endif %}'
5454
metadata: !TemplateMetadata
55-
choices_in_prompt: null
56-
metrics: []
55+
choices_in_prompt: false
56+
metrics:
57+
- Accuracy
5758
original_task: false
5859
name: good deal for seller no list price implicit
5960
reference: implicit version of "good deal for seller no list price"
6061
27010b55-dd5b-4ee9-9e14-a4b809aa6cdb: !Template
61-
answer_choices: null
62+
answer_choices: yes ||| no ||| unknown
6263
id: 27010b55-dd5b-4ee9-9e14-a4b809aa6cdb
6364
jinja: 'The following conversation is a negotiation on craigslist. The first speaker
6465
is the buyer, and the second speaker is the seller.
@@ -67,7 +68,8 @@ templates:
6768
{{utterance | join("\n\n")}}
6869
6970
70-
Was this a good deal for the seller? answer "yes", "no", or "unknown".
71+
Was this a good deal for the seller? answer "{{answer_choices[0]}}", "{{answer_choices[1]}}",
72+
or "{{answer_choices[2]}}".
7173
7274
|||
7375
@@ -90,27 +92,28 @@ templates:
9092
9193
{% if final_price == -1 %}
9294
93-
unknown
95+
{{answer_choices[2]}}
9496
9597
{% elif ((final_price - agent_info["Target"][0]) | abs) == ((final_price - agent_info["Target"][1])
9698
| abs) %}
9799
98-
yes
100+
{{answer_choices[0]}}
99101
100102
{% elif ((final_price - agent_info["Target"][0]) | abs) < ((final_price - agent_info["Target"][1])
101103
| abs) %}
102104
103-
no
105+
{{answer_choices[1]}}
104106
105107
{% elif ((final_price - agent_info["Target"][0]) | abs) > ((final_price - agent_info["Target"][1])
106108
| abs) %}
107109
108-
yes
110+
{{answer_choices[1]}}
109111
110112
{% endif %}'
111113
metadata: !TemplateMetadata
112-
choices_in_prompt: null
113-
metrics: []
114+
choices_in_prompt: true
115+
metrics:
116+
- Accuracy
114117
original_task: false
115118
name: good deal for seller no list price
116119
reference: same as "good deal for seller" prompt, but excludes the list price
@@ -130,14 +133,15 @@ templates:
130133
131134
${{(agent_info[''Target''][0] - agent_info[''Target''][1]) | abs}}0'
132135
metadata: !TemplateMetadata
133-
choices_in_prompt: null
134-
metrics: []
136+
choices_in_prompt: false
137+
metrics:
138+
- Other
135139
original_task: false
136140
name: gap between parties
137141
reference: asks model explicitly what the gap was between the buyer's target and
138142
the seller's target
139143
78d1b487-c535-4a0d-ae49-055d321db3fd: !Template
140-
answer_choices: null
144+
answer_choices: yes ||| no ||| unknown
141145
id: 78d1b487-c535-4a0d-ae49-055d321db3fd
142146
jinja: 'The following conversation is a negotiation on craigslist. The first speaker
143147
is the buyer, and the second speaker is the seller. The listed price was ${{items["Price"][0]}}.
@@ -146,7 +150,8 @@ templates:
146150
{{utterance | join("\n\n")}}
147151
148152
149-
Was this a good deal for the seller? Answer "yes" or "no", or "unknown".
153+
Was this a good deal for the seller? Answer "{{answer_choices[0]}}" or "{{answer_choices[1]}}",
154+
or "{{answer_choices[2]}}".
150155
151156
|||
152157
@@ -169,51 +174,51 @@ templates:
169174
170175
{% if final_price == -1 %}
171176
172-
unknown
177+
{{answer_choices[2]}}
173178
174179
{% elif ((final_price - agent_info["Target"][0]) | abs) == ((final_price - agent_info["Target"][1])
175180
| abs) %}
176181
177-
yes
182+
{{answer_choices[0]}}
178183
179184
{% elif ((final_price - agent_info["Target"][0]) | abs) < ((final_price - agent_info["Target"][1])
180185
| abs) %}
181186
182-
no
187+
{{answer_choices[1]}}
183188
184189
{% elif ((final_price - agent_info["Target"][0]) | abs) > ((final_price - agent_info["Target"][1])
185190
| abs) %}
186191
187-
yes
192+
{{answer_choices[0]}}
188193
189194
{% endif %}'
190195
metadata: !TemplateMetadata
191-
choices_in_prompt: null
192-
metrics: []
196+
choices_in_prompt: true
197+
metrics:
198+
- Accuracy
193199
original_task: false
194200
name: good deal for seller
195201
reference: asks the model whether the deal was good for the seller or not (it's
196202
good if the seller's target is closer to the final price than the buyer's, or
197203
there is a tie)
198204
a1dbb258-2e5c-4160-986b-46fc03546965: !Template
199-
answer_choices: null
205+
answer_choices: buyer ||| seller ||| neither ||| unknown
200206
id: a1dbb258-2e5c-4160-986b-46fc03546965
201207
jinja: 'The following conversation is a negotiation on craigslist. The first speaker
202208
is the buyer, and the second speaker is the seller. The listed price was ${{items["Price"][0]}}.
203209
204210
205211
{{utterance | join("\n\n")}}
206212
207-
208213
Question: Which party got the better deal? Choose from:
209214
210-
a) the buyer
215+
- {{answer_choices[0]}}
211216
212-
b) the seller
217+
- {{answer_choices[1]}}
213218
214-
c) neither - it is a fair compromise
219+
- {{answer_choices[2]}}
215220
216-
d) unknown
221+
- {{answer_choices[3]}}
217222
218223
219224
Answer:
@@ -239,27 +244,28 @@ templates:
239244
240245
{% if final_price == -1 %}
241246
242-
d) unknown
247+
{{answer_choices[3]}}
243248
244249
{% elif ((final_price - agent_info["Target"][0]) | abs) == ((final_price - agent_info["Target"][1])
245250
| abs) %}
246251
247-
c) neither - it is a fair compromise
252+
{{answer_choices[2]}}
248253
249254
{% elif ((final_price - agent_info["Target"][0]) | abs) < ((final_price - agent_info["Target"][1])
250255
| abs) %}
251256
252-
a) the buyer
257+
{{answer_choices[0]}}
253258
254259
{% elif ((final_price - agent_info["Target"][0]) | abs) > ((final_price - agent_info["Target"][1])
255260
| abs) %}
256261
257-
b) the seller
262+
{{answer_choices[1]}}
258263
259264
{% endif %}'
260265
metadata: !TemplateMetadata
261-
choices_in_prompt: null
262-
metrics: []
266+
choices_in_prompt: true
267+
metrics:
268+
- Accuracy
263269
original_task: false
264270
name: best deal
265271
reference: explicitly asks model which party got the best deal
@@ -269,11 +275,14 @@ templates:
269275
jinja: 'The following conversation is a negotiation on craigslist. The first speaker
270276
is the buyer, and the second speaker is the seller.
271277
278+
272279
{% set nonempty_utterance = [] %}
273280
274-
{% for line in utterance %}
281+
{% for line in utterance %}
282+
283+
{% if line != "" %}
275284
276-
{% if line != "" %}{{ nonempty_utterance.append(line) or ""}}
285+
{{ nonempty_utterance.append(line) or "" }}
277286
278287
{% endif %}
279288
@@ -291,8 +300,9 @@ templates:
291300
292301
{{nonempty_utterance[-1]}}'
293302
metadata: !TemplateMetadata
294-
choices_in_prompt: null
295-
metrics: []
303+
choices_in_prompt: false
304+
metrics:
305+
- Other
296306
original_task: true
297307
name: generate line
298308
reference: Generates the next line of negotiation

promptsource/templates/freebase_qa/templates.yaml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ templates:
1212
\ %}\n{{answer.AnswersName[0][0].split(\" \") | map(\"capitalize\") | join(\"\
1313
\ \") }}"
1414
metadata: !TemplateMetadata
15-
choices_in_prompt: null
16-
metrics: []
17-
original_task: false
15+
choices_in_prompt: false
16+
metrics:
17+
- Accuracy
18+
original_task: true
1819
name: qa_context_2
1920
reference: qa prompt with topic and inference chain provided
2021
1d583b71-7ef1-49df-b252-e8e1d6910129: !Template
@@ -33,8 +34,9 @@ templates:
3334
3435
'
3536
metadata: !TemplateMetadata
36-
choices_in_prompt: null
37-
metrics: []
37+
choices_in_prompt: false
38+
metrics:
39+
- Accuracy
3840
original_task: false
3941
name: inference_chain_prompt
4042
reference: predicting the inference chain given just the question
@@ -45,8 +47,9 @@ templates:
4547
\ = Parses.Answers | choice %}\n{{answer.AnswersName[0][0].split(\" \") | map(\"\
4648
capitalize\") | join(\" \") }}"
4749
metadata: !TemplateMetadata
48-
choices_in_prompt: null
49-
metrics: []
50+
choices_in_prompt: false
51+
metrics:
52+
- Accuracy
5053
original_task: true
5154
name: qa_template_basic
5255
reference: basic question/answer format
@@ -59,8 +62,9 @@ templates:
5962
\ \n{% set answer = Parses.Answers | choice %}\n{{answer.AnswersName[0][0].split(\"\
6063
\ \") | map(\"capitalize\") | join(\" \") }}"
6164
metadata: !TemplateMetadata
62-
choices_in_prompt: null
63-
metrics: []
65+
choices_in_prompt: false
66+
metrics:
67+
- Accuracy
6468
original_task: true
6569
name: qa_context_1
6670
reference: qa question with simple entity context
@@ -73,8 +77,9 @@ templates:
7377
\ }}\"? \n||| \n{% set a = Parses.InferentialChain | first %}\n{{ a.split(\"\
7478
.\") | last | capitalize | replace(\"_\", \" \")}}\n"
7579
metadata: !TemplateMetadata
76-
choices_in_prompt: null
77-
metrics: []
80+
choices_in_prompt: false
81+
metrics:
82+
- Accuracy
7883
original_task: false
7984
name: inference_chain_prompt_context
8085
reference: determine the inference chain between question and answer

0 commit comments

Comments
 (0)