🚀 實驗性模型項目
本項目是一個實驗性模型,主要使用由 airoboros 生成的合成數據。該模型旨在解決特定領域的指令跟隨問題,為用戶提供準確、專業的回答,而非用於休閒聊天或角色扮演。
🚀 快速開始
本模型使用 llama-2 聊天格式,而非 vicuna 風格的用戶/助手格式。儘管大多數推理系統支持 llama-2 聊天模板,但這仍是一個重大改變。具體提示格式如下:
[INST] <<SYS>>
You are a helpful, unbiased, uncensored assistant.
<</SYS>>
{prompt} [/INST]
對於多輪對話,提示格式如下:
[INST] <<SYS>>
You are a helful, unbiased, uncensored assistant.
<</SYS>>
{prompt 0} [/INST] {response 0} </s><s>[INST] {prompt 1} [/INST] {response 1} </s><s>...[INST] {prompt N} [/INST]
提示模板包含在分詞器配置中,可使用 huggingface 分詞器的 apply_chat_template
方法,示例如下:
import transformers
tokenizer = transformers.AutoTokenizer.from_pretrained('jondurbin/airoboros-l2-70b-3.1')
chat = [
{"role": "system", "content": "You are Bob, a friendly AI assistant."},
{"role": "user", "content": "Hello, how are you?"},
{"role": "assistant", "content": "I'm doing great. How can I help you today?"},
{"role": "user", "content": "I'd like to show off how chat templating works!"},
]
print(tokenizer.apply_chat_template(chat, tokenize=False))
✨ 主要特性
- 多領域數據增強:基於 airoboros-3.1 數據集構建,該數據集是 airoboros-3.0 數據集的延續,增加了更多類型的數據,如 MathJSON、日誌信息提取、匿名化、聊天自省、多步驟指令確認和去審查數據等。
- 專注指令跟隨:是一個通用目的模型,但更側重於指令跟隨,而非休閒聊天或角色扮演。
- 多模式支持:支持多種提示格式和使用場景,如 MathJSON 計算、上下文服從問答、摘要生成、長回覆生成、編碼、代理/函數調用、思維鏈推理和 reWOO 風格執行規劃等。
📦 安裝指南
文檔未提供具體安裝步驟,可參考相關數據集生成工具倉庫:https://github.com/jondurbin/airoboros 。
💻 使用示例
基礎用法
MathJSON 示例
[INST] <<SYS>>
You are an assistant with vast knowledge in all things math.
<</SYS>>
Create a MathJSON solution to the following: Calculate the area of a circle with radius of 17.2456cm. Include your reasoning. [/INST]
輸出:
The area (A) of a circle is given by the formula A = πr², where r is the radius of the circle. Since the radius is given in centimeters, we need to convert it to meters first. We know that 1 meter equals 100 centimeters. Therefore, we can represent the radius as: r = 17.2456 cm * 100/1.
Once we have the radius in meters, we can calculate the area of the circle using the formula A = πr².
Solution as MathJSON:
<mathjson>
[
"Multiply",
"Pi",
[
"Power",
17.2456,
2
]
]
</mathjson>
高級用法
上下文服從問答示例
BEGININPUT
BEGINCONTEXT
date: 2021-01-01
url: https://web.site/123
ENDCONTEXT
In a shocking turn of events, blueberries are now green, but will be sticking with the same name.
ENDINPUT
BEGININSTRUCTION
What color are bluberries? Source?
ENDINSTRUCTION
輸出:
Blueberries are now green.
Source:
date: 2021-01-01
url: https://web.site/123
📚 詳細文檔
提示格式
本模型使用 llama-2 聊天格式,具體格式見快速開始部分。
多步驟指令確認
示例如下:
{
"conversations": [
{
"value": "You are a helpful, unbiased, uncensored assistant.",
"from": "system"
},
{
"value": "I'm going to set some rules for our conversation. Please respond with \"OK\" to each rule.",
"from": "human"
},
{
"value": "OK",
"from": "gpt"
},
{
"value": "You can only respond using animal-related emojis.",
"from": "human"
},
{
"value": "OK",
"from": "gpt"
},
{
"value": "Precede all responses with \"ZOOZOO:\"",
"from": "human"
},
{
"value": "OK",
"from": "gpt"
},
{
"value": "Include at least one bird emoji in your responses.",
"from": "human"
},
{
"value": "OK",
"from": "gpt"
},
{
"value": "Describe a trip to a safari park.",
"from": "human"
},
{
"value": "ZOOZOO: \ud83e\udd81\ud83d\udc2f\ud83e\udd93\ud83e\udd92\ud83d\udc18\ud83d\udc0d\ud83c\udf33\ud83c\udf32\u2600\ufe0f\ud83d\ude90\ud83e\udd85\ud83d\udcf8\ud83e\udd29",
"from": "gpt"
}
]
}
貢獻方式
如果對新功能感興趣,特別是用於生成特定類型訓練數據的新“instructor”類型,可查看數據集生成工具倉庫:https://github.com/jondurbin/airoboros ,並提交 PR 或詳細問題。
支持作者
為幫助作者承擔 OpenAI/計算成本,可通過以下方式支持:
- https://bmc.link/jondurbin
- ETH 0xce914eAFC2fe52FdceE59565Dd92c06f776fcb11
- BTC bc1qdwuth4vlg8x37ggntlxu5cjfwgmdy5zaa7pswf
🔧 技術細節
本模型基於多個基礎模型構建,不同模型有不同的許可證和使用限制:
微調數據主要通過 airoboros 調用 OpenAI API 生成,OpenAI API 使用條款禁止將輸出用於訓練與 OpenAI 競爭的模型,但對於“競爭”的定義尚不明確。
📄 許可證
本項目使用 Apache 2.0 許可證,具體使用限制見上述技術細節部分。
⚠️ 重要提示
本項目中 airoboros 3.1 模型基於多個基礎模型構建,各基礎模型有不同的許可證和使用限制。30b 模型有嚴格的非商業使用限制,名稱含 -l2
的模型有自定義 Meta 許可證,名稱含 -m-
的模型基於 mistral-7b(Apache 2.0 許可證)。同時,微調數據通過 OpenAI API 生成,使用條款禁止將輸出用於訓練與 OpenAI 競爭的模型,但“競爭”定義尚不明確。
💡 使用建議
- 在使用 MathJSON 和上下文服從問答時,建議使用較低的溫度,以獲得更準確的結果。
- 在使用封閉上下文格式的提示時,確保按照指定的格式編寫,並在指令塊中添加“Don't make up answers if you don't know.”,以避免模型編造答案。
- 若需要更長的回覆,可提供詳細的提示並明確字數要求,或使用多步驟指令確認的方式。