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:让LLM将指令改写的更复杂_第1张图片

Evol-Instruct流程对应的的一个例子如下图:
Evol-Instruct:让LLM将指令改写的更复杂_第2张图片

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#: 
 
#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#: 
 
#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#: 
 
#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#: 
 
#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#:

#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: 
    The Second Prompt: 
    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"等情形

你可能感兴趣的:(深度学习,论文阅读,指令数据集)