Edit model card

Polyglot-Ko-1.3B

Model Description

Polyglot-Ko is a series of large-scale Korean autoregressive language models made by the EleutherAI polyglot team. Polyglot-Ko-1.3B is the first and the smallest one.

Hyperparameter Value
nparametersn_{parameters} 1,331,810,304
nlayersn_{layers} 24
dmodeld_{model} 2,048
dffd_{ff} 8,192
nheadsn_{heads} 16
dheadd_{head} 128
nctxn_{ctx} 2,048
nvocabn_{vocab} 30,003 / 30,080
Positional Encoding Rotary Position Embedding (RoPE)
RoPE Dimensions 64

The model consists of 24 transformer layers with a model dimension of 2048, and a feedforward dimension of 8192. The model dimension is split into 16 heads, each with a dimension of 128. Rotary Position Embedding (RoPE) is applied to 64 dimensions of each head. The model is trained with a tokenization vocabulary of 30003.

Training data

Polyglot-Ko was trained on 1.2TB Korean Dataset, a large-scale curated dataset created by TUNiB.

Training procedure8

Polyglot-Ko was trained for 213 billion tokens over 102,000 steps on 256 * A100 GPUs with GPT-NeoX framework. It was trained as an autoregressive language model, using cross-entropy loss to maximize the likelihood of predicting the next token correctly.

How to use

This model can be easily loaded using the AutoModelForCausalLM functionality:

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("EleutherAI/polyglot-ko-1.3b")
model = AutoModelForCausalLM.from_pretrained("EleutherAI/polyglot-ko-1.3b")

Data Risks

Polyglot models learn an inner representation of the various languages that can be used to extract features useful for downstream tasks. The model is best at what it was pre-trained for, however, generating text from a prompt.

Privacy considerations

General training algorithms for pre-trained language models have many hazards, that memorize personal information in training data. We added the following tokens to vocabulary to mitigate privacy problems and replaced much personal information with these tokens in data preprocessing steps.

  • <|acc|> : bank account number
  • <|rrn|> : resident registration number
  • <|tell|> : phone number

Limitations and Biases

The core functionality of Polyglot is taking a string of text and predicting the next token. While language models are widely used for tasks other than this, there are a lot of unknowns with this work. When prompting Polyglot it is important to remember that the statistically most likely next token is often not the token that produces the most "accurate" text. Never depend upon Polyglot to produce factually accurate output. Depending upon the use case, Polyglot may produce socially unacceptable text.

As with all language models, it is hard to predict in advance how Polyglot will respond to particular prompts, and offensive content may occur without warning. We recommend having a human curate or filter the outputs before releasing them, both to censor undesirable content and to improve the quality of the results.

Legal Restrictions

Since there are laws in many countries related to data collection, we will collect data with due regard to the laws of those countries. Additionally, we plan to use the dataset to train our models, but we do not plan to make the dataset publicly available.

Evaluation results

We used the KOBEST dataset, which consists of five Korean downstream tasks, for evaluation. We added those tasks to lm-evaluation-harness and utilized prompt templates described in the paper. We evaluted our model as well as two other Korean language models, i.e., skt/ko-gpt-trinity-1.2B-v0.5 and kakaobrain/kogpt for comparison. The following tables show the results when the number of few-shot examples differ. You can reproduce these results using polyglot branch of lm-evaluation-harness and the following scripts.

python main.py \
   --model gpt2 \
   --model_args pretrained='EleutherAI/polyglot-ko-1.3b' \
   --tasks kobest_copa,kobest_hellaswag \
   --num_fewshot $YOUR_NUM_FEWSHOT \
   --batch_size $YOUR_BATCH_SIZE \
   --device $YOUR_DEVICE \
   --output_path $/path/to/output/

We decided to show only COPA and HellaSwag from KOBEST because evaluated models performed similarly to random guesses or with high variance on other tasks.

COPA (F1)

Model params 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
EleutherAI/polyglot-ko-1.3b (ours) 1.3B 0.7196 0.7193 0.7204 0.7206
EleutherAI/polyglot-ko-3.8b (ours) 3.8B 0.7595 0.7608 0.7638 0.7788

HellaSwag (F1)

Model params 0-shot 5-shot 10-shot 50-shot
skt/ko-gpt-trinity-1.2B-v0.5 1.2B 0.4036 0.4 0.4011 0.4214
kakaobrain/kogpt * 6.0B 0.4599 0.456 0.4616 0.4754
EleutherAI/polyglot-ko-1.3b (ours) 1.3B 0.4013 0.3984 0.417 0.4416
EleutherAI/polyglot-ko-3.8b (ours) 3.8B 0.4438 0.4786 0.4737 0.4822

The model card of this model provides evaluation results for the KOBEST dataset, but when we evaluated the model with the prompts described in the paper, we can't get similar results to it. Therefore, we checked the KOBEST paper and found that the results were similar to the fine-tuning results reported in the paper. Because we evaluated by prompt-based generation without fine-tuning the model, the results provided by the model card for the this model may differ.

* Since this model does not provide evaluation results with KOBEST dataset, we evaluated the model using lm-evaluation-harness ourselves. you can reproduce this result using the source code included in the polyglot branch of lm-evaluation-harness.

Citation and Related Information

BibTeX entry

If you find our work useful, please consider citing:

@misc{polyglot-ko,
  title = {{Polyglot-Ko: Open-Source Korean Autoregressive Language Model}},
  author = {Ko, Hyunwoong and Yang, Kichang and Ryu, Minho and Kim, Taekyun and Yang, Seungmu and Hyun, jiwung and Park, Sungho},
  url = {https://www.github.com/eleutherai/polyglot},
  month = {9},
  year = {2022},
}

Licensing

All our models are licensed under the terms of the 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.

However, the model has the potential to generate unpredictable text as mentioned. Therefore, we are not responsible for any damages resulting from the use of the model.

Acknowledgement

This project would not have been possible without the computing resources provided by Stability.ai. Thanks for providing a large amount of GPU resources. Furthermore, thanks to TUNiB for providing a large-scale Korean dataset for this work.

Downloads last month
875
Hosted inference API
This model can be loaded on the Inference API on-demand.

Space using EleutherAI/polyglot-ko-1.3b