Polyglot Ko 1.3b
模型简介
模型特点
模型能力
使用案例
🚀 Polyglot-Ko-1.3B
Polyglot-Ko-1.3B 是由 EleutherAI polyglot 团队打造的大规模韩语自回归语言模型。它在韩语自然语言处理任务中表现出色,能为韩语相关的文本生成、理解等任务提供强大支持。
🚀 快速开始
你可以使用 AutoModelForCausalLM
类轻松加载该模型:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/polyglot-ko-1.3b")
model = AutoModelForCausalLM.from_pretrained("EleutherAI/polyglot-ko-1.3b")
✨ 主要特性
- 大规模韩语数据训练:基于 863GB 的韩语数据进行训练,能很好地适应韩语的语言特点和表达习惯。
- 特定架构设计:采用 24 层 Transformer 架构,模型维度为 2048,前馈维度为 8192,能有效处理复杂的语言任务。
- 位置编码技术:应用 Rotary Position Embedding (RoPE) 技术,提升模型对位置信息的处理能力。
📦 安装指南
此部分原文档未提供具体安装步骤,暂不展示。
💻 使用示例
基础用法
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/polyglot-ko-1.3b")
model = AutoModelForCausalLM.from_pretrained("EleutherAI/polyglot-ko-1.3b")
高级用法
此部分原文档未提供高级用法示例,暂不展示。
📚 详细文档
模型描述
Polyglot-Ko 是由 EleutherAI polyglot 团队开发的一系列大规模韩语自回归语言模型。
属性 | 详情 |
---|---|
模型参数数量 \(n_{parameters}\) | 1,331,810,304 |
层数 \(n_{layers}\) | 24 |
模型维度 \(d_{model}\) | 2048 |
前馈维度 \(d_{ff}\) | 8192 |
头数 \(n_{heads}\) | 16 |
每个头的维度 \(d_{head}\) | 128 |
上下文长度 \(n_{ctx}\) | 2048 |
词汇表大小 \(n_{vocab}\) | 30,003 / 30,080 |
位置编码 | Rotary Position Embedding (RoPE) |
RoPE 维度 | 64 |
该模型由 24 层 Transformer 层组成,模型维度为 2048,前馈维度为 8192。模型维度被划分为 16 个头,每个头的维度为 128。Rotary Position Embedding (RoPE) 应用于每个头的 64 个维度。该模型使用 30003 的分词词汇表进行训练。
训练数据
Polyglot-Ko-1.3B 在 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 call | < 1.0 | github.com/clovaai/ClovaCall |
네이버情感电影语料库 | < 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-1.3B 在 256 个 A100 GPU 上,使用 GPT-NeoX 框架,对 2130 亿个标记进行了 102,000 步的训练。它作为自回归语言模型进行训练,使用交叉熵损失来最大化预测下一个标记的可能性。
评估结果
我们在 KOBEST 数据集 上对 Polyglot-Ko-1.3B 进行了评估,该数据集是一个包含 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-1.3b' \
--tasks kobest_copa,kobest_hellaswag,kobest_boolq,kobest_sentineg,kobest_wic \
--num_fewshot $YOUR_NUM_FEWSHOT \
--batch_size $YOUR_BATCH_SIZE \
--device $YOUR_DEVICE \
--output_path $/path/to/output/
COPA (F1)
模型 | 参数 | 0-shot | 5-shot | 10-shot | 50-shot |
---|---|---|---|---|---|
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-shot | 5-shot | 10-shot | 50-shot |
---|---|---|---|---|---|
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-shot | 5-shot | 10-shot | 50-shot |
---|---|---|---|---|---|
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-shot | 5-shot | 10-shot | 50-shot |
---|---|---|---|---|---|
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-shot | 5-shot | 10-shot | 50-shot |
---|---|---|---|---|---|
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.465 | 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 许可证,版本 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.



