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.



