bzantium commited on
Commit
7504230
1 Parent(s): 022867b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +148 -2
README.md CHANGED
@@ -1,4 +1,150 @@
1
  ---
2
- language: ko
 
 
 
 
 
 
3
  ---
4
- - step : 100k
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - ko
4
+ tags:
5
+ - pytorch
6
+ - causal-lm
7
+ license: apache-2.0
8
+
9
  ---
10
+ # Polyglot-Ko-3.8B
11
+
12
+ ## Model Description
13
+ Polyglot-Ko is a series of large-scale Korean autoregressive language models made by the EleutherAI polyglot team. Polyglot-Ko-3.8B is the second one.
14
+
15
+ | Hyperparameter | Value |
16
+ |----------------------|----------------------------------------------------------------------------------------------------------------------------------------|
17
+ | \\(n_{parameters}\\) | 3,809,974,272 |
18
+ | \\(n_{layers}\\) | 32 |
19
+ | \\(d_{model}\\) | 3072 |
20
+ | \\(d_{ff}\\) | 12,288 |
21
+ | \\(n_{heads}\\) | 24 |
22
+ | \\(d_{head}\\) | 128 |
23
+ | \\(n_{ctx}\\) | 2048 |
24
+ | \\(n_{vocab}\\) | 30,003 / 30,080 |
25
+ | Positional Encoding | [Rotary Position Embedding (RoPE)](https://arxiv.org/abs/2104.09864) |
26
+ | RoPE Dimensions | [64](https://github.com/kingoflolz/mesh-transformer-jax/blob/f2aa66e0925de6593dcbb70e72399b97b4130482/mesh_transformer/layers.py#L223) |
27
+
28
+ The model consists of 32 transformer layers with a model dimension of 3072, and a feedforward dimension of 12288. The model
29
+ dimension is split into 24 heads, each with a dimension of 128. Rotary Position Embedding (RoPE) is applied to 64
30
+ dimensions of each head. The model is trained with a tokenization vocabulary of 30003.
31
+
32
+ ## Training data
33
+
34
+ Polyglot-Ko was trained on 1.2TB Korean Dataset, a large-scale curated dataset created by [TUNiB](https://tunib.ai/).
35
+
36
+ ## Training procedure
37
+
38
+ Polyglot-Ko was trained for 219 billion tokens over 105,000 steps on 256 * A100 GPUs with [GPT-NeoX framework](https://github.com/EleutherAI/gpt-neox). It was trained as an autoregressive language model, using cross-entropy loss to maximize the likelihood of predicting the next token correctly.
39
+
40
+ ## How to use
41
+
42
+ This model can be easily loaded using the `AutoModelForCausalLM` functionality:
43
+
44
+ ```python
45
+ from transformers import AutoTokenizer, AutoModelForCausalLM
46
+
47
+ tokenizer = AutoTokenizer.from_pretrained("EleutherAI/polyglot-ko-3.8b")
48
+ model = AutoModelForCausalLM.from_pretrained("EleutherAI/polyglot-ko-3.8b")
49
+ ```
50
+
51
+ ## Data Risks
52
+
53
+ Polyglot models learn an inner representation of the various languages that can be used to extract features useful for downstream tasks.
54
+ The model is best at what it was pre-trained for, however, generating text from a prompt.
55
+
56
+ ### Privacy considerations
57
+ 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.
58
+
59
+ * `<|acc|>` : bank account number
60
+ * `<|rrn|>` : resident registration number
61
+ * `<|tell|>` : phone number
62
+
63
+ ### Limitations and Biases
64
+ 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.
65
+
66
+ 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.
67
+
68
+ ### Legal Restrictions
69
+ Since there are laws in many countries related to data collection, we will collect data with due regard to the laws of those countries.
70
+ Additionally, we plan to use the dataset to train our models, but we do not plan to make the dataset publicly available.
71
+
72
+ ## Evaluation results
73
+ We used the [KOBEST dataset](https://arxiv.org/abs/2204.04541), which consists of five Korean downstream tasks, for evaluation.
74
+ We added those tasks to [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) and utilized prompt templates described in the paper.
75
+ 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.
76
+ 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](https://github.com/EleutherAI/lm-evaluation-harness/tree/polyglot) and the following scripts.
77
+
78
+ ```console
79
+ python main.py \
80
+ --model gpt2 \
81
+ --model_args pretrained='EleutherAI/polyglot-ko-1.3b' \
82
+ --tasks kobest_copa,kobest_hellaswag \
83
+ --num_fewshot $YOUR_NUM_FEWSHOT \
84
+ --batch_size $YOUR_BATCH_SIZE \
85
+ --device $YOUR_DEVICE \
86
+ --output_path $/path/to/output/
87
+ ```
88
+
89
+ **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.**
90
+
91
+ ### COPA (F1)
92
+
93
+ | Model | params | 0-shot | 5-shot | 10-shot | 50-shot |
94
+ |----------------------------------------------------------------------------------------------|--------|--------|--------|---------|---------|
95
+ | [skt/ko-gpt-trinity-1.2B-v0.5](https://huggingface.co/skt/ko-gpt-trinity-1.2B-v0.5) &dagger; | 1.2B | 0.6696 | 0.6477 | 0.6419 | 0.6514 |
96
+ | [kakaobrain/kogpt](https://huggingface.co/kakaobrain/kogpt) &ast; | 6.0B | 0.7345 | 0.7287 | 0.7277 | 0.7479 |
97
+ | [EleutherAI/polyglot-ko-1.3b](https://huggingface.co/EleutherAI/polyglot-ko-1.3b) (ours) | 1.3B | 0.7196 | 0.7193 | 0.7204 | 0.7206 |
98
+ | [EleutherAI/polyglot-ko-3.8b](https://huggingface.co/EleutherAI/polyglot-ko-3.8b) (ours) | **3.8B** | **0.7595** | **0.7608** | **0.7638** | **0.7788** |
99
+
100
+ <img src="https://user-images.githubusercontent.com/19511788/192074406-7a84034d-4dd4-40f8-be55-28d76c711c89.png" width="800px">
101
+
102
+ ### HellaSwag (F1)
103
+
104
+ | Model | params | 0-shot | 5-shot | 10-shot | 50-shot |
105
+ |----------------------------------------------------------------------------------------------|--------|--------|--------|---------|---------|
106
+ | [skt/ko-gpt-trinity-1.2B-v0.5](https://huggingface.co/skt/ko-gpt-trinity-1.2B-v0.5) &dagger; | 1.2B | 0.4036 | 0.4 | 0.4011 | 0.4214 |
107
+ | [kakaobrain/kogpt](https://huggingface.co/kakaobrain/kogpt) &ast; | 6.0B | 0.4599 | 0.456 | 0.4616 | 0.4754 |
108
+ | [EleutherAI/polyglot-ko-1.3b](https://huggingface.co/EleutherAI/polyglot-ko-1.3b) (ours) | 1.3B | 0.4013 | 0.3984 | 0.417 | 0.4416 |
109
+ | [EleutherAI/polyglot-ko-3.8b](https://huggingface.co/EleutherAI/polyglot-ko-3.8b) (ours) | **3.8B** | **0.4438** | **0.4786** | **0.4737** | **0.4822** |
110
+
111
+ <img src="https://user-images.githubusercontent.com/19511788/192074409-ee8b3b99-7c8f-45eb-a71d-b0347d1b4f14.png" width="800px">
112
+
113
+ <p><strong>&dagger;</strong> 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.</p>
114
+
115
+ <p><strong>&ast;</strong> 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.</p>
116
+
117
+ ## Citation and Related Information
118
+ ### BibTeX entry
119
+ If you find our work useful, please consider citing:
120
+ ```bibtex
121
+ @misc{polyglot-ko,
122
+ title = {{Polyglot-Ko: Open-Source Korean Autoregressive Language Model}},
123
+ author = {Ko, Hyunwoong and Yang, Kichang and Ryu, Minho and Kim, Taekyun and Yang, Seungmu and Hyun, jiwung and Park, Sungho},
124
+ url = {https://www.github.com/eleutherai/polyglot},
125
+ month = {9},
126
+ year = {2022},
127
+ }
128
+ ```
129
+
130
+ ### Licensing
131
+ All our models are licensed under the terms of the Apache License 2.0.
132
+
133
+ ```
134
+ Licensed under the Apache License, Version 2.0 (the "License");
135
+ you may not use this file except in compliance with the License.
136
+ You may obtain a copy of the License at
137
+
138
+ http://www.apache.org/licenses/LICENSE-2.0
139
+
140
+ Unless required by applicable law or agreed to in writing, software
141
+ distributed under the License is distributed on an "AS IS" BASIS,
142
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
143
+ See the License for the specific language governing permissions and
144
+ limitations under the License.
145
+ ```
146
+
147
+ 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.
148
+
149
+ ### Acknowledgement
150
+ This project would not have been possible without the computing resources provided by [Stability.ai](https://stability.ai). Thanks for providing a large amount of GPU resources. Furthermore, thanks to [TUNiB](https://tunib.ai) for providing a large-scale Korean dataset for this work.