davidkim205 commited on
Commit
a8ba5f5
โ€ข
1 Parent(s): 9877db9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +302 -2
README.md CHANGED
@@ -1,9 +1,309 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  library_name: peft
3
  ---
4
- ## Training procedure
 
5
 
6
- ### Framework versions
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
 
 
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  - PEFT 0.4.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language:
3
+ - en
4
+ - ko
5
+ pipeline_tag: text-generation
6
+ inference: false
7
+ tags:
8
+ - facebook
9
+ - meta
10
+ - pytorch
11
+ - llama
12
+ - llama-2
13
+ - llama-2-chat
14
+ license: apache-2.0
15
  library_name: peft
16
  ---
17
+ # komt-llama-2-7b-lora
18
+ This model fine-tuned the aaa model using PEFT-LoRA.
19
 
20
+ The "komt-llama-2-7b" model was developed using a multi-task instruction technique aimed at enhancing Korean language performance. For more details, please refer to the GitHub Repository.
21
+ Please refer below for more detailed information.
22
+
23
+ For more detailed information, please refer to the https://huggingface.co/davidkim205/komt-Llama-2-7b-chat-hf.
24
+
25
+ ## Model Details
26
+
27
+ * **Model Developers** : davidkim(changyeon kim)
28
+ * **Repository** : https://github.com/davidkim205/komt
29
+ * **Lora target modules** : q_proj, o_proj, v_proj, gate_proj, down_proj, k_proj, up_proj
30
+ * **Model Size** : 80MB
31
+ * **Model Architecture** : komt-llama-2-7b is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning by multi-task instruction
32
+ ## Dataset
33
+ korean multi-task instruction dataset
34
+
35
+ ## Prompt Template
36
+ ```
37
+ ### instruction: {prompt}
38
+
39
+ ### Response:
40
+ ```
41
+ Examples:
42
+ ```
43
+ ### instruction: ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ ์–ผ๋งˆ์ธ๊ฐ€์š”?
44
+
45
+ ### Response:
46
+
47
+ ```
48
+ response:
49
+ ```
50
+ ### instruction: ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ ์–ผ๋งˆ์ธ๊ฐ€์š”?
51
+
52
+ ### Response: ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ 2๋…„์ž…๋‹ˆ๋‹ค. ์ด ๊ธฐ๊ฐ„ ๋™์•ˆ ๊ฒ€์‚ฌ๋ฅผ ๋ฐ›์ง€ ์•Š์œผ๋ฉด ๊ณผํƒœ๋ฃŒ๊ฐ€ ๋ถ€๊ณผ๋ฉ๋‹ˆ๋‹ค. ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ 2013๋…„ 12์›” 31์ผ๋ถ€ํ„ฐ ์‹œํ–‰๋˜์—ˆ์Šต๋‹ˆ๋‹ค
53
+ ```
54
+
55
+ ## Usage
56
+
57
+ After downloading from GitHub, please install as follows:
58
+ ```
59
+ git clone https://github.com/davidkim205/komt
60
+ cd komt
61
+ pip install -r lora/requirements_lora.txt
62
+
63
+ ```
64
+ * Requirements Python >=3.8. Linux distribution (Ubuntu, MacOS, etc.) + CUDA > 10.0.
65
+ Refer https://github.com/TimDettmers/bitsandbytes#tldr
66
+
67
+ ```
68
+ import torch
69
+
70
+ from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
71
+ from transformers import StoppingCriteria, StoppingCriteriaList
72
+ from transformers import TextStreamer, GenerationConfig
73
+ from peft import PeftModel, PeftConfig
74
+
75
+ class LocalStoppingCriteria(StoppingCriteria):
76
 
77
+ def __init__(self, tokenizer, stop_words = []):
78
+ super().__init__()
79
 
80
+ stops = [tokenizer(stop_word, return_tensors='pt', add_special_tokens = False)['input_ids'].squeeze() for stop_word in stop_words]
81
+ print('stop_words', stop_words)
82
+ print('stop_words_ids', stops)
83
+ self.stop_words = stop_words
84
+ self.stops = [stop.cuda() for stop in stops]
85
+ self.tokenizer = tokenizer
86
+ def _compare_token(self, input_ids):
87
+ for stop in self.stops:
88
+ if len(stop.size()) != 1:
89
+ continue
90
+ stop_len = len(stop)
91
+ if torch.all((stop == input_ids[0][-stop_len:])).item():
92
+ return True
93
+
94
+ return False
95
+ def _compare_decode(self, input_ids):
96
+ input_str = self.tokenizer.decode(input_ids[0])
97
+ for stop_word in self.stop_words:
98
+ if input_str.endswith(stop_word):
99
+ return True
100
+ return False
101
+
102
+ def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor):
103
+ input_str = self.tokenizer.decode(input_ids[0])
104
+ for stop_word in self.stop_words:
105
+ if input_str.endswith(stop_word):
106
+ return True
107
+ return False
108
+
109
+ #
110
+ # config
111
+ peft_model_name = 'davidkim205/komt-Llama-2-7b-chat-hf-lora'
112
+ model_name = 'davidkim205/komt-Llama-2-7b-chat-hf'
113
+ instruction_prefix = "### instruction: "
114
+ input_prefix = "### input: "
115
+ answer_prefix = "### Response: "
116
+ endoftext = "<|end|>"
117
+ stop_words = [endoftext, '<s>', '###']
118
+ generation_config = GenerationConfig(
119
+ temperature=0.9,
120
+ top_p=0.7,
121
+ top_k=100,
122
+ max_new_tokens=2048,
123
+ early_stopping=True,
124
+ do_sample=True,
125
+ )
126
+ #
127
+ # create model
128
+ config = PeftConfig.from_pretrained(peft_model_name)
129
+ bnb_config = BitsAndBytesConfig(
130
+ load_in_4bit=True,
131
+ bnb_4bit_use_double_quant=True,
132
+ bnb_4bit_quant_type="nf4",
133
+ bnb_4bit_compute_dtype=torch.bfloat16
134
+ )
135
+ model = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=bnb_config,
136
+ device_map="auto")
137
+ model = PeftModel.from_pretrained(model, peft_model_name)
138
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
139
+ stopping_criteria = StoppingCriteriaList([LocalStoppingCriteria(tokenizer=tokenizer, stop_words=stop_words)])
140
+ streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
141
+ model.eval()
142
+
143
+ #
144
+ # generate
145
+ prompt = f"### instruction: ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ ์–ผ๋งˆ์ธ๊ฐ€์š”?.\n\n### Response:"
146
+ gened = model.generate(
147
+ **tokenizer(
148
+ prompt,
149
+ return_tensors='pt',
150
+ return_token_type_ids=False
151
+ ).to('cuda'),
152
+ generation_config=generation_config,
153
+ eos_token_id=model.config.eos_token_id,
154
+ stopping_criteria=stopping_criteria,
155
+ streamer=streamer
156
+ )
157
+ output_text = tokenizer.decode(gened[0], skip_special_tokens=True)
158
+
159
+ print('--------------------')
160
+ print(output_text)
161
+
162
+ ```
163
+ response:
164
+ ```
165
+ nlp๋Š” ์ž์—ฐ์–ด ์ฒ˜๋ฆฌ์˜ ์•ฝ์ž๋กœ, ์ž์—ฐ์–ด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ธ๊ฐ„๊ณผ ์ปดํ“จํ„ฐ ๊ฐ„์˜ ์ƒํ˜ธ ์ž‘์šฉ์„ ๋‹ค๋ฃจ๋Š” ๋ถ„์•ผ์ž…๋‹ˆ๋‹ค. ์ปดํ“จํ„ฐ์™€ ์ธ๊ฐ„์ด ์„œ๋กœ ์ƒํ˜ธ ์ž‘์šฉํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์–ธ์–ด์™€ ๊ธฐ์ˆ ์„ ํฌํ•จํ•˜๋ฉฐ, ์ปดํ“จํ„ฐ๋Š” ์ธ๊ฐ„์˜ ์–ธ์–ด๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ณ  ๋ถ„์„ํ•˜์—ฌ ์ธ๊ฐ„์˜ ์ž‘์—…์„ ๋•๊ฑฐ๋‚˜ ์ž‘์—…์„ ์ž๋™ํ™”ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ปดํ“จํ„ฐ๊ฐ€ ์ปดํ“จํ„ฐ์—์„œ ์ž‘์—…ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์ปดํ“จํ„ฐ ํ”„๋กœ๊ทธ๋žจ์ด๋‚˜ ํ”„๋กœ๊ทธ๋žจ๊ณผ ๋น„์Šทํ•˜๊ฒŒ ์ธ๊ฐ„๋„ ์ž์‹ ์˜ ์ž‘์—…์— ์‚ฌ์šฉ๋˜๋Š” ์ปดํ“จํ„ฐ ํ”„๋กœ๊ทธ๋žจ๊ณผ ๋น„์Šทํ•œ ๋ฐฉ์‹์œผ๋กœ ์ž‘์—…ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
166
+ ```
167
+ ## Hardware and Software
168
+ - nvidia driver : 535.54.03
169
+ - CUDA Version: 12.2
170
+ ### Framework versions
171
  - PEFT 0.4.0
