davidkim205
commited on
Commit
β’
de3081b
1
Parent(s):
666183d
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
- ko
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
tags:
|
7 |
+
- finetuned
|
8 |
+
|
9 |
+
---
|
10 |
+
# komt : korean multi task instruction tuning model
|
11 |
+
![multi task instruction tuning.jpg](https://github.com/davidkim205/komt/assets/16680469/c7f6ade7-247e-4b62-a94f-47e19abea68e)
|
12 |
+
|
13 |
+
Recently, due to the success of ChatGPT, numerous large language models have emerged in an attempt to catch up with ChatGPT's capabilities.
|
14 |
+
However, when it comes to Korean language performance, it has been observed that many models still struggle to provide accurate answers or generate Korean text effectively.
|
15 |
+
This study addresses these challenges by introducing a multi-task instruction technique that leverages supervised datasets from various tasks to create training data for Large Language Models (LLMs).
|
16 |
+
|
17 |
+
## Model Details
|
18 |
+
|
19 |
+
* **Model Developers** : davidkim(changyeon kim)
|
20 |
+
* **Repository** : https://github.com/davidkim205/komt
|
21 |
+
* **Model Architecture** : The komt-mistral-7b-v1 is is a fine-tuned version of the Mistral-7B-Instruct-v0.1.
|
22 |
+
|
23 |
+
## Dataset
|
24 |
+
korean multi-task instruction dataset
|
25 |
+
|
26 |
+
## Hardware and Software
|
27 |
+
- nvidia driver : 535.54.03
|
28 |
+
- CUDA Version: 12.2
|
29 |
+
|
30 |
+
## Training
|
31 |
+
Refer https://github.com/davidkim205/komt
|
32 |
+
|
33 |
+
## Usage
|
34 |
+
```
|
35 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
36 |
+
from transformers import TextStreamer, GenerationConfig
|
37 |
+
|
38 |
+
model_name='davidkim205/komt-mistral-7b-v1'
|
39 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
|
40 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
41 |
+
streamer = TextStreamer(tokenizer)
|
42 |
+
|
43 |
+
def gen(x):
|
44 |
+
generation_config = GenerationConfig(
|
45 |
+
temperature=0.8,
|
46 |
+
top_p=0.8,
|
47 |
+
top_k=100,
|
48 |
+
max_new_tokens=1024,
|
49 |
+
early_stopping=True,
|
50 |
+
do_sample=True,
|
51 |
+
)
|
52 |
+
q = f"[INST]{x} [/INST]"
|
53 |
+
gened = model.generate(
|
54 |
+
**tokenizer(
|
55 |
+
q,
|
56 |
+
return_tensors='pt',
|
57 |
+
return_token_type_ids=False
|
58 |
+
).to('cuda'),
|
59 |
+
generation_config=generation_config,
|
60 |
+
pad_token_id=tokenizer.eos_token_id,
|
61 |
+
eos_token_id=tokenizer.eos_token_id,
|
62 |
+
streamer=streamer,
|
63 |
+
)
|
64 |
+
result_str = tokenizer.decode(gened[0])
|
65 |
+
|
66 |
+
start_tag = f"\n\n### Response: "
|
67 |
+
start_index = result_str.find(start_tag)
|
68 |
+
|
69 |
+
if start_index != -1:
|
70 |
+
result_str = result_str[start_index + len(start_tag):].strip()
|
71 |
+
return result_str
|
72 |
+
|
73 |
+
print(gen('μ μ£Όλλ₯Ό 1λ°2μΌλ‘ νΌμ μ¬ννλ €κ³ νλλ° μ¬ν μ½μ€λ₯Ό λ§λ€μ΄μ€'))
|
74 |
+
```
|
75 |
+
output
|
76 |
+
```
|
77 |
+
<s> [INST]μ μ£Όλλ₯Ό 1λ°2μΌλ‘ νΌμ μ¬ννλ €κ³ νλλ° μ¬ν μ½μ€λ₯Ό λ§λ€μ΄μ€ [/INST]1λ° 2μΌ μ¬ν μ½μ€
|
78 |
+
μ μ£Ό μ¬ν μ½μ€λ λ€μκ³Ό κ°μ΅λλ€:
|
79 |
+
|
80 |
+
첫째 λ :
|
81 |
+
* μμΉ¨: μ μ£Όμ μ λΌλ‘ μ΄λνμ¬ νλΌμ° κ΅λ¦½κ³΅μμ λμ°©ν©λλ€. μ€λ₯Έμͺ½ λ°μκ΅ κ΄μ₯μμ λμ λλ λ§₯μ£Όμμ μ°Ύμ ν λ³μ λ§₯μ£Όλ₯Ό λ§μκ³ κ³λ¨μΌλ‘ μ¬λΌκ° νλΌμ° μ μμ λμ°©ν©λλ€.
|
82 |
+
* μ μ¬: μ μμμ κ³λ¨μ λ΄λ €μ μ€λμ μμΉν 골λͺ©μμ μμμ μ¦κΉλλ€. μ κ°, κ³°ν, μ 볡 λ± λ§μλ μ μ£Ό νΉμ°λ¬Όμ λ§λ³΄λ©° νλ§μ μ¦κΉλλ€.
|
83 |
+
* μ€ν: μ€λμμ λ¨ννμ¬ λ¨μμͺ½ μ μ£Όλ‘ μ΄λν©λλ€. λ¨μμͺ½ μ μ£Όλ μ¬μ μμ° κ²½κ΄κ³Ό λ°±μ¬μ₯, μλ¦λ€μ΄ λ°λ€ λ± μλ¦λ€μ΄ νκ΄μ΄ μλ κ³³μ
λλ€. μμμ μλ°ν©λλ€.
|
84 |
+
|
85 |
+
λμ§Έ λ :
|
86 |
+
* μμΉ¨: λ¨μμͺ½ μ μ£Όμμ λΆμμͺ½ μ μ£Όλ‘ μ΄λν©λλ€. μ΄ μ§μμ νΈλ₯Έ μλ ν΄λ³κ³Ό ν¬λͺ
ν λ°λ€κ° νΌμ³μ Έ μλ μλ¦λ€μ΄ νκ΄μ
λλ€. μμμμ μμΉ¨μ λ¨Ήκ³ λ°λ€λ‘ ν₯νμ¬ ν΄λ³μμ ν΄μμ μ·¨ν©λλ€.
|
87 |
+
* μ μ¬: λΆμμͺ½ μ μ£Όμ μλ°λ€μμ μμν λ°λ€λ₯Ό 보며 ν λΌμ ν΄μ°λ¬Όμ λ§λ³΄κ³ κ³μ μ λ°λΌ ν΄μ°λ¬Ό μ리λ₯Ό μ¦κΉλλ€.
|
88 |
+
* μ€ν: λ¨μμͺ½ μ μ£Όμμ μ΄λνμ¬ μμͺ½ μ μ£Όλ‘ μ΄λν©λλ€. μμͺ½ μ μ£Όλ μ λ²½κ³Ό μμ ν΄λ³, μμκ»λΌμ λ μ μ λ± λ
νΉν κ²½κ΄μ΄ μλ κ³³μ
λλ€. μ΄κ³³μμλ μμͺ½ μ μ£Όμ λνμ μΈ λͺ
μμΈ μ²λμ¬λ₯Ό λ°©λ¬Ένκ³ μμͺ½ μ μ£Όμ μλ¦λ€μ΄ νκ΄μ κ°μν©λλ€.
|
89 |
+
* μ λ
: μμͺ½ μ μ£Όμμ μ μ£Ό μλ‘ μ΄λνμ¬ ν λΌμ μ μ£Ό νΉμ°λ¬Όμ λ§λ³΄κ³ λμ°©ν μ μ£Ό λμ¬μμ μ λ
μ μ¦κΉλλ€.
|
90 |
+
* μΌκ°: μ μ£Ό μμ λμ¬μμ μΌκ° νλμ μ¦κΈ°λ©° 1λ° 2μΌμ μ¬νμ λ§λ¬΄λ¦¬ν©λλ€.
|
91 |
+
|
92 |
+
μ΄λ κ² μ μ£Όλ₯Ό 1λ° 2μΌλ‘ νΌμ μ¬ννλ©΄ μ μ£Όμ μλ¦λ€μ΄ νκ΄, νΈλ₯Έ μλ ν΄λ³, ν¬λͺ
ν λ°λ€ λ±μ κ²½νν μ μμ΅λλ€.
|
93 |
+
```
|
94 |
+
## Evaluation
|
95 |
+
For objective model evaluation, we initially used EleutherAI's lm-evaluation-harness but obtained unsatisfactory results. Consequently, we conducted evaluations using ChatGPT, a widely used model, as described in [Self-Alignment with Instruction Backtranslation](https://arxiv.org/pdf/2308.06502.pdf) and [Three Ways of Using Large Language Models to Evaluate Chat](https://arxiv.org/pdf/2308.06259.pdf) .
|
96 |
+
|
97 |
+
|
98 |
+
| model | score | average(0~5) | percentage |
|
99 |
+
| --------------------------------------- |---------| ------------ | ---------- |
|
100 |
+
| gpt-3.5-turbo(close) | 147 | 3.97 | 79.45% |
|
101 |
+
| naver Cue(close) | 140 | 3.78 | 75.67% |
|
102 |
+
| clova X(close) | 136 | 3.67 | 73.51% |
|
103 |
+
| WizardLM-13B-V1.2(open) | 96 | 2.59 | 51.89% |
|
104 |
+
| Llama-2-7b-chat-hf(open) | 67 | 1.81 | 36.21% |
|
105 |
+
| Llama-2-13b-chat-hf(open) | 73 | 1.91 | 38.37% |
|
106 |
+
| nlpai-lab/kullm-polyglot-12.8b-v2(open) | 70 | 1.89 | 37.83% |
|
107 |
+
| kfkas/Llama-2-ko-7b-Chat(open) | 96 | 2.59 | 51.89% |
|
108 |
+
| beomi/KoAlpaca-Polyglot-12.8B(open) | 100 | 2.70 | 54.05% |
|
109 |
+
| **komt-llama2-7b-v1 (open)(ours)** | **117** | **3.16** | **63.24%** |
|
110 |
+
| **komt-llama2-13b-v1 (open)(ours)** | **129** | **3.48** | **69.72%** |
|
111 |
+
| **komt-llama-30b-v1 (open)(ours)** | **129** | **3.16** | **63.24%** |
|
112 |
+
| **komt-mistral-7b-v1 (open)(ours)** | **131** | **3.54** | **70.81%** |
|
113 |
+
|