Evol-Instruct:让LLM将指令改写的更复杂

Evol-Instruct方法出自论文 WizardLM: Empowering Large Language Models to Follow Complex Instructions ,也是利用大模型生成指令的方法,它可以生成相对复杂和多样的指令数据集。

对应的github,但是目前只开源LLM部分的代码,如何生成指令的代码暂时未开源。h2o-wizardlm开源了部分指令代码,也还不完整。

Evol-Instruct方法的流程示意如下图,主要包括两个部分: Instruction Evolver和Instruction Eliminator。

在这里插入图片描述

Evol-Instruct流程对应的的一个例子如下图:
在这里插入图片描述

Instruction Evolver

因为LLM有能力根据prompt生成更复杂的指令,所以作者从深度演化和广度演化两个角度来生成指令。

广度演化的prompt如下:

'''
I want you act as a Prompt Creator. 
Your goal is to draw inspiration from the #Given Prompt# to create a brand new prompt. 
This new prompt should belong to the same domain as the #Given Prompt# but be even more rare. 
The LENGTH and difficulty level of the #Created Prompt# should be similar to that of the #Given Prompt#. 
The #Created Prompt# must be reasonable and must be understood and responded by humans. '#Given Prompt#', '#Created Prompt#', 'given prompt' and 'created prompt' are not allowed to appear in #Created Prompt#. 
#Given Prompt#: 
<Here is instruction.> 
#Created Prompt#:
'''

深度演化的prompt分为5类:add constraints, deepening, concretizing, increased reasoning steps, and complicating input。前四类不需要加入上下文,而complicating input需要给定上下文。

add constraints的prompt:

'''
I want you act as a Prompt Rewriter. 
Your objective is to rewrite a given prompt into a more complex version to make those famous AI systems (e.g., ChatGPT and GPT4) a bit harder to handle. 
But the rewritten prompt must be reasonable and must be understood and responded by humans. 
Your rewriting cannot omit the non-text parts such as the table and code in #Given Prompt#:. Also, please do not omit the input in #Given Prompt#. 
You SHOULD complicate the given prompt using the following method:
Please add one more constraints/requirements into #Given Prompt# 
You should try your best not to make the #Rewritten Prompt# become verbose, #Rewritten Prompt# can only add 10 to 20 words into #Given Prompt#. 
'#Given Prompt#', '#Rewritten Prompt#', 'given prompt' and 'rewritten prompt' are not allowed to appear in #Rewritten Prompt# 
#Given Prompt#: 
<Here is instruction.> 
#Rewritten Prompt#:
'''

deepening prompt 的prompt:

'''
I want you act as a Prompt Rewriter.
Your objective is to rewrite a given prompt into a more complex version to make those famous AI systems (e.g., ChatGPT and GPT4) a bit harder to handle. 
But the rewritten prompt must be reasonable and must be understood and responded by humans.
Your rewriting cannot omit the non-text parts such as the table and code in #Given Prompt#:. Also, please do not omit the input in #Given Prompt#. 
You SHOULD complicate the given prompt using the following method: 
If #Given Prompt# contains inquiries about certain issues, the depth and breadth of the inquiry can be increased. or 
You should try your best not to make the #Rewritten Prompt# become verbose, #Rewritten Prompt# can only add 10 to 20 words into #Given Prompt#. 
'#Given Prompt#', '#Rewritten Prompt#', 'given prompt' and 'rewritten prompt' are not allowed to appear in #Rewritten Prompt# 
#Given Prompt#: 
<Here is instruction.> 
#Rewritten Prompt#:
'''

concretizing prompt的prompt:

'''
I want you act as a Prompt Rewriter.
Your objective is to rewrite a given prompt into a more complex version to make those famous AI systems (e.g., ChatGPT and GPT4) a bit harder to handle. 
But the rewritten prompt must be reasonable and must be understood and responded by humans.
Your rewriting cannot omit the non-text parts such as the table and code in #Given Prompt#:. Also, please do not omit the input in #Given Prompt#. 
You SHOULD complicate the given prompt using the following method: 
Please replace general concepts with more specific concepts. or 
You should try your best not to make the #Rewritten Prompt# become verbose, #Rewritten Prompt# can only add 10 to 20 words into #Given Prompt#. 
'#Given Prompt#', '#Rewritten Prompt#', 'given prompt' and 'rewritten prompt' are not allowed to appear in #Rewritten Prompt# 
#Given Prompt#: 
<Here is instruction.> 
#Rewritten Prompt#:
'''

increased reasoning steps 的prompt:

'''
I want you act as a Prompt Rewriter.
Your objective is to rewrite a given prompt into a more complex version to make those famous AI systems (e.g., ChatGPT and GPT4) a bit harder to handle.
But the rewritten prompt must be reasonable and must be understood and responded by humans.
Your rewriting cannot omit the non-text parts such as the table and code in #Given Prompt#:. Also, please do not omit the input in #Given Prompt#.
You SHOULD complicate the given prompt using the following method:
If #Given Prompt# can be solved with just a few simple thinking processes, you can rewrite it to explicitly request multiple-step reasoning.
You should try your best not to make the #Rewritten Prompt# become verbose, #Rewritten Prompt# can only add 10 to 20 words into #Given Prompt#.
'#Given Prompt#', '#Rewritten Prompt#', 'given prompt' and 'rewritten prompt' are not allowed to appear in #Rewritten Prompt#
#Given Prompt#:
<Here is instruction.>
#Rewritten Prompt#:
'''

complicating input需要给定上下文,论文附录D给了多个例子,这里列一个:

'''
I want you act as a Prompt Rewriter. Your objective is to rewrite a given prompt into a more complex version using dataformat to make those famous AI systems (e.g., chatgpt and GPT4) more difficult to handle. But the rewritten prompt must be reasonable and must be understood and responded by humans.
You must add [python code] format text as input data in [Rewritten Prompt]
The Given Prompt:
Transformat python code
Rewritten Prompt(MUST contain a specific python code as input):
I have the following Python code:

cursor.execute(" INSERT INTO table VALUES var1 , var2 , var3 ,")
 
where var1 is an integer, var2 and var3 are strings.
How can I write the variable names without Python including them as part of the query text?
'''

Instruction Eliminator

对于第一步演化生成的指令,让LLM生成回复时,直接将生成的指令作为LLM的prompt输入就可以了。

以下四种情况会被判定为演化失败:

  1. 演化生成的指令相比之前的指令没有提供信息增益,使用chatGPT来作判断,使用的prompt如下:

    '''
    Here are two Instructions to ChatGPT AI, do you think they are equal to each other, which meet the following requirements:
    1. They have same constraints and requirments.
    2. They have same depth and breadth of the inquiry.
    The First Prompt: <Here is first instruction.>
    The Second Prompt: <Here is second instruction.>
    Your Judgement (Just answer: Equal or Not Equal. No need to explain the reason.):
    '''
    
  2. 演化生成的指令对于LLM生成回答很困难,如果LLM生成的回复中包括sorry或者长度很短(小于80个词),就认为LLM生成回答很困难。

  3. LLM生成的回答只包括标点符号和停用词

  4. 演化生成的指令明显是从prompt中复制过来一些词如“given prompt"、"rewritten prompt"等情形

  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值