赞
踩
让模型学会输出符合 instruction 的回答。
构建形式为 instruction + content + answer 的样本集,然后有监督的方式训练 LLM。
主要是用一些 prompt template 来让 GPT-3/GPT-3.5/GPT-4 自动输出一些符合要求的高质量的样本。
也可以使用已有的公开的数据集,将他们转化成 instruction + content + answer 的形式。
GPT-3 文本生成能力很强,不总是能生成符合 instruction 的输出,但是某些情况下可以。
给GPT-3输入有效的 prompt,从而引导它生成符合 instruction 的文本,构建样本集。
然后再用监督训练的方式让GPT-3学会遵守instruction。
用有效的 prompt 来激发GPT-3本身的能力,再通过训练来强化。
instruction + input + output
任务的描述
一个 instruction 可以对应多个(input, output)
如果 instruction 是一个通用的任务,则 input 会是一个具体的任务输入。
例如:
Instruction: Given an address and city, come up with the zip code.
Input: Address: 123 Main Street, City: San Francisco
Output: 94105
不一定每个 sample 都有,例如
Instruction: Write a letter from the perspective of a cat.
Input: Null
Output:
Dear [Owner], I am writing to you today because I
have a problem. You see, I’ve been living with you
for the past [Number of Years] and I love it here.
The food is great, the bed is comfy, and there are
plenty of toys to play with. But lately, I’ve
noticed that you’re not as affectionate towards
me as you used to be. In fact, sometimes
when I try to cuddle up next to you on the
couch, you push me away ...
期待模型输出的东西
从人工写的 seed 开始,逐渐循环迭代生成,下图为生成的流程
作者和同事从头手写了 175 task
每个 task 有一个seed
seed 是手工写的 instruction+input+output 的样本
leverages the existing collection of instructions to create more broad-coverage instructions
每次 sample 8 个已有的 instruction(6 个手写的,2 个自动生成的)
把 8 个 instruction 输出模型,让模型仿照这 8 个 instruction,生成新的 instruction,一次生成一个 instruction
下图为一个例子
作者把任务分成了 2 种类型:分类和非分类。两种任务需要用不同方式处理,所以需要区分两种任务。
using 12 classification instructions and 19 non-classification instructions from the seed tasks 用来生成 prompt
下图为一个例子的 prompt
creates input-output instances for newly generated set of instructions
这里分了 2 种类型的 prompt: input first 和 output first。
因为在作者的实验中,对分类任务,如果用 input-first 的 prompt 的话,生成的样本总是会偏向于某一些类别,一些类别特别多,一些特别少。于是对分类任务使用 output-first 的 prompt,先生成类别标签(output),再生成 input,对非分类任务使用 input-first。
下图为 input first 的例子:
下图为 output first 的例子:
过滤掉一些质量不好的。以下为一些过滤方法:
用生成的 large-scale instruction data 做监督训练。
会用一些规则来处理样本从而让模型更 robust。
For example, the instruction can be prefixed with “Task:” or not, the input can be prefixed with “Input:” or not, “Output:” can be appended at the end of the prompt or not, and different numbers of break lines can be put in the middle, etc.
最终得到了52k instructions,一共82K instance inputs and target outputs
用 self-instruct 的方法生成了一个新的数据集,然后用生成的数据集微调 LLama
做了 3 件事
数据集分 4 个部分:
分别训练了中文和英文两个模型
based on OPT 1.3B
一个 prompt 有K 个 response,GPT-4给了每个(prompt,response)对一个得分(1到 10 分)
用 pair wise 的方法来训练,每个 pair 包括 2 个(prompt,response)对,一个得分高,一个得分低
一个 pair 的优化目标为最小化 log ( σ ( r θ ( x , y h ) − r θ ( x , y l ) ) ) \log(\sigma(r_{\theta}(x, y_h) - r_{\theta}(x, y_l))) log(σ(rθ(x,yh)−rθ(x,yl)))
通过一些方法,自动迭代 instruction,使得 instruction 变得越来越复杂,方法名字叫做 Evol-Instruct。
还是用 GPT-4 生成 instruction,生成数据集后在 llama 上微调
相比Alpaca和Instruction Tuning with GPT-4只是照搬 self-instruct,Wizardlm提出的 Evol-Instruct 是在 self-instruct 上有新的内容的。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。