Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clue prompt templates #808

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions promptsource/templates/clue/afqmc/templates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
dataset: clue
subset: afqmc
templates:
997437fd-6888-482d-95e9-ffd867b497ee: !Template
answer_choices: no ||| yes
id: 997437fd-6888-482d-95e9-ffd867b497ee
jinja: 'Do "{{ sentence1 }}" and "{{ sentence2 }}" express the same thing?

|||

{{ answer_choices[label] }}'
Comment on lines +7 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stupid question: How does this generate samples exactly? in particular with \n and whitespaces in the beginning and the end? Does it get trimmed all the time?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the \n and whitespaces before & after ||| get trimmed away

metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- Accuracy
original_task: true
name: express_same_yes_no
reference: ''
a28370c0-d43b-405c-a9b1-4d77b3a27244: !Template
answer_choices: no ||| yes
id: a28370c0-d43b-405c-a9b1-4d77b3a27244
jinja: "\"{{ sentence1 }}\" and \"{{ sentence2 }}\" have the same meaning. Would\
\ you agree? Answer yes or no. \n|||\n{{ answer_choices[label] }}"
metadata: !TemplateMetadata
choices_in_prompt: true
languages:
- zh
metrics:
- Accuracy
original_task: true
name: same_meaning_agree
reference: ''
d8c303a6-61a4-47f9-8623-cc72cc3294eb: !Template
answer_choices: null
id: d8c303a6-61a4-47f9-8623-cc72cc3294eb
jinja: 'Generate another sentence that has the same meaning as "{{ sentence1 }}".

|||

{% if label == 1 %}

{{ sentence2}}

{% endif %}'
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- ROUGE
original_task: false
name: generate_similar_sentence
reference: ''
e3fcaefd-4e8e-4491-aab7-8efeb67a2909: !Template
answer_choices: no ||| yes
id: e3fcaefd-4e8e-4491-aab7-8efeb67a2909
jinja: "Sentence 1: {{ sentence1 }}\nSentence 2: {{ sentence2 }}\nAre the two\
\ sentences similar? Yes or no? \n|||\n{{ answer_choices[label] }}"
metadata: !TemplateMetadata
choices_in_prompt: true
languages:
- zh
metrics:
- Accuracy
original_task: true
name: is_similar_yes_no
reference: ''
65 changes: 65 additions & 0 deletions promptsource/templates/clue/c3/templates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
dataset: clue
subset: c3
templates:
51b3c3fe-2fa2-474a-81f9-5b421c884109: !Template
answer_choices: '{{ choice | join(" ||| ") }}'
id: 51b3c3fe-2fa2-474a-81f9-5b421c884109
jinja: "{% for statement in context %} \n{{ statement }}\n{% endfor %}\nGiven\
\ the dialogue / passage above, use the following options to answer the question\
\ \"{{question}}\".\nOptions: \n- {{ answer_choices | join('\\n- ') }}\n|||\n\
{{ answer }}"
metadata: !TemplateMetadata
choices_in_prompt: true
languages:
- zh
metrics:
- Accuracy
original_task: true
name: answer-question-affirmative
reference: ''
5e06f05f-d7dd-4329-b6d8-3a62dcdba838: !Template
answer_choices: '{{ choice | join(" ||| ") }}'
id: 5e06f05f-d7dd-4329-b6d8-3a62dcdba838
jinja: "Question: \"{{question}}\"\nAnswer choices: {{ answer_choices[:-1] | join(',\
\ ') }}, or {{ answer_choices[-1] }}?\nPassage: {% for statement in context\
\ %} \n{{ statement }}\n{% endfor %}\n|||\n{{ answer }}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This renders as e.g. ['Given the dialogue / passage below, what is the answer for the question "根据对话,可以知道什么?"\nAnswer choices: 今天天气不好, 比赛时间变了, or 校长忘了时间?\n \n男:足球比赛是明天上午八点开始吧?\n \n女:因为天气不好,比赛改到后天下午三点了。', '比赛时间变了']

