再看面向NLP任务的大模型Prompt设计:PromptSource等代表性NLP开源Prompt数据集

1,113次阅读
没有评论

今天是2023年11月21日,星期二,北京,天气晴。

我们来继续看看prompt的一些工作,以顺承前面ICL以及长文本上的一些知识。

很久之前,我们介绍到,prompt是影响下游任务的关键所在,当我们在应用chatgpt进行nlp任务落地时,如何选择合适的prompt,对于SFT以及推理环节尤为重要。

不过,硬想不是办法,我们可以充分参考开源的一些已有工作,幸运的是,这类工作已然存在。

因此,本文主要介绍longbench、LooGLE、pclue以及firefly自然语言处理任务prompt以及PromptSource英文常用评测任务prompt生成工具包。

一、其他一些关于NLP任务的代表prompt

最近我们在看长文本说的一些评估数据集,而对于评估来说,如何针对不同的任务,设定相应的prompt,最为重要。下面介绍longbench、LooGLE、pclue以及firefly自然语言处理任务prompt。

1、longbench长文本prompt

地址:https://github.com/THUDM/LongBench

再看面向NLP任务的大模型Prompt设计:PromptSource等代表性NLP开源Prompt数据集

再看面向NLP任务的大模型Prompt设计:PromptSource等代表性NLP开源Prompt数据集

2、LooGLE长文本评测prompt

地址:https://github.com/bigai-nlco/LooGLE

再看面向NLP任务的大模型Prompt设计:PromptSource等代表性NLP开源Prompt数据集

4、Pclue任务评测prompt

地址:https://github.com/CLUEbenchmark/pCLUE

再看面向NLP任务的大模型Prompt设计:PromptSource等代表性NLP开源Prompt数据集

再看面向NLP任务的大模型Prompt设计:PromptSource等代表性NLP开源Prompt数据集

再看面向NLP任务的大模型Prompt设计:PromptSource等代表性NLP开源Prompt数据集

4、firefly自然语言处理任务prompt

地址:https://huggingface.co/datasets/YeungNLP/firefly-train-1.1M/viewer/default/train?row=3

再看面向NLP任务的大模型Prompt设计:PromptSource等代表性NLP开源Prompt数据集

二、PromptSource英文NLP prompt生成工具

PromptSource是一个用于创建、共享和使用自然语言提示的工具包,截至2022年1月20日,P3中有约2000个prompt,涵盖170多个英语数据集。

再看面向NLP任务的大模型Prompt设计:PromptSource等代表性NLP开源Prompt数据集

项目地址:https://github.com/bigscience-workshop/promptsource

1、storycloze的prompt

templates:
  1a4946f9-a0e2-4fbb-aee8-b26ead2cf6b8: !Template
    answer_choices: '{{sentence_quiz1}} ||| {{sentence_quiz2}}'
    id: 1a4946f9-a0e2-4fbb-aee8-b26ead2cf6b8
    jinja: '{{input_sentence_1}} {{input_sentence_2}} {{input_sentence_3}} {{input_sentence_4}}
      What is a possible continuation for the story given the following options ?
      - {{answer_choices | join("n- ")}} ||| {{answer_choices[answer_right_ending
      -1]}}'

    metadata: !TemplateMetadata
      choices_in_prompt: true
      languages:
      - en
      metrics:
      - Accuracy
      original_task: true
    name: Answer Given options
    reference: ''
  1a9d53bc-eb77-4e7c-af6e-3d15b79d6cf1: !Template
    answer_choices: '{{sentence_quiz1}} ||| {{sentence_quiz2}}'
    id: 1a9d53bc-eb77-4e7c-af6e-3d15b79d6cf1
    jinja: "Read the following story :nn{{input_sentence_1}}n{{input_sentence_2}}n
      {{input_sentence_3}}n{{input_sentence_4}}nnChoose a possible ending for the
       previous story from the following options: n- {{answer_choices | join("\
      n- ")}}n|||nn{{answer_choices[answer_right_ending -1]}}"

    metadata: !TemplateMetadata
      choices_in_prompt: true
      languages:
      - en
      metrics:
      - Accuracy
      original_task: true
    name: Choose Story Ending
    reference: ''

2、Squad任务的prompt

