hyunwoongko
commited on
Commit
•
956dd33
1
Parent(s):
a5dd571
Update README.md
Browse files
README.md
CHANGED
@@ -7,7 +7,7 @@ tags:
|
|
7 |
license: apache-2.0
|
8 |
|
9 |
---
|
10 |
-
# Polyglot-Ko-
|
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.
|
@@ -31,15 +31,38 @@ dimensions of each head. The model is trained with a tokenization vocabulary of
|
|
31 |
|
32 |
## Training data
|
33 |
|
34 |
-
Polyglot-Ko was trained on 1.2TB
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
|
|
|
|
37 |
|
38 |
-
|
|
|
39 |
|
40 |
## How to use
|
41 |
|
42 |
-
This model can be easily loaded using the `AutoModelForCausalLM`
|
43 |
|
44 |
```python
|
45 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
@@ -48,37 +71,16 @@ tokenizer = AutoTokenizer.from_pretrained("EleutherAI/polyglot-ko-3.8b")
|
|
48 |
model = AutoModelForCausalLM.from_pretrained("EleutherAI/polyglot-ko-3.8b")
|
49 |
```
|
50 |
|
51 |
-
##
|
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 |
-
|
67 |
|
68 |
-
|
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-
|
82 |
--tasks kobest_copa,kobest_hellaswag \
|
83 |
--num_fewshot $YOUR_NUM_FEWSHOT \
|
84 |
--batch_size $YOUR_BATCH_SIZE \
|
@@ -86,35 +88,35 @@ python main.py \
|
|
86 |
--output_path $/path/to/output/
|
87 |
```
|
88 |
|
89 |
-
**We
|
90 |
|
91 |
### COPA (F1)
|
92 |
|
93 |
-
| Model
|
94 |
-
|
95 |
-
| [
|
96 |
-
| [
|
97 |
-
| [
|
98 |
-
| [EleutherAI/polyglot-ko-1.3b](https://huggingface.co/EleutherAI/polyglot-ko-1.3b)
|
99 |
| **[EleutherAI/polyglot-ko-3.8b](https://huggingface.co/EleutherAI/polyglot-ko-3.8b) (this)** | **3.8B** | **0.7595** | **0.7608** | **0.7638** | **0.7788** |
|
100 |
|
101 |
-
<img src="https://user-images.githubusercontent.com/19511788/
|
102 |
|
103 |
### HellaSwag (F1)
|
104 |
|
105 |
-
| Model | params |
|
106 |
|------------------------------------------------------------------------------------------------|--------|--------|--------|---------|---------|
|
|
|
|
|
107 |
| [facebook/xglm-7.5B](https://huggingface.co/facebook/xglm-7.5B) | 7.5B | 0.4261 | 0.437 | 0.4409 | 0.4517 |
|
108 |
-
| [
|
109 |
-
| [
|
110 |
-
| [EleutherAI/polyglot-ko-1.3b](https://huggingface.co/EleutherAI/polyglot-ko-1.3b) (ours) | 1.3B | 0.4013 | 0.3984 | 0.417 | 0.4416 |
|
111 |
-
| [EleutherAI/polyglot-ko-3.8b](https://huggingface.co/EleutherAI/polyglot-ko-3.8b) **(this)** | **3.8B** | **0.4438** | **0.4786** | **0.4737** | **0.4822** |
|
112 |
|
113 |
-
<img src="https://user-images.githubusercontent.com/19511788/
|
114 |
|
115 |
-
|
116 |
|
117 |
-
|
118 |
|
119 |
## Citation and Related Information
|
120 |
### BibTeX entry
|
@@ -146,7 +148,6 @@ See the License for the specific language governing permissions and
|
|
146 |
limitations under the License.
|
147 |
```
|
148 |
|
149 |
-
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.
|
150 |
-
|
151 |
### Acknowledgement
|
152 |
-
|
|
|
|
7 |
license: apache-2.0
|
8 |
|
9 |
---
|
10 |
+
# Polyglot-Ko-1.3B
|
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.
|
|
|
31 |
|
32 |
## Training data
|
33 |
|
34 |
+
Polyglot-Ko was trained on 863 GB of Korean language data (1.2TB before processing), a large-scale dataset curated by [TUNiB](https://tunib.ai/). The data collection process has abided by South Korean laws. This dataset was collected for the purpose of training Polyglot-Ko models, so it will not be released for public use.
|
35 |
+
|
36 |
+
| Source |Size (GB) | Link |
|
37 |
+
|-------------------------------------|---------|------------------------------------------|
|
38 |
+
| Korean blog posts | 682.3 | - |
|
39 |
+
| Korean news dataset | 87.0 | - |
|
40 |
+
| Modu corpus | 19.0 |corpus.korean.go.kr |
|
41 |
+
| Korean patent dataset | 26.4 | - |
|
42 |
+
| Korean Q & A dataset | 18.1 | - |
|
43 |
+
| KcBert dataset | 12.7 | github.com/Beomi/KcBERT |
|
44 |
+
| Korean fiction dataset | 6.1 | - |
|
45 |
+
| Korean online comments | 4.2 | - |
|
46 |
+
| Korean wikipedia | 1.4 | ko.wikipedia.org |
|
47 |
+
| Clova Call | < 1.0 | github.com/clovaai/ClovaCall |
|
48 |
+
| Naver sentiment movie corpus | < 1.0 | github.com/e9t/nsmc |
|
49 |
+
| Korean hate speech dataset | < 1.0 | - |
|
50 |
+
| Open subtitles | < 1.0 | opus.nlpl.eu/OpenSubtitles.php |
|
51 |
+
| AIHub various tasks datasets | < 1.0 |aihub.or.kr |
|
52 |
+
| Standard Korean language dictionary | < 1.0 | stdict.korean.go.kr/main/main.do |
|
53 |
+
|
54 |
+
Furthermore, in order to avoid the model memorizing and generating personally identifiable information (PII) in the training data, we masked out the following sensitive information in the pre-processing stage:
|
55 |
|
56 |
+
* `<|acc|>` : bank account number
|
57 |
+
* `<|rrn|>` : resident registration number
|
58 |
+
* `<|tell|>` : phone number
|
59 |
|
60 |
+
## Training procedure
|
61 |
+
Polyglot-Ko-3.8B was trained for 219 billion tokens over 105,000 steps on 256 A100 GPUs with the [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.
|
62 |
|
63 |
## How to use
|
64 |
|
65 |
+
This model can be easily loaded using the `AutoModelForCausalLM` class:
|
66 |
|
67 |
```python
|
68 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
71 |
model = AutoModelForCausalLM.from_pretrained("EleutherAI/polyglot-ko-3.8b")
|
72 |
```
|
73 |
|
74 |
+
## Evaluation results
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
We evaluate Polyglot-Ko-3.8B on [KOBEST dataset](https://arxiv.org/abs/2204.04541), a benchmark with 5 downstream tasks, against comparable models skt/ko-gpt-trinity-1.2B-v0.5, kakaobrain/kogpt and facebook/xglm-7.5B, using the prompts provided in the paper.
|
77 |
|
78 |
+
The following tables show the results when the number of few-shot examples differ. You can reproduce these results using the [polyglot branch of lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness/tree/polyglot) and the following scripts. For a fair comparison, all models were run under the same conditions and using the same prompts. In the tables, `n` refers to the number of few-shot examples.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
```console
|
81 |
python main.py \
|
82 |
--model gpt2 \
|
83 |
+
--model_args pretrained='EleutherAI/polyglot-ko-3.8b' \
|
84 |
--tasks kobest_copa,kobest_hellaswag \
|
85 |
--num_fewshot $YOUR_NUM_FEWSHOT \
|
86 |
--batch_size $YOUR_BATCH_SIZE \
|
|
|
88 |
--output_path $/path/to/output/
|
89 |
```
|
90 |
|
91 |
+
**We show model performance on COPA and HellaSwag. On the other three tasks, the evaluated models all performed similarly close to random guessing.**
|
92 |
|
93 |
### COPA (F1)
|
94 |
|
95 |
+
| Model | params | n=0 | n=5 | n=10 | n=50 |
|
96 |
+
|----------------------------------------------------------------------------------------------|--------|--------|--------|---------|---------|
|
97 |
+
| [skt/ko-gpt-trinity-1.2B-v0.5](https://huggingface.co/skt/ko-gpt-trinity-1.2B-v0.5) | 1.2B | 0.6696 | 0.6477 | 0.6419 | 0.6514 |
|
98 |
+
| [kakaobrain/kogpt](https://huggingface.co/kakaobrain/kogpt) | 6.0B | 0.7345 | 0.7287 | 0.7277 | 0.7479 |
|
99 |
+
| [facebook/xglm-7.5B](https://huggingface.co/facebook/xglm-7.5B) | 7.5B | 0.6723 | 0.6731 | 0.6769 | 0.7119 |
|
100 |
+
| [EleutherAI/polyglot-ko-1.3b](https://huggingface.co/EleutherAI/polyglot-ko-1.3b) | 1.3B | 0.7196 | 0.7193 | 0.7204 | 0.7206 |
|
101 |
| **[EleutherAI/polyglot-ko-3.8b](https://huggingface.co/EleutherAI/polyglot-ko-3.8b) (this)** | **3.8B** | **0.7595** | **0.7608** | **0.7638** | **0.7788** |
|
102 |
|
103 |
+
<img src="https://user-images.githubusercontent.com/19511788/192492558-d22d3cb0-dbbb-46fd-83e0-8bf9d81e4e9f.png" width="800px">
|
104 |
|
105 |
### HellaSwag (F1)
|
106 |
|
107 |
+
| Model | params |n=0 | n=5 | n=10 | n=50 |
|
108 |
|------------------------------------------------------------------------------------------------|--------|--------|--------|---------|---------|
|
109 |
+
| [skt/ko-gpt-trinity-1.2B-v0.5](https://huggingface.co/skt/ko-gpt-trinity-1.2B-v0.5) | 1.2B | 0.4036 | 0.4 | 0.4011 | 0.4214 |
|
110 |
+
| [kakaobrain/kogpt](https://huggingface.co/kakaobrain/kogpt) | 6.0B | 0.4599 | 0.456 | 0.4616 | 0.4754 |
|
111 |
| [facebook/xglm-7.5B](https://huggingface.co/facebook/xglm-7.5B) | 7.5B | 0.4261 | 0.437 | 0.4409 | 0.4517 |
|
112 |
+
| [EleutherAI/polyglot-ko-1.3b](https://huggingface.co/EleutherAI/polyglot-ko-1.3b) | 1.3B | 0.4013 | 0.3984 | 0.417 | 0.4416 |
|
113 |
+
| **[EleutherAI/polyglot-ko-3.8b](https://huggingface.co/EleutherAI/polyglot-ko-3.8b) (this)** | **3.8B** | **0.4438** | **0.4786** | **0.4737** | **0.4822** |
|
|
|
|
|
114 |
|
115 |
+
<img src="https://user-images.githubusercontent.com/19511788/192492568-f7114c8a-3967-41fa-a589-31fe07bad85d.png" width="800px">
|
116 |
|
117 |
+
## Limitations and Biases
|
118 |
|
119 |
+
Polyglot has been trained to optimize next token prediction. Language models such as this are often used for a wide variety of tasks and it is important to be aware of possible unexpected outcomes. For instance, Polyglot will not always return the most factual or accurate response but the most statistically likely one. Polyglot may produce socially unacceptable or offensive content. We recommend having a human curator or other filtering mechanism to censor sensitive content.
|
120 |
|
121 |
## Citation and Related Information
|
122 |
### BibTeX entry
|
|
|
148 |
limitations under the License.
|
149 |
```
|
150 |
|
|
|
|
|
151 |
### Acknowledgement
|
152 |
+
|
153 |
+
This project was made possible thanks to the computing resources from [Stability.ai](https://stability.ai), and thanks to [TUNiB](https://tunib.ai) for providing a large-scale Korean dataset for this work.
|