Polyglot Ko 5.8b
模型简介
模型特点
模型能力
使用案例
🚀 Polyglot-Ko-5.8B
Polyglot-Ko-5.8B 是由 EleutherAI polyglot 团队打造的大规模韩语自回归语言模型。该模型在韩语自然语言处理任务中展现出强大的能力,可用于文本生成、问答系统等多种应用场景。
🚀 快速开始
你可以使用 AutoModelForCausalLM
类轻松加载此模型:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/polyglot-ko-5.8b")
model = AutoModelForCausalLM.from_pretrained("EleutherAI/polyglot-ko-5.8b")
✨ 主要特性
- 大规模参数:拥有 58.85 亿个参数,能够学习到丰富的语言知识。
- 先进的位置编码:采用 Rotary Position Embedding (RoPE) 技术,提升模型对序列位置的感知能力。
- 高质量训练数据:在 863GB 的韩语数据上进行训练,数据来源广泛且经过严格筛选。
📚 详细文档
模型描述
Polyglot-Ko 是 EleutherAI polyglot 团队开发的一系列大规模韩语自回归语言模型。
属性 | 详情 |
---|---|
模型参数数量 | 5,885,059,072 |
层数 | 28 |
模型维度 | 4096 |
前馈维度 | 16,384 |
头数 | 16 |
头维度 | 256 |
上下文长度 | 2,048 |
词汇表大小 | 30,003 / 30,080 |
位置编码 | Rotary Position Embedding (RoPE) |
RoPE 维度 | 64 |
该模型由 28 个 Transformer 层组成,模型维度为 4096,前馈维度为 16384。模型维度被划分为 16 个头,每个头的维度为 256。Rotary Position Embedding (RoPE) 应用于每个头的 64 个维度。模型使用 30003 的分词词汇表进行训练。
训练数据
Polyglot-Ko-5.8B 在 863GB 的韩语数据(处理前为 1.2TB)上进行训练,这些数据由 TUNiB 精心整理。数据收集过程遵循韩国法律。该数据集是为训练 Polyglot-Ko 模型而收集的,因此不会公开提供。
数据来源 | 大小 (GB) | 链接 |
---|---|---|
韩语博客文章 | 682.3 | - |
韩语新闻数据集 | 87.0 | - |
Modu 语料库 | 26.4 | corpus.korean.go.kr |
韩语专利数据集 | 19.0 | - |
韩语问答数据集 | 18.1 | - |
KcBert 数据集 | 12.7 | github.com/Beomi/KcBERT |
韩语小说数据集 | 6.1 | - |
韩语在线评论 | 4.2 | - |
韩语维基百科 | 1.4 | ko.wikipedia.org |
Clova 通话数据 | < 1.0 | github.com/clovaai/ClovaCall |
Naver 情感电影语料库 | < 1.0 | github.com/e9t/nsmc |
韩语仇恨言论数据集 | < 1.0 | - |
开放字幕 | < 1.0 | opus.nlpl.eu/OpenSubtitles.php |
AIHub 各种任务数据集 | < 1.0 | aihub.or.kr |
标准韩语词典 | < 1.0 | stdict.korean.go.kr/main/main.do |
此外,为避免模型记忆和生成训练数据中的个人身份信息 (PII),我们在预处理阶段屏蔽了以下敏感信息:
<|acc|>
: 银行账号<|rrn|>
: 居民登记号<|tell|>
: 电话号码
训练过程
Polyglot-Ko-5.8B 在 256 个 A100 GPU 上使用 GPT-NeoX 框架 进行了 320,000 步的训练,处理了 1720 亿个标记。它作为自回归语言模型进行训练,使用交叉熵损失来最大化预测下一个标记的可能性。
评估结果
我们在 KOBEST 数据集 上对 Polyglot-Ko-3.8B 进行了评估,该数据集包含 5 个下游任务。我们将其与其他可比模型(如 skt/ko-gpt-trinity-1.2B-v0.5、kakaobrain/kogpt 和 facebook/xglm-7.5B)进行了比较,使用论文中提供的提示。
以下表格显示了不同少样本示例数量下的评估结果。你可以使用 lm-evaluation-harness 的 polyglot 分支 和以下脚本重现这些结果。为了进行公平比较,所有模型都在相同条件下运行,并使用相同的提示。在表格中,n
表示少样本示例的数量。
在 WiC 数据集上,所有模型的表现都接近随机。
python main.py \
--model gpt2 \
--model_args pretrained='EleutherAI/polyglot-ko-3.8b' \
--tasks kobest_copa,kobest_hellaswag \
--num_fewshot $YOUR_NUM_FEWSHOT \
--batch_size $YOUR_BATCH_SIZE \
--device $YOUR_DEVICE \
--output_path $/path/to/output/
COPA (F1)
模型 | 参数 | 0 样本 | 5 样本 | 10 样本 | 50 样本 |
---|---|---|---|---|---|
skt/ko-gpt-trinity-1.2B-v0.5 | 1.2B | 0.6696 | 0.6477 | 0.6419 | 0.6514 |
kakaobrain/kogpt | 6.0B | 0.7345 | 0.7287 | 0.7277 | 0.7479 |
facebook/xglm-7.5B | 7.5B | 0.6723 | 0.6731 | 0.6769 | 0.7119 |
EleutherAI/polyglot-ko-1.3b | 1.3B | 0.7196 | 0.7193 | 0.7204 | 0.7206 |
EleutherAI/polyglot-ko-3.8b | 3.8B | 0.7595 | 0.7608 | 0.7638 | 0.7788 |
EleutherAI/polyglot-ko-5.8b (本模型) | 5.8B | 0.7745 | 0.7676 | 0.7775 | 0.7887 |
EleutherAI/polyglot-ko-12.8b | 12.8B | 0.7937 | 0.8108 | 0.8037 | 0.8369 |
HellaSwag (F1)
模型 | 参数 | 0 样本 | 5 样本 | 10 样本 | 50 样本 |
---|---|---|---|---|---|
skt/ko-gpt-trinity-1.2B-v0.5 | 1.2B | 0.5243 | 0.5272 | 0.5166 | 0.5352 |
kakaobrain/kogpt | 6.0B | 0.5590 | 0.5833 | 0.5828 | 0.5907 |
facebook/xglm-7.5B | 7.5B | 0.5665 | 0.5689 | 0.5565 | 0.5622 |
EleutherAI/polyglot-ko-1.3b | 1.3B | 0.5247 | 0.5260 | 0.5278 | 0.5427 |
EleutherAI/polyglot-ko-3.8b | 3.8B | 0.5707 | 0.5830 | 0.5670 | 0.5787 |
EleutherAI/polyglot-ko-5.8b (本模型) | 5.8B | 0.5976 | 0.5998 | 0.5979 | 0.6208 |
EleutherAI/polyglot-ko-12.8b | 12.8B | 0.5954 | 0.6306 | 0.6098 | 0.6118 |
BoolQ (F1)
模型 | 参数 | 0 样本 | 5 样本 | 10 样本 | 50 样本 |
---|---|---|---|---|---|
skt/ko-gpt-trinity-1.2B-v0.5 | 1.2B | 0.3356 | 0.4014 | 0.3640 | 0.3560 |
kakaobrain/kogpt | 6.0B | 0.4514 | 0.5981 | 0.5499 | 0.5202 |
facebook/xglm-7.5B | 7.5B | 0.4464 | 0.3324 | 0.3324 | 0.3324 |
EleutherAI/polyglot-ko-1.3b | 1.3B | 0.3552 | 0.4751 | 0.4109 | 0.4038 |
EleutherAI/polyglot-ko-3.8b | 3.8B | 0.4320 | 0.5263 | 0.4930 | 0.4038 |
EleutherAI/polyglot-ko-5.8b (本模型) | 5.8B | 0.4356 | 0.5698 | 0.5187 | 0.5236 |
EleutherAI/polyglot-ko-12.8b | 12.8B | 0.4818 | 0.6041 | 0.6289 | 0.6448 |
SentiNeg (F1)
模型 | 参数 | 0 样本 | 5 样本 | 10 样本 | 50 样本 |
---|---|---|---|---|---|
skt/ko-gpt-trinity-1.2B-v0.5 | 1.2B | 0.6065 | 0.6878 | 0.7280 | 0.8413 |
kakaobrain/kogpt | 6.0B | 0.3747 | 0.8942 | 0.9294 | 0.9698 |
facebook/xglm-7.5B | 7.5B | 0.3578 | 0.4471 | 0.3964 | 0.5271 |
EleutherAI/polyglot-ko-1.3b | 1.3B | 0.6790 | 0.6257 | 0.5514 | 0.7851 |
EleutherAI/polyglot-ko-3.8b | 3.8B | 0.4858 | 0.7950 | 0.7320 | 0.7851 |
EleutherAI/polyglot-ko-5.8b (本模型) | 5.8B | 0.3394 | 0.8841 | 0.8808 | 0.9521 |
EleutherAI/polyglot-ko-12.8b | 12.8B | 0.9117 | 0.9015 | 0.9345 | 0.9723 |
WiC (F1)
模型 | 参数 | 0 样本 | 5 样本 | 10 样本 | 50 样本 |
---|---|---|---|---|---|
skt/ko-gpt-trinity-1.2B-v0.5 | 1.2B | 0.3290 | 0.4313 | 0.4001 | 0.3621 |
kakaobrain/kogpt | 6.0B | 0.3526 | 0.4775 | 0.4358 | 0.4061 |
facebook/xglm-7.5B | 7.5B | 0.3280 | 0.4903 | 0.4945 | 0.3656 |
EleutherAI/polyglot-ko-1.3b | 1.3B | 0.3297 | 0.4850 | 0.4650 | 0.3290 |
EleutherAI/polyglot-ko-3.8b | 3.8B | 0.3390 | 0.4944 | 0.4203 | 0.3835 |
EleutherAI/polyglot-ko-5.8b (本模型) | 5.8B | 0.3913 | 0.4688 | 0.4189 | 0.3910 |
EleutherAI/polyglot-ko-12.8b | 12.8B | 0.3985 | 0.3683 | 0.3307 | 0.3273 |
局限性和偏差
Polyglot-Ko 经过训练以优化下一个标记的预测。这样的语言模型通常用于各种各样的任务,因此了解可能出现的意外结果非常重要。例如,Polyglot-Ko 并不总是返回最真实或准确的响应,而是返回最具统计可能性的响应。此外,Polyglot 可能会产生社会不可接受或冒犯性的内容。我们建议使用人工审核或其他过滤机制来审查敏感内容。
引用和相关信息
BibTeX 引用
如果你认为我们的工作有用,请考虑引用:
@misc{ko2023technical,
title={A Technical Report for Polyglot-Ko: Open-Source Large-Scale Korean Language Models},
author={Hyunwoong Ko and Kichang Yang and Minho Ryu and Taekyoon Choi and Seungmu Yang and jiwung Hyun and Sungho Park},
year={2023},
eprint={2306.02254},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
许可证
我们所有的模型都根据 Apache License 2.0 许可。
根据 Apache License, Version 2.0(“许可证”)许可;
除非遵守许可证,否则不得使用此文件。
你可以在以下网址获取许可证副本:
http://www.apache.org/licenses/LICENSE-2.0
除非适用法律要求或书面同意,否则根据许可证分发的软件按“原样”分发,
不附带任何形式的明示或暗示保证。
请参阅许可证以了解管理权限和限制的具体语言。
致谢
这个项目得益于 Stability.ai 提供的计算资源,以及 TUNiB 为这项工作提供的大规模韩语数据集。
📄 许可证
本项目采用 Apache License 2.0 许可证。具体内容如下:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.



