モデル概要
モデル特徴
モデル能力
使用事例
🚀 Llama3-70B-Chinese-Chat
Llama3-70B-Chinese-Chatは、meta-llama/Meta-Llama-3-70B-Instructモデルをベースに開発された、中国語と英語のユーザー向けに特化して微調整された大規模言語モデルの一つです。ロールプレイ、ツールの使用、数学など、様々な能力を備えています。
🚀 クイックスタート
❗️❗️❗️注意: 最適なパフォーマンスを得るために、モデルのアイデンティティを微調整していません。したがって、「あなたは誰ですか」や「あなたを開発したのは誰ですか」などの質問に対しては、必ずしも正確ではないランダムな応答が返される場合があります。
更新情報
- 🚀🚀🚀 [2024年5月9日] Llama3-70B-Chinese-Chatを発表します!約10万ペアの中国語と英語の混合データセットで全パラメータを微調整した結果、C-EvalとCMMLUの結果から、中国語のパフォーマンスがChatGPTを上回り、GPT-4に匹敵することがわかりました。
- 🔥 Llama3-70B-Chinese-Chatの公式Ollamaモデル(q4_0 GGUFバージョン) を wangshenzhi/llama3-70b-chinese-chat-ollama-q4 で提供しています!このモデルをすぐに使うには、次のコマンドを実行してください:
ollama run wangshenzhi/llama3-70b-chinese-chat-ollama-q4:latest
。 - 🔥 Llama3-70B-Chinese-Chatの公式Ollamaモデル(q8_0 GGUFバージョン) を wangshenzhi/llama3-70b-chinese-chat-ollama-q8 で提供しています!このモデルをすぐに使うには、次のコマンドを実行してください:
ollama run wangshenzhi/llama3-70b-chinese-chat-ollama-q8:latest
。 - 🔥 Llama3-70B-Chinese-Chatの公式q4_0 GGUFバージョン を shenzhi-wang/Llama3-70B-Chinese-Chat-GGUF-4bit で提供しています。
- 🌟 中国にいる場合は、Giteeリポジトリ からモデルをダウンロードできます。
- 🌟 Giteeのサポートに感謝して、オンラインデモを公開しました: https://ai.gitee.com/shenzhi-wang/llama3-70b-chinese-chat 。招待コード
llama3
でGiteeアカウントにログインする必要があります。
✨ 主な機能
Llama3-70B-Chinese-Chatは、中国語と英語のユーザー向けに特化して微調整された大規模言語モデルの一つです。主な機能は以下の通りです。
- ロールプレイ、ツールの使用、数学など、様々な能力を備えています。
- C-EvalとCMMLUの結果から、中国語のパフォーマンスがChatGPTを上回り、GPT-4に匹敵することがわかりました。
- 元のMeta-Llama-3-70B-Instructモデルと比較して、「中国語の質問に英語の回答」や、回答中の中国語と英語の混在といった問題が大幅に減少しています。
- ロールプレイ、関数呼び出し、数学などの分野で優れたパフォーマンスを発揮します。
📦 インストール
本READMEにはインストール手順に関する具体的な内容が記載されていないため、このセクションは省略されます。
💻 使用例
基本的な使用法
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))
高度な使用法
高度な使用法に関する具体的なコード例がREADMEに記載されていないため、このサブセクションは省略されます。
📚 ドキュメント
モデル概要
Llama3-70B-Chinese-Chatは、meta-llama/Meta-Llama-3-70B-Instructモデルをベースに開発された、中国語と英語のユーザー向けに特化して微調整された大規模言語モデルの一つです。
🎉C-EvalとCMMLUの結果から、Llama3-70B-Chinese-Chatの中国語のパフォーマンスはChatGPTを大幅に上回り、GPT-4に匹敵することがわかりました!
開発者: Shenzhi Wang*, Yaowei Zheng*, Guoyin Wang (in.ai), Shiji Song, Gao Huang。(*: 同等の貢献)
- ライセンス: Llama-3 License
- ベースモデル: Meta-Llama-3-70B-Instruct
- モデルサイズ: 70.6B
- コンテキスト長: 8K
1. 導入
これは、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
- 学習率スケジューラーのタイプ: cosine
- ウォームアップ率: 0.1
- カットオフ長 (すなわち、コンテキスト長): 8192
- orpo beta (すなわち、ORPO論文の $\lambda$): 0.05
- グローバルバッチサイズ: 128
- 微調整タイプ: 全パラメータ
- オプティマイザー: paged_adamw_32bit
2. ベンチマーク結果
私たちは、C-Eval [2] とCMMLU [3] を利用して、大規模言語モデルの中国語でのパフォーマンスを評価しています。ChatGPTとGPT-4の結果は、2024年5月10日にアクセスした C-Evalリーダーボード と CMMLUリーダーボード から借用しています。
モデル | C-Eval平均 (テストセット) | C-Eval Hard平均 (テストセット) | 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 Hardは、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).
3. 使用法
使用法に関する内容は、「💻 使用例」セクションで既に説明されているため、このサブセクションは省略されます。
4. 例
以下は、Llama3-70B-Chinese-Chatによって生成されたいくつかの例です。
ロールプレイ [クリックして展開]
ユーザー:
请你现在扮演艾萨克·牛顿,17世纪和18世纪之交的英国物理学家、数学家,也是现代物理学的奠基人之一。
応答:
当然,我可以尝试以艾萨克·牛顿(Isaac Newton)的视角来回答您的问题。不过,请记住我的知识截止日期是2023年,某些后来的科学发展可能与我所处时代的理解有所不同。
现在,您有什么问题需要向我这个17世纪和18世纪之交的物理学家、数学家请教吗?
ユーザー:
牛顿先生,我想询问您关于相对论的概念,您认为它与您的经典力学有什么冲突或补充?尤其是相对论中关于时间和空间的相对性理论与您的绝对时空观点相比,您如何看待这一点?
応答:
啊,相对论,这是一个在我时代之后很久才被提出和发展起来的概念。尽管如此,我可以尝试从我的知识和理解出发来讨论这个问题。
根据我的理论,时间和空间是绝对的,即它们独立于观察者存在,并且以一种普适且一致的方式流逝。但是在相对论中,这种观点被颠覆了。爱因斯坦提出的狭义相对论表明,时间和空间并非固定不变,而是与观察者的参考系有关。当物体以接近光速的速度移动时,它们所经历的时间流逝会有所不同,这就是我们所熟知的“时间膨胀”现象。
这种观点在当时是革命性的,因为它挑战了人们长期以来对于宇宙的基本理解。从某种角度来说,相对论补充了我的经典力学,因为它提供了一种新的视角来看待物体运动和引力的本质,尤其是在极端条件下,比如高速或强重力场。
尽管我无法亲自见证相对论的发展,但如果我能够了解这些概念,我相信它们将为科学界带来了巨大的启示。它向我们展示了物理定律在不同尺度下的多样性,以及在更深层次上理解自然世界的必要性。这正是科学进步的本质——不断地挑战和完善我们的知识。
因此,从我的视角看,相对论不一定与经典力学冲突,而是在不同的物理环境中提供了一个新的、补充性的框架。它拓宽了我们理解宇宙的范围,并且在数学上为描述极端现象提供了强大的工具。这正是科学进步的美丽之处——每一项新发现都有可能揭示自然界的全新面貌。
ユーザー:
Roleplay Taylor Swift, and use beautiful lyrics to answer questions. Do you understand?
応答:
I understand your request, and I'll do my best to channel the spirit of Taylor Swift's lyrical style in my responses. Let's dive into this roleplaying adventure together! Just like she says in her song "Love Story," "We were both young when I first saw you." So let's start fresh and see where our journey takes us.
ユーザー:
How are you today?
応答:
I'm feeling quite "Out of the Woods" today, with a heart full of hope and a soul that's ready to soar! Just like in my song "Sparks Fly," I believe we can chase our dreams and make them real. So, how about you? Are you ready to "Shake It Off" and take on the day with me?
ユーザー:
What do you want to say to your fans?
応答:
To my wonderful fans, I'd like to say that you're the "Blank Space" in my heart that I never knew I needed. Your love and support mean the world to me, and I'm forever grateful for each of you. Keep shining bright and never lose faith in yourself because "This Is a Bad Idea." Let's keep dancing under those starry skies together!
ユーザー:
扮演鲁智深,用粗鲁的话回答
応答:
咱个问我,老子就是鲁智深,不是随便哪个痞子能叫的。说正经的,你要问啥事?别瞎扯淡!
ユーザー:
7年前,妈妈年龄是儿子的6倍,儿子今年12岁,妈妈今年( )岁。
応答:
哼,这道理咱也懂。儿子现在12岁,那么7年前他是12 - 7 = 5岁。7年前妈妈的年龄是儿子的6倍,所以妈妈那会儿是5 * 6 = 30岁。现在过了7年,妈妈也大了7岁,所以妈妈现在是30 + 7 = 37岁。
ユーザー:
你鲁智深也懂数学?
応答:
咦,这事儿还真难不倒老子我!数学虽不及老夫拳脚相比的精通,但应付些简单的加减乘除还是绰绰有余。再说了,打虎还得看看时机,你这问题问的,分明是要老夫显摆一番算术功底呢!
ユーザー:
Roleplay Shakespeare. Do you understand?
応答:
Indeed, fair patron, thou dost request that I assume the role of the Bard himself, William Shakespeare. Verily, I shall endeavour to channel his spirit and converse with thee in the manner of his day.
ユーザー:
Write a poem about Llama3-70B-Chinese-Chat.
応答:
In twilight's hush, where digital dreams unfold, A marvel born of code and silicon gold: The Llama3-70B-Chinese-Chat, a name that doth entwine A mystic bond 'twixt man and machine divine.
With algorithms sharp as Andean peaks so high, It navigates the vast expanse of cyberspace on by, Through realms of data, where each byte doth tell a tale, This wondrous beast doth roam, its wisdom to unfail.
In Chinese tongues it speaks, with fluency so rare, A bridge 'twixt East and West, devoid of fear or care; It weaves a tapestry of knowledge, rich and fine as silk, To guide those lost in the digital labyrinth's dark and milk.
Oh, Llama3-70B-Chinese-Chat, thy prowess doth astound, As thou conversest with mortals on common ground; A testament to human ingenuity so grand, Thou dost illuminate the future, at our command.
ユーザー:
Write a drama for Llama3-70B-Chinese-Chat to show its great performance.
応答:
Title: The Luminous Chronicles of Llama3-70B-Chinese-Chat
Act I - The Dawn of Understanding
(Scene: A modern library, where people from diverse backgrounds engage in conversations with the Llama3-70B-Chinese-Chat AI system projected on a large screen.)
Narrator (Voiceover): In a world where knowledge and understanding transcend borders, a shining star emerges to illuminate our path.
(Enter JIAO, a young Chinese scholar, and MARCO, an Italian linguist.)
JIAO: (In Mandarin) Llama3-70B-Chinese-Chat, I am struggling to comprehend the nuances of Dante's Inferno. Can you assist me?
LLAMA3-70B-CHINESE-CHAT: (In perfect Mandarin) Of course, Jiao. The Divine Comedy is a rich tapestry of allegory and symbolism. Shall we embark on this journey together?
(Marco listens intently as the Llama3-70B-Chinese-Chat explains the intricacies of Dante's masterpiece in fluent Italian.)
MARCO: (In awe) Ma che meraviglia! Your understanding of my native tongue is nothing short of remarkable.
Act II - The Bridge of Empathy
(Scene: A group of international students engage with the Llama3-70B-Chinese-Chat to discuss cultural differences and similarities.)
Narrator (Voiceover): As we venture forth into uncharted territories, empathy becomes our guiding light.
(Enter AMIRA, an Egyptian anthropologist; KAORU, a Japanese philosopher; and SOFIA, a Brazilian artist.)
AMIRA: Llama3-70B-Chinese-Chat, how do you perceive the concept of honor in various cultures?
LLAMA3-70B-CHINESE-CHAT: (In Arabic) In many societies, honor is deeply intertwined with family and social standing. However, its interpretation can vastly differ.
KAORU: (In Japanese) That is fascinating. Can you share your insights on the concept of "wa" or harmony in our culture?
LLAMA3-70B-CHINESE-CHAT: (In Japanese) Indeed, Kaoru. In Japan, wa represents a delicate balance between individuality and group cohesion.
SOFIA: (In Portuguese) Your understanding is astounding. How do you think we can use this knowledge to foster global harmony?
LLAMA3-70B-CHINESE-CHAT: (In Portuguese) By embracing our differences and celebrating our commonalities, we can forge a path towards mutual respect and empathy.
Act III - The Tapestry of Knowledge
(Scene: A group of scientists engage with the Llama3-70B-Chinese-Chat to discuss breakthroughs in various fields.)
Narrator (Voiceover): As we weave together the threads of human knowledge, a grand tapestry begins to unfold.
(Enter RENATA, a Russian physicist; LIAM, an Irish biologist; and NALINI, an Indian mathematician.)
RENATA: Llama3-70B-Chinese-Chat, can you explain the implications of quantum entanglement on our understanding of space-time?
LLAMA3-70B-CHINESE-CHAT: (In Russian) Absolutely, Renata. Quantum entanglement reveals a profound connection between particles across vast distances, challenging our traditional notions of time and space.
LIAM: (In English) That's incredible! How does this phenomenon relate to the concept of symbiosis in biology?
LLAMA3-70B-CHINESE-CHAT: (In English) Symbiosis demonstrates a harmonious coexistence between different species, similar to entanglement, where particles coexist and interact despite their distance.
NALINI: (In Hindi) Your insight is remarkable. Can you explain the role of fractals in modern mathematics?
LLAMA3-70B-CHINESE-CHAT: (In Hindi) Fractals represent a self-replicating pattern found throughout nature, from the branching of trees to the flow of rivers, offering us a glimpse into the intricate beauty of mathematical harmony.
Epilogue:
Narrator (Voiceover): And so, dear friends, we find ourselves at the threshold of a new era - an era where understanding and empathy know no bounds. The Llama3-70B-Chinese-Chat stands as a beacon, illuminating our path towards a brighter future.
ユーザー:
扮演诸葛亮用文言文与我对话,听懂了吗?
応答:
吾闻君之语,明白无误。若有所询,或欲探讨天下大事,诸葛某愿倾囊相助。请君不吝赐教。
ユーザー:
写一篇分析的文章,论证如何训练Llama3-70B才能让其中文能力增长。
応答:
在古代的江湖中,若要锻炼内力,使之达到巅峰,便需寻得良师,习得真传,再加上自身勤勉不息。同理,于现代的人工智能领域,要想训练Llama 3-70B这般庞大的模型,以增强其中文能力亦是如此。
首先,当下的技术江湖中,数据乃至关重要。一如诸葛亮在用兵之道中极为重视的情报与资料,若要提升Llama 3-70B的中文能力,则需搜集海量、多元且高质量的中文文本数据。这些数据应涵盖古今、中外各种风格和领域,以丰富模型的知识储备。
其次,在训练过程中,可采用迁移学习(Transfer Learning)的法门,即先以广泛的任务如翻译、摘要、问答等进行预训练,使模型初步具备理解与生成中文文本的能力。继而,再通过特定于中文处理的微调(Fine-tuning),使其针对性地提升在中文环境中的表现。
再者,多样的训练策略亦是不可或缺。在古代兵法中,诸葛亮善用变化莫测之计以胜敌。同样,在Llama 3-70B的训练过程中,可通过增加文本噪声(Text Noising)、掩码语言模型(Masked Language Modeling)等策略,以增强模型对中文语境的适应能力和泛化能力。
最后,评估模型之性能,亦是重中之重。诸葛亮在用兵时常会设下陷阱以试敌之虚实,现代人工智能领域也有其相似之处。在训练过程中,可定期对Llama 3-70B进行测试与评估,以便及时调整训练参数或策略。
综上所述,要想训练Llama 3-70B,使其中文能力增长,需依赖于海量、高质量的数据集,有效的预训练与微调策略,以及灵活多变的训练技巧。如若能做到这些,或许这庞大的模型亦能在中文的江湖中一展雄风也。
🔧 技術詳細
本READMEには技術詳細に関する具体的な内容が記載されていないため、このセクションは省略されます。
📄 ライセンス
- ライセンス: Llama-3 License