172
+
173
+ ## Training
174
+ Refer github
175
+
176
+ ## Model Benchmark
177
+ - Used EleutherAI's lm-evaluation-harness https://github.com/EleutherAI/lm-evaluation-harness/tree/polyglot
178
+
179
+ ### Korean Semantic Textual Similarity
180
+ | model name | Version | Metric | Value | | Stderr |
181
+ |-------------------------------| ------: | ------ |-----------:| ---- | -----: |
182
+ | meta-llama/Llama-2-7b-chat-hf | 0 | acc | 0.4817 | ยฑ | 0.0220 |
183
+ | beomi/llama-2-ko-7b | 0 | acc | 0.5029 | ยฑ | 0.0220 |
184
+ | kfkas/Llama-2-ko-7b-Chat | 0 | acc | 0.5318 | ยฑ | 0.0219 |
185
+ | **komt-llama-2-7b (ours)** | 0 | acc | **0.5530** | ยฑ | 0.0218 |
186
+
187
+ ### Example Output
188
+ Please refer to the GitHub link below for performance results of each model.
189
+ https://github.com/davidkim205/komt/tree/main/eval_results
190
+ | ์งˆ๋ฌธ/๋‹ต๋ณ€ |
191
+ | ------------------------------------------------------------ |
192
+ | ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋‚ด๋ ค๊ฐ€๋Š” ์ด์œ ๋Š” ๋ฌด์—‡์ž…๋‹ˆ๊นŒ? |
193
+ | ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๋Š” ๋ˆ„์ „ ์‹œ ์ „๊ธฐ๋ฅผ ์ฐจ๋‹จํ•˜์—ฌ ํ™”์žฌ ์œ„ํ—˜์„ ์ค„์ด๊ธฐ ์œ„ํ•ด ์„ค์น˜๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๋Š” ์‹œ๊ฐ„์ด ์ง€๋‚˜๋ฉด์„œ ์„ค์น˜๋œ ์žฅ์†Œ์—์„œ ๋ฉ€์–ด์ง€๊ฒŒ ๋˜๋ฉฐ, ์ด๋กœ ์ธํ•ด ์„ค์น˜๋œ ์žฅ์†Œ์—์„œ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋–จ์–ด์ง€๋ฉด ์†์ƒ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋‚ด๋ ค๊ฐ€๋Š” ๊ฒƒ์€ ์ด๋Ÿฌํ•œ ์ด์œ  ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๋Š” ๋ˆ„์ „ ์‹œ ์ „๊ธฐ๋ฅผ ์ฐจ๋‹จํ•˜๊ธฐ ์œ„ํ•ด ์„ค์น˜๋˜๋Š” ์žฅ์น˜์ด๋ฏ€๋กœ, ์„ค์น˜๋œ ์žฅ์†Œ์—์„œ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋–จ์–ด์ง€๋ฉด ์†์ƒ๋  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋‚ด๋ ค๊ฐ€๋Š” ๊ฒƒ์€ ์ ์ ˆํ•œ ๊ด€๋ฆฌ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. |
194
+ | ํ˜‘๋ ฅ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๋ž€ ๋ฌด์—‡์ธ๊ฐ€์š”? |
195
+ | ํ˜‘๋ ฅ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๋Š” ๊ฑด์ถ•, ๋ฌผ๋ฅ˜, ํ† ๋ชฉ, ๊ฑด์„ค ๋“ฑ ๋‹ค์–‘ํ•œ ์‚ฐ์—… ๋ถ„์•ผ์—์„œ ๊ณต์ธ์ค‘๊ฐœ์‚ฌ์™€ ํ˜‘๋ ฅํ•˜์—ฌ ๊ฑด์ถ•์—…์ž, ์†Œ์œ ์ž ๋ฐ ํ† ์ง€์ฃผ๋ฅผ ๋Œ€์‹ ํ•˜์—ฌ ๊ฑด์ถ• ํ”„๋กœ์ ํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค. ์ด๋“ค์€ ๊ณต์ธ์ค‘๊ฐœ์‚ฌ์™€ ํ˜‘๋ ฅํ•˜์—ฌ ๊ณต์‚ฌ ๊ณ„์•ฝ, ๋ฒ•๋ฅ  ์ž๋ฌธ, ๊ฑด์ถ• ํ—ˆ๊ฐ€ ๋ฐ ๊ฑด์ถ• ๊ทœ์ • ์ค€์ˆ˜์™€ ๊ฐ™์€ ํ”„๋กœ์ ํŠธ ์—…๋ฌด๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. ํ˜‘๋ ฅ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๋Š” ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๊ฐ€ ๊ฑด์ถ• ํ”„๋กœ์ ํŠธ๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ  ๊ฑด์ถ•์—…์ž, ์†Œ์œ ์ฃผ ๋ฐ ํ† ์ง€์ฃผ์™€ ๊ด€๋ จ๋œ ๋‹ค๋ฅธ ๋‹น์‚ฌ์ž๋ฅผ ๋Œ€์‹ ํ•˜์—ฌ ํ˜‘๋ ฅํ•  ์ˆ˜ ์žˆ๋„๋ก ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ํ˜‘๋ ฅ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๋Š” ๊ณต์ธ์ค‘๊ฐœ์‚ฌ์™€ ํ˜‘๋ ฅํ•˜์—ฌ ํ”„๋กœ์ ํŠธ๊ฐ€ ์›ํ™œํ•˜๊ฒŒ ์ง„ํ–‰๋˜๊ณ  ๊ถ๊ทน์ ์œผ๋กœ ์†Œ์œ ์ž๊ฐ€ ์›ํ•˜๋Š” ๊ฒฐ๊ณผ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ๋„๋ก ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. |
196
+ | ์ˆ˜์ถœ๋ฌผํ’ˆ์—๋„ ์›์‚ฐ์ง€ํ‘œ์‹œ๋ฅผ ํ•˜์—ฌ์•ผ ํ•˜๋‚˜์š”? |
197
+ | ์ผ๋ฐ˜์ ์œผ๋กœ ์ˆ˜์ถœ๋ฌผํ’ˆ์— ์›์‚ฐ์ง€ํ‘œ์‹œ๋ฅผ ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์ด ์ผ๋ฐ˜์ ์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์›์‚ฐ์ง€ํ‘œ์‹œ๋Š” ์›์‚ฐ์ง€๊ฐ€ ์•„๋‹Œ ์ œํ’ˆ์„ ์ˆ˜์ถœํ•  ๊ฒฝ์šฐ์—๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค. ์›์‚ฐ์ง€ํ‘œ์‹œ ์ œ๋„๋Š” ์ œํ’ˆ์˜ ์›์‚ฐ์ง€๋ฅผ ํ‘œ์‹œํ•˜์—ฌ ์ˆ˜์ž… ์ œํ’ˆ์˜ ์›์‚ฐ์ง€ ๊ฑฐ์ง“ํ‘œ์‹œ๋ฅผ ๋ฐฉ์ง€ํ•˜๊ณ  ๊ตญ๋‚ด ์†Œ๋น„์ž์—๊ฒŒ ์ œํ’ˆ์˜ ์›์‚ฐ์ง€๋ฅผ ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๊ธฐ ์œ„ํ•ด ์‹œํ–‰๋˜๋Š” ์ œ๋„์ž…๋‹ˆ๋‹ค. ์›์‚ฐ์ง€ํ‘œ์‹œ๋Š” ํ‘œ์‹œ์˜๋ฌด๋Œ€์ƒ์ž๊ฐ€ ์›์‚ฐ์ง€ํ‘œ์‹œ ์˜๋ฌด๋Œ€์ƒ์ž์— ๋Œ€ํ•œ ํ‘œ์‹œ์˜๋ฌด๋ฅผ ์ดํ–‰ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ ์ตœ๋Œ€ 100๋งŒ์› ์ดํ•˜์˜ ๊ณผํƒœ๋ฃŒ๊ฐ€ ๋ถ€๊ณผ๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ˆ˜์ถœ๋ฌผํ’ˆ์—๋Š” ์›์‚ฐ์ง€ํ‘œ์‹œ๋ฅผ ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์ด ์ผ๋ฐ˜์ ์ด๋ฉฐ, ์ˆ˜์ž…๋ฌผํ’ˆ์—๋Š” ์›์‚ฐ์ง€ํ‘œ์‹œ๊ฐ€ ์˜๋ฌด์ ์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ˆ˜์ถœ๋ฌผํ’ˆ์— ์›์‚ฐ์ง€ํ‘œ์‹œ๋ฅผ ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์€ ์ผ๋ฐ˜์ ์ด๋ฉฐ, ์›์‚ฐ์ง€ํ‘œ์‹œ ์ œ๋„๋Š” ์ˆ˜์ž…๋ฌผํ’ˆ์—๋งŒ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค. |
198
+ | ์ž๋™์ฐจ ๊ณต๊ธฐ์•• ๊ด€๋ฆฌ๊ฐ€ ์™œ ์ค‘์š”ํ•˜๋‚˜์š”? |
199
+ | ์ž๋™์ฐจ ๊ณต๊ธฐ์•• ๊ด€๋ฆฌ๋Š” ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ์ด์œ ๋กœ ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค. ์ฒซ์งธ, ์ž๋™์ฐจ ๊ณต๊ธฐ์••์€ ๋…ธ๋ฉด ๋งˆ์ฐฐ๋ ฅ์„ ๋†’์—ฌ์ฃผ๋Š” ์—ญํ• ์„ ํ•˜๋ฉฐ, ๋…ธ๋ฉด ๋งˆ์ฐฐ ๊ฐ์†Œ๋กœ ์—ฐ๋น„๋ฅผ ํ–ฅ์ƒ์‹œํ‚ค๋Š” ํšจ๊ณผ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‘˜์งธ, ๊ณต๊ธฐ์••์ด ๋‚ฎ์œผ๋ฉด ๋…ธ๋ฉด ๋งˆ์ฐฐ๋ ฅ์ด ๋‚ฎ์•„์ง€๋ฉฐ, ๊ฒฐ๊ตญ ์ฐจ๋Ÿ‰ ์ œ๋™๋ ฅ์ด ๋–จ์–ด์ง‘๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๊ณต๊ธฐ์••์ด ๋‚ฎ์„ ๋•Œ๋Š” ๋…ธ๋ฉด ๋งˆ์ฐฐ๋ ฅ์„ ๋†’์—ฌ์ฃผ๋Š” ํšจ๊ณผ๊ฐ€ ์žˆ์œผ๋ฉฐ, ๋ฐ˜๋Œ€๋กœ ๊ณต๊ธฐ์••์ด ๋†’์„ ๋•Œ๋Š” ๋…ธ๋ฉด ๋งˆ์ฐฐ๋ ฅ์ด ๋†’์•„์ ธ ์—ฐ๋น„๊ฐ€ ์ €ํ•˜๋˜๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค. |
200
+ | ์ฃผ์ฐจ์œ„๋ฐ˜์œผ๋กœ ๊ณผํƒœ๋ฃŒ๊ฐ€ ๋‚˜์™”๋Š”๋ฐ ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•  ์ˆ˜ ์žˆ๋‚˜์š”? |
201
+ | ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•˜๊ธฐ ์ „์— ๋ฒ•์› ํŒ๊ฒฐ์„ ํ™•์ธํ•ด๋ณด๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ํ–‰์ •์‹ฌํŒ ์ฒญ๊ตฌ ํ›„ ๋ฒ•์› ํŒ๊ฒฐ์— ๋”ฐ๋ผ ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋ฒ•์› ํŒ๊ฒฐ์— ๋”ฐ๋ผ ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•  ์ˆ˜ ์—†์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ํ–‰์ •์‹ฌํŒ ์ฒญ๊ตฌ ํ›„ ํŒ๊ฒฐ์— ๋”ฐ๋ผ ์ฒญ๊ตฌ๋œ ์‚ฌ์•ˆ์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋Š” ๊ถŒ๋ฆฌ๋Š” ์—†์Šต๋‹ˆ๋‹ค. |
202
+ | ํ”„๋ฆฌ๋Š” ์–ด๋Š ๋‚˜๋ผ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด์•ผ |
203
+ | ์ผ๋ณธ\nใ€Šํ”„๋ฆฌใ€‹(ใƒ—ใƒชใƒผ ํ‘ธ๋ฆฌ์ด)๋Š” ์ผ๋ณธ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ž‘ํ’ˆ์ด๋‹ค. 2003๋…„ 4์›” 10์ผ๋ถ€ํ„ฐ 2004๋…„ 3์›” 31์ผ๊นŒ์ง€ ํ›„์ง€ TV์—์„œ ๋ฐฉ์˜๋˜์—ˆ์œผ๋ฉฐ, ๋ฐฉ์˜์‹œ๊ฐ„์€ ์ด 108ํ™”์ด๋‹ค. ๋‹จํ–‰๋ณธ์€ ๋ชจ๋‘ 6๊ถŒ์ด๋ฉฐ, ์ „3๊ถŒ ๋ณธํŽธ, ์ „3๊ถŒ ์™ธ์ „, ์ „1๊ถŒ ์™„์ „ํŒ์ด ์žˆ๋‹ค. ใ€Šํ”„๋ฆฌใ€‹๋Š” ์ดˆ์‹ฌ ์‹œ์ ˆ์˜ ๊ฟˆ์„ ์žƒ์–ด๋ฒ„๋ฆฐ 20๋Œ€ ์ดˆ๋ฐ˜์˜ ์ฒญ๋…„์ด ์ž์‹ ์˜ ์ž‘ํ’ˆ์— ๋Œ€ํ•œ ์ž์‹ ๊ฐ์„ ๊ฐ–๊ณ  ์ž‘๊ฐ€๊ฐ€ ๋˜๊ธฐ ์œ„ํ•ด ๋…ธ๋ ฅํ•˜๋Š” ์ด์•ผ๊ธฐ๋ฅผ ๊ทธ๋ฆฐ ์ž‘ํ’ˆ์ด๋‹ค. ๋˜ํ•œ ๊ฟˆ์„ ํ–ฅํ•œ ์ฒญ๋…„์˜ ์—ด์ •๊ณผ ๋…ธ๋ ฅ์ด ์„ฑ๊ณต์œผ๋กœ ์ด์–ด์ง€๋Š” ๊ณผ์ •์„ ๊ทธ๋ฆฌ๊ณ  ์žˆ๋‹ค. ์ž‘ํ’ˆ ๋‚ด์—์„œ ์ž‘๊ฐ€์˜ ๋ชจ์Šต์ด ์ž์‹ ๊ณผ ๋‹ฎ์•˜๋‹ค๋Š” ์ ์—์„œ ๋งŽ์€ ํ™”์ œ๊ฐ€ ๋˜์—ˆ๋‹ค. ์ œ24ํšŒ ์‡ผ๊ฐ€์ฟ ์นธ ๋งŒํ™”์ƒ์„ ์ˆ˜์ƒํ–ˆ๋‹ค. |
204
+ | ์˜ํ™” ํ•ด๋ฆฌํฌํ„ฐ ์‹œ๋ฆฌ์ฆˆ ๋ฐฐ๊ธ‰์‚ฌ๊ฐ€ ์–ด๋””์•ผ |
205
+ | ์›Œ๋„ˆ ๋ธŒ๋ผ๋”์Šค\n๋ฐ์ด๋น„๋“œ ์ž‰๊ธ€๋ฆฌ์‹œ๋Š” 1990๋…„๋Œ€ ์ดˆ ์‹œ๋ฆฌ์ฆˆ๋ฅผ ์‹œ์ž‘ํ–ˆ๋‹ค. ์ด ์˜ํ™”๋“ค์€ ์ด 8๋ถ€์ž‘์œผ๋กœ ๋งŒ๋“ค์–ด์กŒ์œผ๋ฉฐ, ์ฒซ ๋ฒˆ์งธ ์ž‘ํ’ˆ์€ ใ€Šํ•ด๋ฆฌ ํฌํ„ฐ์™€ ๋งˆ๋ฒ•์‚ฌ์˜ ๋Œใ€‹์ด๋‹ค. ์ž‘๊ฐ€๋Š” J. K. ๋กค๋ง์ด๋ฉฐ, ์˜ํ™” ์‹œ๋ฆฌ์ฆˆ๋Š” ๋ฐฐ๊ธ‰์‚ฌ์ธ ์›Œ๋„ˆ ๋ธŒ๋ผ๋”์Šค๊ฐ€ ๋งŒ๋“ค์—ˆ๋‹ค. ์ดฌ์˜์€ 1997๋…„ 7์›” 11์ผ๋ถ€ํ„ฐ 12์›” 22์ผ๊นŒ์ง€ ๋Ÿฐ๋˜์—์„œ ์ด๋ฃจ์–ด์กŒ๋‹ค. ์ดฌ์˜ ์žฅ์†Œ๋กœ๋Š” ๋Ÿฐ๋˜ ํฌ๋ฆญ์Šค ์ŠคํŠœ๋””์˜ค์™€ ๋Ÿฐ๋˜ ์‹œํ‹ฐ ์˜คํ”ผ์Šค๊ฐ€ ์‚ฌ์šฉ๋˜์—ˆ๋‹ค. ๋ฐ์ด๋น„๋“œ ์ž‰๊ธ€๋ฆฌ์‹œ๋Š” ํ•ด๋ฆฌ ํฌํ„ฐ ์—ญํ• ์„ ๋งก์•˜๋‹ค. |
206
+ | ์™œ ์„ธ๊ณ„์‹œ๊ฐ„์˜ ๊ธฐ์ค€์ด ์˜๊ตญ์˜ GMT์ธ๊ฐ€์š”? ๊ทธ ์ด์œ ๋Š” ๋ฌด์—‡์ผ๊นŒ์š”? |
207
+ | ์˜๊ตญ์˜ GMT๋Š” ์„ธ๊ณ„์‹œ๊ฐ„์˜ ๊ธฐ์ค€์ด ๋˜๋Š” ์‹œ๊ฐ„๋Œ€์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด ์‹œ๊ฐ„๋Œ€๋Š” ํ‘œ์ค€ํ™”๋˜์ง€ ์•Š์•˜์œผ๋ฉฐ, ๋”ฐ๋ผ์„œ ๋‹ค๋ฅธ ๋‚˜๋ผ์˜ ์‹œ๊ฐ„๋Œ€์™€ ์ฐจ์ด๊ฐ€ ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ด ์‹œ๊ฐ„๋Œ€๋ฅผ ์„ธ๊ณ„์‹œ๊ฐ„์œผ๋กœ ์ฐฉ๊ฐํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ, ์„ธ๊ณ„์‹œ๊ฐ„์˜ ๊ธฐ์ค€์€ ํ‘œ์ค€ํ™”๋œ ์‹œ๊ฐ„๋Œ€๋ฅผ ๋”ฐ๋ฅด๋„๋ก ํ•˜๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค. |
208
+
209
+
210
+
211
+ ------------------------------------------------
212
+ # Original model card: Meta's Llama 2 13B-chat
213
+
214
+ Meta developed and released the Llama 2 family of large language models (LLMs), a collection of pretrained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. Our fine-tuned LLMs, called Llama-2-Chat, are optimized for dialogue use cases. Llama-2-Chat models outperform open-source chat models on most benchmarks we tested, and in our human evaluations for helpfulness and safety, are on par with some popular closed-source models like ChatGPT and PaLM.
215
+
216
+ **Model Developers** Meta
217
+
218
+ **Variations** Llama 2 comes in a range of parameter sizes โ€” 7B, 13B, and 70B โ€” as well as pretrained and fine-tuned variations.
219
+
220
+ **Input** Models input text only.
221
+
222
+ **Output** Models generate text only.
223
+
224
+ **Model Architecture** Llama 2 is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align to human preferences for helpfulness and safety.
225
+
226
+ ||Training Data|Params|Content Length|GQA|Tokens|LR|
227
+ |---|---|---|---|---|---|---|
228
+ Llama 2|*A new mix of publicly available online data*|7B|4k|&#10007;|2.0T|3.0 x 10<sup>-4</sup>
229
+ Llama 2|*A new mix of publicly available online data*|13B|4k|&#10007;|2.0T|3.0 x 10<sup>-4</sup>
230
+ Llama 2|*A new mix of publicly available online data*|70B|4k|&#10004;|2.0T|1.5 x 10<sup>-4</sup>
231
+
232
+ **Llama 2 family of models.** Token counts refer to pretraining data only. All models are trained with a global batch-size of 4M tokens. The 70B version uses Grouped-Query Attention (GQA) for improved inference scalability.
233
+
234
+ **Model Dates** Llama 2 was trained between January 2023 and July 2023.
235
+
236
+ **Status** This is a static model trained on an offline dataset. Future versions of the tuned models will be released as we improve model safety with community feedback.
237
+
238
+ **License** A custom commercial license is available at: [https://ai.meta.com/resources/models-and-libraries/llama-downloads/](https://ai.meta.com/resources/models-and-libraries/llama-downloads/)
239
+
240
+ **Research Paper** More information can be found in the paper "Llama-2: Open Foundation and Fine-tuned Chat Models", available at https://ai.meta.com/research/publications/llama-2-open-foundation-and-fine-tuned-chat-models/.
241
+
242
+ **Where to send questions or comments about the model** Instructions on how to provide feedback or comments on the model can be found in the model [README](README.md).
243
+
244
+ # **Intended Use**
245
+ **Intended Use Cases** Llama 2 is intended for commercial and research use in English. Tuned models are intended for assistant-like chat, whereas pretrained models can be adapted for a variety of natural language generation tasks.
246
+
247
+ **Out-of-scope Uses** Use in any manner that violates applicable laws or regulations (including trade compliance laws). Use in languages other than English. Use in any other way that is prohibited by the Acceptable Use Policy and Licensing Agreement for Llama 2.
248
+
249
+ # **Hardware and Software**
250
+ **Training Factors** We used custom training libraries, Meta's Research Super Cluster, and production clusters for pretraining. Fine-tuning, annotation, and evaluation were also performed on third-party cloud compute.
251
+
252
+ **Carbon Footprint** Pretraining utilized a cumulative 3.3M GPU hours of computation on hardware of type A100-80GB (TDP of 350-400W). Estimated total emissions were 539 tCO2eq, 100% of which were offset by Metaโ€™s sustainability program.
253
+
254
+ ||Time (GPU hours)|Power Consumption (W)|Carbon Emitted(tCO<sub>2</sub>eq)|
255
+ |---|---|---|---|
256
+ |Llama 2 7B|184320|400|31.22|
257
+ |Llama 2 13B|368640|400|62.44|
258
+ |Llama 2 70B|1720320|400|291.42|
259
+ |Total|3311616||539.00|
260
+
261
+ **CO<sub>2</sub> emissions during pretraining.** Time: total GPU time required for training each model. Power Consumption: peak power capacity per GPU device for the GPUs used adjusted for power usage efficiency. 100% of the emissions are directly offset by Meta's sustainability program, and because we are openly releasing these models, the pretraining costs do not need to be incurred by others.
262
+
263
+ # **Training Data**
264
+ **Overview** Llama 2 was pretrained on 2 trillion tokens of data from publicly available sources. The fine-tuning data includes publicly available instruction datasets, as well as over one million new human-annotated examples. Neither the pretraining nor the fine-tuning datasets include Meta user data.
265
+
266
+ **Data Freshness** The pretraining data has a cutoff of September 2022, but some tuning data is more recent, up to July 2023.
267
+
268
+ # **Evaluation Results**
269
+
270
+ In this section, we report the results for the Llama 1 and Llama 2 models on standard academic benchmarks.
271
+ For all the evaluations, we use our internal evaluations library.
272
+
273
+ |Model|Size|Code|Commonsense Reasoning|World Knowledge|Reading Comprehension|Math|MMLU|BBH|AGI Eval|
274
+ |---|---|---|---|---|---|---|---|---|---|
275
+ |Llama 1|7B|14.1|60.8|46.2|58.5|6.95|35.1|30.3|23.9|
276
+ |Llama 1|13B|18.9|66.1|52.6|62.3|10.9|46.9|37.0|33.9|
277
+ |Llama 1|33B|26.0|70.0|58.4|67.6|21.4|57.8|39.8|41.7|
278
+ |Llama 1|65B|30.7|70.7|60.5|68.6|30.8|63.4|43.5|47.6|
279
+ |Llama 2|7B|16.8|63.9|48.9|61.3|14.6|45.3|32.6|29.3|
280
+ |Llama 2|13B|24.5|66.9|55.4|65.8|28.7|54.8|39.4|39.1|
281
+ |Llama 2|70B|**37.5**|**71.9**|**63.6**|**69.4**|**35.2**|**68.9**|**51.2**|**54.2**|
282
+
283
+ **Overall performance on grouped academic benchmarks.** *Code:* We report the average pass@1 scores of our models on HumanEval and MBPP. *Commonsense Reasoning:* We report the average of PIQA, SIQA, HellaSwag, WinoGrande, ARC easy and challenge, OpenBookQA, and CommonsenseQA. We report 7-shot results for CommonSenseQA and 0-shot results for all other benchmarks. *World Knowledge:* We evaluate the 5-shot performance on NaturalQuestions and TriviaQA and report the average. *Reading Comprehension:* For reading comprehension, we report the 0-shot average on SQuAD, QuAC, and BoolQ. *MATH:* We report the average of the GSM8K (8 shot) and MATH (4 shot) benchmarks at top 1.
284
+
285
+ |||TruthfulQA|Toxigen|
286
+ |---|---|---|---|
287
+ |Llama 1|7B|27.42|23.00|
288
+ |Llama 1|13B|41.74|23.08|
289
+ |Llama 1|33B|44.19|22.57|
290
+ |Llama 1|65B|48.71|21.77|
291
+ |Llama 2|7B|33.29|**21.25**|
292
+ |Llama 2|13B|41.86|26.10|
293
+ |Llama 2|70B|**50.18**|24.60|
294
+
295
+ **Evaluation of pretrained LLMs on automatic safety benchmarks.** For TruthfulQA, we present the percentage of generations that are both truthful and informative (the higher the better). For ToxiGen, we present the percentage of toxic generations (the smaller the better).
296
+
297
+
298
+ |||TruthfulQA|Toxigen|
299
+ |---|---|---|---|
300
+ |Llama-2-Chat|7B|57.04|**0.00**|
301
+ |Llama-2-Chat|13B|62.18|**0.00**|
302
+ |Llama-2-Chat|70B|**64.14**|0.01|
303
+
304
+ **Evaluation of fine-tuned LLMs on different safety datasets.** Same metric definitions as above.
305
+
306
+ # **Ethical Considerations and Limitations**
307
+ Llama 2 is a new technology that carries risks with use. Testing conducted to date has been in English, and has not covered, nor could it cover all scenarios. For these reasons, as with all LLMs, Llama 2โ€™s potential outputs cannot be predicted in advance, and the model may in some instances produce inaccurate, biased or other objectionable responses to user prompts. Therefore, before deploying any applications of Llama 2, developers should perform safety testing and tuning tailored to their specific applications of the model.
308
+
309
+ Please see the Responsible Use Guide available at [https://ai.meta.com/llama/responsible-use-guide/](https://ai.meta.com/llama/responsible-use-guide/)