🚀 Llama3-70B-Chinese-Chat
Llama3-70B-Chinese-Chat是一款針對中英雙語用戶進行全參數微調的大語言模型。它基於Meta-Llama-3-70B-Instruct模型,在約10萬條中英偏好對數據集上進行訓練,中文能力超越ChatGPT,媲美GPT-4。
🚀 快速開始
❗️❗️❗️注意:為保證最佳性能,我們未對模型身份進行微調。因此,諸如“你是誰”或“誰開發了你”等詢問,可能會得到隨機且不一定準確的回答。
模型更新
- 🚀🚀🚀 [2024年5月9日] 我們很高興推出Llama3-70B-Chinese-Chat!該模型在約10萬條中英偏好對的混合數據集上進行全參數微調,根據C-Eval和CMMLU結果顯示,其中文性能超越ChatGPT並與GPT-4相當。
- 🔥 我們在 wangshenzhi/llama3-70b-chinese-chat-ollama-q4 提供了Llama3-70B-Chinese-Chat的官方q4_0 GGUF版本的Ollama模型!運行以下命令即可快速使用該模型:
ollama run wangshenzhi/llama3-70b-chinese-chat-ollama-q4:latest
。
- 🔥 我們在 wangshenzhi/llama3-70b-chinese-chat-ollama-q8 提供了Llama3-70B-Chinese-Chat的官方q8_0 GGUF版本的Ollama模型!運行以下命令即可快速使用該模型:
ollama run wangshenzhi/llama3-70b-chinese-chat-ollama-q8:latest
。
- 🔥 我們在 shenzhi-wang/Llama3-70B-Chinese-Chat-GGUF-4bit 提供了Llama3-70B-Chinese-Chat的官方q4_0 GGUF版本。
- 🌟 如果你在中國,可以從我們的 gitee倉庫 下載我們的模型。
- 🌟 感謝Gitee的支持,我們推出了在線演示:https://ai.gitee.com/shenzhi-wang/llama3-70b-chinese-chat 。你需要使用邀請碼
llama3
登錄你的Gitee賬戶。
✨ 主要特性
Llama3-70B-Chinese-Chat是首批針對中英雙語用戶進行指令微調的大語言模型之一,具備角色扮演、工具使用和數學計算等多種能力,基於 meta-llama/Meta-Llama-3-70B-Instruct 模型構建。
🎉根據C-Eval和CMMLU的結果,Llama3-70B-Chinese-Chat的中文性能顯著超越ChatGPT,與GPT-4相當!
模型信息
🔧 技術細節
模型介紹
這是首批專門為中英雙語用戶微調的大語言模型之一,基於 Meta-Llama-3-70B-Instruct 模型。使用的微調算法是ORPO [1]。
我們的Llama3-70B-Chinese-Chat模型在包含超過10萬條偏好對的數據集上進行訓練,中英數據比例大致相等。該數據集即將發佈。
與原始的 Meta-Llama-3-70B-Instruct 模型相比,Llama3-70B-Chinese-Chat模型大大減少了“中文問題英文回答”以及回答中中英文混雜的問題。此外,Llama3-70B-Chinese-Chat在角色扮演、函數調用和數學計算方面表現出色。
與我們的 Llama3-8B-Chinese-Chat 模型相比,Llama3-70B-Chinese-Chat的參數更多,性能有顯著提升。如果你喜歡我們的 Llama3-8B-Chinese-Chat,那麼Llama3-70B-Chinese-Chat絕對值得一試!
[1] Hong, Jiwoo, Noah Lee, and James Thorne. "Reference-free Monolithic Preference Optimization with Odds Ratio." arXiv preprint arXiv:2403.07691 (2024).
訓練框架
LLaMA-Factory。
訓練詳情
- 輪數:3
- 學習率:1.5e-6
- 學習率調度器類型:餘弦
- 預熱比例:0.1
- 截斷長度(即上下文長度):8192
- orpo beta(即ORPO論文中的 $\lambda$):0.05
- 全局批量大小:128
- 微調類型:全參數
- 優化器:paged_adamw_32bit
📚 詳細文檔
基準測試結果
我們使用C-Eval [2] 和CMMLU [3] 來評估大語言模型的中文性能。ChatGPT和GPT-4的結果取自2024年5月10日訪問的 C-Eval排行榜 和 CMMLU排行榜。
模型 |
C-Eval平均(測試集) |
C-Eval困難平均(測試集) |
CMMLU準確率 |
ChatGPT |
54.4 |
41.4 |
55.51 |
GPT-4 |
68.7 |
54.9 |
70.95 |
Llama3-70B-Chinese-Chat |
66.1 |
55.2 |
70.28 |
C-Eval困難是一個獨特的基準測試,包含C-Eval中數學、物理和化學的8個困難科目。[2]
[2] Huang, Yuzhen, et al. "C-eval: A multi-level multi-discipline chinese evaluation suite for foundation models." Advances in Neural Information Processing Systems 36 (2024).
[3] Li, Haonan, et al. "Cmmlu: Measuring massive multitask language understanding in chinese." arXiv preprint arXiv:2306.09212 (2023).
💻 使用示例
基礎用法
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "shenzhi-wang/Llama3-70B-Chinese-Chat"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id, torch_dtype="auto", device_map="auto"
)
messages = [
{"role": "user", "content": "寫一首詩吧"},
]
input_ids = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
outputs = model.generate(
input_ids,
max_new_tokens=8192,
do_sample=True,
temperature=0.6,
top_p=0.9,
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))
示例展示
模型在不同場景下的生成示例如下:
角色扮演 [點擊展開]
包含扮演艾薩克·牛頓、泰勒·斯威夫特、魯智深、莎士比亞、諸葛亮等角色的對話示例。
函數調用 [點擊展開]
展示了使用不同工具(如`internet_search`、`directly_answer`、`send_email`等)的調用示例。
數學計算 [點擊展開]
包含多個數學問題的解答示例,如年齡計算、約瑟夫斯問題、雞兔同籠問題等。
常識/邏輯/情感分析 [點擊展開]
包含多個實際場景的分析示例,如生物樣本丟失案件分析、週末活動安排分析等。
弱智吧 [點擊展開]
包含一些有趣的問答示例,如藍牙耳機維修、午餐肉食用時間等問題。
寫作 [點擊展開]
包含模仿魯迅風格的短文、不同風格的關於未來城市可持續發展的短文、對聯創作、郵件生成等示例。
代碼 [點擊展開]
包含在bash腳本中獲取路徑最後一級文件夾名稱、將Python腳本轉換為bash腳本、解決0/1揹包問題等代碼示例。
📄 許可證
本模型使用 Llama-3 License 許可證。
📚 引用
如果我們的Llama3-70B-Chinese-Chat對你有幫助,請參考以下引用:
@misc {shenzhi_wang_2024,
author = {Wang, Shenzhi and Zheng, Yaowei and Wang, Guoyin and Song, Shiji and Huang, Gao},
title = {Llama3-70B-Chinese-Chat (Revision 3f5a0d4)},
year = 2024,
url = {https://huggingface.co/shenzhi-wang/Llama3-70B-Chinese-Chat},
doi = {10.57967/hf/2315},
publisher = {Hugging Face}
}
🙏 致謝
非常感謝Chang Liu在收集示例方面提供的幫助。