How should the model know where the passage actually ends?
It may be reasonable to just continue the previous passage. Fine-tuning on such examples may lead to generation quality decreasing I think cc @thomasw21

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the point you're making. I don't know why the rendering is a list ...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad the first one is the input, the second the answer. So if we separate them with a whitespace the model will get:

Given the dialogue / passage below, what is the answer for the question "根据对话,可以知道什么?"\nAnswer choices: 今天天气不好, 比赛时间变了, or 校长忘了时间?\n \n男:足球比赛是明天上午八点开始吧?\n \n女:因为天气不好,比赛改到后天下午三点了。 比赛时间变了

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I understand, yeah good point, I think putting the passage above makes more sense

{passage} 

Given the dialogue / passage below, what is the answer for the question "根据对话,可以知道什么?"\nAnswer choices: 今天天气不好, 比赛时间变了, or 校长忘了时间?

One other way of doing it is have a between input and target, which we've been avoiding but in this case it might make sense?

Nit: also you can remove the answer choices for him to figure out (much harder task, but would maybe help quite a bit the training?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is have a between you mean have a EOS token?

Agreed, let's add another prompt without answer choices if you agree @yongzx?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes woops

Copy link
Contributor Author

@yongzx yongzx Jul 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap I can do that (moving the passage before the task description, and adding prompts without answer choices).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Muennighoff @thomasw21 For prompts without answer choices, should I mark it as non-original because I think we should use ROUGE or other generation metrics instead of original metric "accuracy", as we are no longer choosing answer from the given answer options.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, I'm not too familiar with how that terminology is used for. Perhaps @VictorSanh can help to know this kind of things.

metadata: !TemplateMetadata
choices_in_prompt: true
languages:
- zh
metrics:
- Accuracy
original_task: true
name: question_choices_context
reference: ''
63b5e5df-40d3-47ee-b77e-bf385c042fa9: !Template
answer_choices: null
id: 63b5e5df-40d3-47ee-b77e-bf385c042fa9
jinja: "Passage: {% for statement in context %} \n{{ statement }}\n{% endfor %}\n\
What kind of question would elicit an answer response of {{ answer }}?\n|||\n\
{{ question }}"
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- ROUGE
original_task: false
name: generate_question
reference: ''
a5820d05-a8df-4e31-a284-6969e478174b: !Template
answer_choices: '{{ choice | join('' ||| '') }}'
id: a5820d05-a8df-4e31-a284-6969e478174b
jinja: "Given the dialogue / passage below, what is the answer for the question\
\ \"{{question}}\"\nAnswer choices: {{ answer_choices[:-1] | join(', ') }},\
\ or {{ answer_choices[-1] }}?\n{% for statement in context %} \n{{ statement\
\ }}\n{% endfor %}\n|||\n{{ answer }}"
metadata: !TemplateMetadata
choices_in_prompt: true
languages:
- zh
metrics:
- Accuracy
original_task: true
name: answer-question-interrogative
reference: ''
78 changes: 78 additions & 0 deletions promptsource/templates/clue/cluewsc2020/templates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
dataset: clue
subset: cluewsc2020
templates:
321f55bb-c725-4fbf-bb7e-d46ea2f510b8: !Template
answer_choices: correct ||| wrong
id: 321f55bb-c725-4fbf-bb7e-d46ea2f510b8
jinja: 'In the class, a teacher asks what the word "{{ target[''span2_text'']
}}" refers to in the text of "{{ text }}". The student answers "{{ target[''span1_text'']
}}". The teacher would say what? {{ answer_choices[0] | capitalize }} or {{answer_choices[1]
}}?

|||

{{ answer_choices[label] }}'
metadata: !TemplateMetadata
choices_in_prompt: true
languages:
- zh
metrics:
- Accuracy
original_task: true
name: teacher_asking_student
reference: ''
7282b4b5-f854-42af-8e75-d509608d97bb: !Template
answer_choices: null
id: 7282b4b5-f854-42af-8e75-d509608d97bb
jinja: 'What does the word "{{ target[''span2_text''] }}" refers to in the text
of "{{ text }}"?

