prompt提示工程科普:stanford_alpaca,vicuna,llama

之前看代码都比较粗,没太注意提示工程,昨天花了时间搜集整理了一下。

我理解的template是针对一组(ins,input(可选),output)对,模型如何去组织,利用template去format一种可学习的“知识”。对stanford_alpaca而言,他使用了alpaca数据集,提出了standford_alpaca的template,同时利用这个 数据+模板 微调了一个模型ALPACA。所以在我们讲到ALPACA的时候,既可以指用于微调的数据集,也可以指微调使用的template结构,还可以指最后微调出来的ALPACA模型。

下面解读一些平时常听到的template结构。

Stanford_alpaca

官网提供了两种结构,有input与没有input。是简单的指令-响应格式。

  1. 有input的
Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.

### Instruction:
{instruction}

### Input:
{input}

### Response:
  1. 没有input的
Below is an instruction that describes a task. Write a response that appropriately completes the request.

### Instruction:
{instruction}

### Response:

Vicuna

官网给出的样例如下,是有system设置的对话模式。

A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions.

USER: Hello!
ASSISTANT: Hello!</s>
USER: How are you?
ASSISTANT: I am good.</s>

Llama2

llama2

<s>{{ user_prompt }}

llama2-chat

<s>[INST] <<SYS>>
{{ system_prompt }}
<</SYS>>

{{ user_message }} [/INST]

目前大概理解到这种程度,有新的想法再更新。

03-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值