templates:
  3d85b5b0-51db-4d72-8ead-d0b3654025ee: !Template
    answer_choices: null
    id: 3d85b5b0-51db-4d72-8ead-d0b3654025ee
    jinja: 'Refer to the passage below and answer the following question:
      Passage: {{context}}
      Question: {{question}}
      |||
      {{answers["text"][0]}}'

    metadata: !TemplateMetadata
      choices_in_prompt: false
      languages:
      - en
      metrics:
      - Squad
      original_task: true
    name: answer_question_given_context
    reference: ''

3、MathQA任务的prompt

a313a5f8-53cd-4b76-abb6-fea2ac4e9ef4: !Template
    answer_choices: a ||| b ||| c ||| d ||| e
    id: a313a5f8-53cd-4b76-abb6-fea2ac4e9ef4
    jinja: "One of the five choices are correctly answers the math problem. Can you
       choose the right one? nn{{options}}nnProblem: {{Problem}}n|||n{{correct}}"

    metadata: !TemplateMetadata
      choices_in_prompt: true
      languages:
      - en
      metrics:
      - Accuracy
      original_task: true
    name: first_choice_then_problem
    reference: First give the list of choices and then describe the problem
  a3c2ec72-4af5-42aa-9e8e-ef475fa7c039: !Template
    answer_choices: general ||| physics ||| gain ||| geometry ||| probability |||
      other
    id: a3c2ec72-4af5-42aa-9e8e-ef475fa7c039
    jinja: "Given the problem below, in what category would you classify it?n===n
      {{Problem}} nnCategories:n{{answer_choices | join("\n")}}n|||n{{category}}n"

    metadata: !TemplateMetadata
      choices_in_prompt: true
      languages:
      - en
      metrics:
      - Accuracy
      original_task: false
    name: problem_set_type
    reference: The template asks to generate the category of the problem set

4、使用方式

# Load an example from the datasets ag_news
>>> from datasets import load_dataset
>>> dataset = load_dataset("ag_news", split="train")
>>> example = dataset[1]

# Load prompts for this dataset
>>> from promptsource.templates import DatasetTemplates
>>> ag_news_prompts = DatasetTemplates(‘ag_news’)

# Print all the prompts available for this dataset. The keys of the dict are the uuids the uniquely identify each of the prompt, and the values are instances of `Template` which wraps prompts
>>> print(ag_news_prompts.templates)
{’24e44a81-a18a-42dd-a71c-5b31b2d2cb39′: <promptsource.templates.Template object at 0x7fa7aeb20350>, ‘8fdc1056-1029-41a1-9c67-354fc2b8ceaf’: <promptsource.templates.Template object at 0x7fa7aeb17c10>, ‘918267e0-af68-4117-892d-2dbe66a58ce9’: <promptsource.templates.Template object at 0x7fa7ac7a2310>, ‘9345df33-4f23-4944-a33c-eef94e626862’: <promptsource.templates.Template object at 0x7fa7ac7a2050>, ‘98534347-fff7-4c39-a795-4e69a44791f7’: <promptsource.templates.Template object at 0x7fa7ac7a1310>, ‘b401b0ee-6ffe-4a91-8e15-77ee073cd858’: <promptsource.templates.Template object at 0x7fa7ac7a12d0>, ‘cb355f33-7e8c-4455-a72b-48d315bd4f60’: <promptsource.templates.Template object at 0x7fa7ac7a1110>}

# Select a prompt by its name
>>> prompt = ag_news_prompts[“classify_question_first”]

# Apply the prompt to the example
>>> result = prompt.apply(example)
>>> print(“INPUT: “, result[0])
INPUT:  What label best describes this news article?
Carlyle Looks Toward Commercial Aerospace (Reuters) Reuters – Private investment firm Carlyle Group,which has a reputation for making well-timed and occasionallycontroversial plays in the defense industry, has quietly placedits bets on another part of the market.
>>> print(“TARGET: “, result[1])
TARGET:  Business

总结

本文主要介绍了PromptSource英文常用评测任务prompt生成工具包以及现有NLP的一些prompt,这些对我们进行信息抽取等任务有很大的帮助。

对于具体的使用,大家可以参考参考文献链接进行进一步查看,并实践。

参考文献

1、https://github.com/bigscience-workshop/promptsource

关于我们