|||

{% if label == 0 %}

{{ target[''span1_text''] }}

{% endif %}'
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- ROUGE
original_task: false
name: generate_correct_response
reference: ''
e649a609-f7b2-43da-800d-a32090e92221: !Template
answer_choices: yes ||| no
id: e649a609-f7b2-43da-800d-a32090e92221
jinja: "In the sentence \"{{ text }}\", does \"{{ target['span2_text'] }}\" refer\
\ to \"{{ target['span1_text'] }}\"? \n|||\n{{ answer_choices[label] }}"
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- Accuracy
original_task: true
name: are_they_same
reference: ''
fc436a38-d9f5-4d17-bcf8-1e506bba5681: !Template
answer_choices: yes ||| no
id: fc436a38-d9f5-4d17-bcf8-1e506bba5681
jinja: 'In the sentence "{{ text }}", the word "{{ target[''span2_text''] }}"
refers to "{{ target[''span1_text''] }}". Answer {{ answer_choices[0] }} if
you agree; otherwise, answer {{ answer_choices[1] }}.

|||

{{ answer_choices[label] }}'
metadata: !TemplateMetadata
choices_in_prompt: true
languages:
- zh
metrics:
- Accuracy
original_task: true
name: affirmative_are_they_same
reference: ''
76 changes: 76 additions & 0 deletions promptsource/templates/clue/cmrc2018/templates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
dataset: clue
subset: cmrc2018
templates:
3bba02e6-9266-418b-9ba0-4f71755cf3b6: !Template
answer_choices: null
id: 3bba02e6-9266-418b-9ba0-4f71755cf3b6
jinja: 'Given this context "{{ context }}", generate a question that would return
the answer of "{{ answers[''text''][0] }}".

|||

{{ question }} '
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- ROUGE
original_task: false
name: generate_question
reference: ''
8fe02215-7881-4a61-a6e7-579680e40b9b: !Template
answer_choices: null
id: 8fe02215-7881-4a61-a6e7-579680e40b9b
jinja: "In an exam, you are asked {{ question }}, and you are tasked to find the\
\ answer from the following passage. \n{{ context }}\nWhat's the answer?\n|||\n\
{{ answers['text'][0] }}"
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- Squad
original_task: true
name: in_an_exam
reference: ''
9e82f5da-b206-4758-94e6-085cf2608378: !Template
answer_choices: null
id: 9e82f5da-b206-4758-94e6-085cf2608378
jinja: '{{ context }}

The answer to {{ question }} is in the passage above. What is it?

|||

{{ answers[''text''][0] }}'
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- Squad
original_task: true
name: answer_in_the_passage
reference: ''
9fb15385-814e-419a-b862-2d4e06a58ef6: !Template
answer_choices: null
id: 9fb15385-814e-419a-b862-2d4e06a58ef6
jinja: 'Answer the question using the given context.

Question: {{ question }}

Context: {{ context }}

|||
yongzx marked this conversation as resolved.
Show resolved Hide resolved

{{ answers[''text''][0] }}'
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- Squad
original_task: true
name: answer_following_question
reference: ''
90 changes: 90 additions & 0 deletions promptsource/templates/clue/csl/templates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
dataset: clue
subset: csl
templates:
219679f8-a02f-4ee3-91c7-9ed4726dd828: !Template
answer_choices: no ||| yes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
answer_choices: no ||| yes
answer_choices: yes ||| no