老刘,刘焕勇,NLP开源爱好者与践行者,主页:https://liuhuanyong.github.io。

就职于360人工智能研究院、曾就职于中国科学软件研究所。

老刘说NLP,将定期发布语言资源、工程实践、技术总结等内容,欢迎关注。

对于想加入更优质的知识图谱、事件图谱实践、相关分享的,可关注公众号,在后台菜单栏中点击会员社区->会员入群加入。

​       

 

Read More 

正文完
可以使用微信扫码关注公众号(ID:xzluomor)
post-qrcode
 0
评论(没有评论)

文心AIGC

2023 年 11 月
 12345
6789101112
13141516171819
20212223242526
27282930  
文心AIGC
文心AIGC
人工智能ChatGPT,AIGC指利用人工智能技术来生成内容,其中包括文字、语音、代码、图像、视频、机器人动作等等。被认为是继PGC、UGC之后的新型内容创作方式。AIGC作为元宇宙的新方向,近几年迭代速度呈现指数级爆发,谷歌、Meta、百度等平台型巨头持续布局
文章搜索
热门文章
潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026

潞晨尤洋:日常办公没必要上私有模型,这三类企业才需要 | MEET2026 Jay 2025-12-22 09...
面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25

面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25

面向「空天具身智能」,北航团队提出星座规划新基准丨NeurIPS’25 鹭羽 2025-12-13 22:37...
5天连更5次,可灵AI年末“狂飙式”升级

5天连更5次,可灵AI年末“狂飙式”升级

5天连更5次,可灵AI年末“狂飙式”升级 思邈 2025-12-10 14:28:37 来源:量子位 让更大规...
钉钉又发新版本!把 AI 搬进每一次对话和会议

钉钉又发新版本!把 AI 搬进每一次对话和会议

钉钉又发新版本!把 AI 搬进每一次对话和会议 梦晨 2025-12-11 15:33:51 来源:量子位 A...
商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1

商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1

商汤Seko2.0重磅发布,合作短剧登顶抖音AI短剧榜No.1 十三 2025-12-15 14:13:14 ...
最新评论
ufabet ufabet มีเกมให้เลือกเล่นมากมาย: เกมเดิมพันหลากหลาย ครบทุกค่ายดัง
tornado crypto mixer tornado crypto mixer Discover the power of privacy with TornadoCash! Learn how this decentralized mixer ensures your transactions remain confidential.
ดูบอลสด ดูบอลสด Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Pretty! This has been a really wonderful post. Many thanks for providing these details.
ดูบอลสด ดูบอลสด Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Obrazy Sztuka Nowoczesna Obrazy Sztuka Nowoczesna Thank you for this wonderful contribution to the topic. Your ability to explain complex ideas simply is admirable.
ufabet ufabet Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
ufabet ufabet You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
ufabet ufabet Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
热评文章
读懂2025中国AI走向!公司×产品×人物×方案,最值得关注的都在这里了

读懂2025中国AI走向!公司×产品×人物×方案,最值得关注的都在这里了

读懂2025中国AI走向!公司×产品×人物×方案,最值得关注的都在这里了 衡宇 2025-12-10 12:3...
5天连更5次,可灵AI年末“狂飙式”升级

5天连更5次,可灵AI年末“狂飙式”升级

5天连更5次,可灵AI年末“狂飙式”升级 思邈 2025-12-10 14:28:37 来源:量子位 让更大规...
戴尔 x OpenCSG,推出⾯向智能初创企业的⼀体化 IT 基础架构解决方案

戴尔 x OpenCSG,推出⾯向智能初创企业的⼀体化 IT 基础架构解决方案

戴尔 x OpenCSG,推出⾯向智能初创企业的⼀体化 IT 基础架构解决方案 十三 2025-12-10 1...
九章云极独揽量子位三项大奖:以“一度算力”重构AI基础设施云格局

九章云极独揽量子位三项大奖:以“一度算力”重构AI基础设施云格局

九章云极独揽量子位三项大奖:以“一度算力”重构AI基础设施云格局 量子位的朋友们 2025-12-10 18:...
乐奇Rokid这一年,一路狂飙不回头

乐奇Rokid这一年,一路狂飙不回头

乐奇Rokid这一年,一路狂飙不回头 梦瑶 2025-12-10 20:41:15 来源:量子位 梦瑶 发自 ...