Currently I get the below:
['Do these keywords "纳米粒子, 干细胞, 氧化物, 顺磁性" represent key concepts in the abstract "目的探讨常见氧化铁纳米粒子几种神经干细胞标记技术的标记效率.材料与方法使用超顺磁性氧化铁纳米粒子(SPIO)和超微超顺磁性氧化铁纳米粒子(USPIO)以25μgFe/ml分别单独标记、与多聚赖氨酸(PLL)及脂质体联合标记神经干细胞,以未标记细胞做对照,采用普鲁士蓝染色评价细胞标记率,并采用4.7TMRIT2WI多回波序列测量T2弛豫率(R2)评价细胞内的铁摄取量,比较各组R2的差异.结果①普鲁士蓝染色结果:SPIO及USPIO单独标记组标记率为60%~70%,低于联合标记组的100%;②MRI结果:未标记细胞R2为(2.10±0.11)/s,SPIO、USPIO单独标记组细胞R2分别为(3.39±0.21)/s、(3.16±0.32)/s,SPIO-脂质体联合标记组及USPIO-脂质体联合标记组R2分别为(4.03±025)/s、(3.61±0.32)/s,SPIO-PLL联合标记组及USPIO-PLL联合标记组R2分别为(5.38±0.52)/s、(4.44±0.35)/s,SPIO、USPIO与PLL联合标记组R2大于SPIO、USPIO与脂质体联合标记组(P<0.05);而与脂质体联合标记组R2大于单独标记组(P<0.05);SPIO与USPIO单独标记细胞时R2差异无统计学意义(P>0.05),SPIO与脂质体或PLL联合标记时R2高于USPIO(P<0.05).结论SPIO、USPIO单独标记及与PLL、脂质体联合标记均可以成功标记神经干细胞,提高R2,其中SPIO与PLL联合标记效率最高."?', 'no']

我觉得应该是yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I follow the labeling described in the CLUE paper: https://arxiv.org/pdf/2004.05986.pdf (Table 5), and label 0 corresponds to false.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, so CSL appears to be very noisy, see this issue.
The example from the paper also appears with both labels..
Let's leave it as is, but not sure we should use it for fine-tuning

Screenshot 2022-07-30 at 10 12 25

id: 219679f8-a02f-4ee3-91c7-9ed4726dd828
jinja: 'After John wrote the abstract "{{abst}}", he wrote these keywords "{{
keyword | join('', '') }}". Do you think his choice of keywords was correct?
Answer {{ answer_choices[1]}} or {{ answer_choices[0]}}.

|||

{{ answer_choices[label] }}


'
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- Accuracy
original_task: true
name: write_keywords_after_abstract
reference: ''
2e851dd2-2677-415a-ad90-5d885aa91fdc: !Template
answer_choices: no ||| yes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
answer_choices: no ||| yes
answer_choices: yes ||| no

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree for the reason given above (In CLUE paper, the label 0 corresponds to false).

id: 2e851dd2-2677-415a-ad90-5d885aa91fdc
jinja: 'Do these keywords "{{ keyword | join('', '') }}" represent key concepts
in the abstract "{{ abst }}"?

|||

{{ answer_choices[label] }}


'
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- Accuracy
original_task: true
name: do_represent
reference: ''
2fa6151b-a296-4cd5-83ca-dcd434b831be: !Template
answer_choices: null
id: 2fa6151b-a296-4cd5-83ca-dcd434b831be
jinja: 'Given the abstract {{abst}}, list out {{ keyword | length }} keywords
for it.

|||

{% if label == 1 %}

{{ keyword | join('', '') }}

{% endif %}'
metadata: !TemplateMetadata
choices_in_prompt: false
languages:
- zh
metrics:
- ROUGE
original_task: false
name: generate_keywords
reference: ''
aaf47f6f-fd8f-4180-8d85-e4c7df088ac6: !Template
answer_choices: no ||| yes

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
answer_choices: no ||| yes
answer_choices: yes ||| no

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree for the reason given above (In CLUE paper, the label 0 corresponds to false).

id: aaf47f6f-fd8f-4180-8d85-e4c7df088ac6
jinja: 'A scholar used "{{ keyword | join('', '') }}" as search terms. Do you
think the search engine would return the abstract "{{abst}}"? Answer {{ answer_choices[1]
}} or {{ answer_choices[0] }}.

|||

{{ answer_choices[label] }}


'
metadata: !TemplateMetadata
choices_in_prompt: true
languages:
- zh
metrics:
- Accuracy
original_task: true
name: search_terms
reference: ''
Loading