Edit model card

komt-llama-2-7b-lora

This model fine-tuned the aaa model using PEFT-LoRA.

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. Please refer below for more detailed information.

For more detailed information, please refer to the https://huggingface.co/davidkim205/komt-Llama-2-7b-chat-hf.

Model Details

  • Model Developers : davidkim(changyeon kim)
  • Repository : https://github.com/davidkim205/komt
  • Lora target modules : q_proj, o_proj, v_proj, gate_proj, down_proj, k_proj, up_proj
  • Model Size : 80MB
  • 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

Dataset

korean multi-task instruction dataset

Prompt Template

### instruction: {prompt}

### Response: 

Examples:

### instruction: ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ ์–ผ๋งˆ์ธ๊ฐ€์š”?

### Response:

response:

### instruction: ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ ์–ผ๋งˆ์ธ๊ฐ€์š”?

### Response: ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ 2๋…„์ž…๋‹ˆ๋‹ค. ์ด ๊ธฐ๊ฐ„ ๋™์•ˆ ๊ฒ€์‚ฌ๋ฅผ ๋ฐ›์ง€ ์•Š์œผ๋ฉด ๊ณผํƒœ๋ฃŒ๊ฐ€ ๋ถ€๊ณผ๋ฉ๋‹ˆ๋‹ค. ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ 2013๋…„ 12์›” 31์ผ๋ถ€ํ„ฐ ์‹œํ–‰๋˜์—ˆ์Šต๋‹ˆ๋‹ค

Usage

After downloading from GitHub, please install as follows:

git clone https://github.com/davidkim205/komt
cd komt
pip install -r lora/requirements_lora.txt
import torch

from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from transformers import StoppingCriteria, StoppingCriteriaList
from transformers import TextStreamer, GenerationConfig
from peft import PeftModel, PeftConfig

class LocalStoppingCriteria(StoppingCriteria):

    def __init__(self, tokenizer, stop_words = []):
        super().__init__()

        stops = [tokenizer(stop_word, return_tensors='pt', add_special_tokens = False)['input_ids'].squeeze() for stop_word in stop_words]
        print('stop_words', stop_words)
        print('stop_words_ids', stops)
        self.stop_words = stop_words
        self.stops = [stop.cuda() for stop in stops]
        self.tokenizer = tokenizer
    def _compare_token(self, input_ids):
        for stop in self.stops:
            if len(stop.size()) != 1:
                continue
            stop_len = len(stop)
            if torch.all((stop == input_ids[0][-stop_len:])).item():
                return True

        return False
    def _compare_decode(self, input_ids):
        input_str = self.tokenizer.decode(input_ids[0])
        for stop_word in self.stop_words:
            if input_str.endswith(stop_word):
                return True
        return False

    def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTensor):
        input_str = self.tokenizer.decode(input_ids[0])
        for stop_word in self.stop_words:
            if input_str.endswith(stop_word):
                return True
        return False

#
# config
peft_model_name = 'davidkim205/komt-Llama-2-7b-chat-hf-lora'
model_name = 'davidkim205/komt-Llama-2-7b-chat-hf'
instruction_prefix = "### instruction: "
input_prefix = "### input: "
answer_prefix = "### Response: "
endoftext = "<|end|>"
stop_words = [endoftext, '<s>', '###']
generation_config = GenerationConfig(
    temperature=0.9,
    top_p=0.7,
    top_k=100,
    max_new_tokens=2048,
    early_stopping=True,
    do_sample=True,
)
#
# create model
config = PeftConfig.from_pretrained(peft_model_name)
bnb_config = BitsAndBytesConfig(
    load_in_4bit=True,
    bnb_4bit_use_double_quant=True,
    bnb_4bit_quant_type="nf4",
    bnb_4bit_compute_dtype=torch.bfloat16
)
model = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=bnb_config,
                                             device_map="auto")
model = PeftModel.from_pretrained(model, peft_model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
stopping_criteria = StoppingCriteriaList([LocalStoppingCriteria(tokenizer=tokenizer, stop_words=stop_words)])
streamer = TextStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
model.eval()

#
# generate
prompt = f"### instruction: ์ž๋™์ฐจ ์ข…ํ•ฉ(์ •๊ธฐ)๊ฒ€์‚ฌ ์˜๋ฌด๊ธฐ๊ฐ„์€ ์–ผ๋งˆ์ธ๊ฐ€์š”?.\n\n### Response:"
gened = model.generate(
    **tokenizer(
        prompt,
        return_tensors='pt',
        return_token_type_ids=False
    ).to('cuda'),
    generation_config=generation_config,
    eos_token_id=model.config.eos_token_id,
    stopping_criteria=stopping_criteria,
    streamer=streamer
)
output_text = tokenizer.decode(gened[0], skip_special_tokens=True)

print('--------------------')
print(output_text)

response:

nlp๋Š” ์ž์—ฐ์–ด ์ฒ˜๋ฆฌ์˜ ์•ฝ์ž๋กœ, ์ž์—ฐ์–ด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ธ๊ฐ„๊ณผ ์ปดํ“จํ„ฐ ๊ฐ„์˜ ์ƒํ˜ธ ์ž‘์šฉ์„ ๋‹ค๋ฃจ๋Š” ๋ถ„์•ผ์ž…๋‹ˆ๋‹ค. ์ปดํ“จํ„ฐ์™€ ์ธ๊ฐ„์ด ์„œ๋กœ ์ƒํ˜ธ ์ž‘์šฉํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์–ธ์–ด์™€ ๊ธฐ์ˆ ์„ ํฌํ•จํ•˜๋ฉฐ, ์ปดํ“จํ„ฐ๋Š” ์ธ๊ฐ„์˜ ์–ธ์–ด๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ณ  ๋ถ„์„ํ•˜์—ฌ ์ธ๊ฐ„์˜ ์ž‘์—…์„ ๋•๊ฑฐ๋‚˜ ์ž‘์—…์„ ์ž๋™ํ™”ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ปดํ“จํ„ฐ๊ฐ€ ์ปดํ“จํ„ฐ์—์„œ ์ž‘์—…ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋˜๋Š” ์ปดํ“จํ„ฐ ํ”„๋กœ๊ทธ๋žจ์ด๋‚˜ ํ”„๋กœ๊ทธ๋žจ๊ณผ ๋น„์Šทํ•˜๊ฒŒ ์ธ๊ฐ„๋„ ์ž์‹ ์˜ ์ž‘์—…์— ์‚ฌ์šฉ๋˜๋Š” ์ปดํ“จํ„ฐ ํ”„๋กœ๊ทธ๋žจ๊ณผ ๋น„์Šทํ•œ ๋ฐฉ์‹์œผ๋กœ ์ž‘์—…ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Hardware and Software

  • nvidia driver : 535.54.03
  • CUDA Version: 12.2

Framework versions

  • PEFT 0.4.0

Training

Refer github

Model Benchmark

Korean Semantic Textual Similarity

model name Version Metric Value Stderr
meta-llama/Llama-2-7b-chat-hf 0 acc 0.4817 ยฑ 0.0220
beomi/llama-2-ko-7b 0 acc 0.5029 ยฑ 0.0220
kfkas/Llama-2-ko-7b-Chat 0 acc 0.5318 ยฑ 0.0219
komt-llama-2-7b (ours) 0 acc 0.5530 ยฑ 0.0218

Example Output

Please refer to the GitHub link below for performance results of each model. https://github.com/davidkim205/komt/tree/main/eval_results

์งˆ๋ฌธ/๋‹ต๋ณ€
๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋‚ด๋ ค๊ฐ€๋Š” ์ด์œ ๋Š” ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?
๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๋Š” ๋ˆ„์ „ ์‹œ ์ „๊ธฐ๋ฅผ ์ฐจ๋‹จํ•˜์—ฌ ํ™”์žฌ ์œ„ํ—˜์„ ์ค„์ด๊ธฐ ์œ„ํ•ด ์„ค์น˜๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๋Š” ์‹œ๊ฐ„์ด ์ง€๋‚˜๋ฉด์„œ ์„ค์น˜๋œ ์žฅ์†Œ์—์„œ ๋ฉ€์–ด์ง€๊ฒŒ ๋˜๋ฉฐ, ์ด๋กœ ์ธํ•ด ์„ค์น˜๋œ ์žฅ์†Œ์—์„œ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋–จ์–ด์ง€๋ฉด ์†์ƒ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋‚ด๋ ค๊ฐ€๋Š” ๊ฒƒ์€ ์ด๋Ÿฌํ•œ ์ด์œ  ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๋Š” ๋ˆ„์ „ ์‹œ ์ „๊ธฐ๋ฅผ ์ฐจ๋‹จํ•˜๊ธฐ ์œ„ํ•ด ์„ค์น˜๋˜๋Š” ์žฅ์น˜์ด๋ฏ€๋กœ, ์„ค์น˜๋œ ์žฅ์†Œ์—์„œ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋–จ์–ด์ง€๋ฉด ์†์ƒ๋  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ๋ˆ„์ „์ฐจ๋‹จ๊ธฐ๊ฐ€ ๋‚ด๋ ค๊ฐ€๋Š” ๊ฒƒ์€ ์ ์ ˆํ•œ ๊ด€๋ฆฌ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
ํ˜‘๋ ฅ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๋ž€ ๋ฌด์—‡์ธ๊ฐ€์š”?
ํ˜‘๋ ฅ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๋Š” ๊ฑด์ถ•, ๋ฌผ๋ฅ˜, ํ† ๋ชฉ, ๊ฑด์„ค ๋“ฑ ๋‹ค์–‘ํ•œ ์‚ฐ์—… ๋ถ„์•ผ์—์„œ ๊ณต์ธ์ค‘๊ฐœ์‚ฌ์™€ ํ˜‘๋ ฅํ•˜์—ฌ ๊ฑด์ถ•์—…์ž, ์†Œ์œ ์ž ๋ฐ ํ† ์ง€์ฃผ๋ฅผ ๋Œ€์‹ ํ•˜์—ฌ ๊ฑด์ถ• ํ”„๋กœ์ ํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค. ์ด๋“ค์€ ๊ณต์ธ์ค‘๊ฐœ์‚ฌ์™€ ํ˜‘๋ ฅํ•˜์—ฌ ๊ณต์‚ฌ ๊ณ„์•ฝ, ๋ฒ•๋ฅ  ์ž๋ฌธ, ๊ฑด์ถ• ํ—ˆ๊ฐ€ ๋ฐ ๊ฑด์ถ• ๊ทœ์ • ์ค€์ˆ˜์™€ ๊ฐ™์€ ํ”„๋กœ์ ํŠธ ์—…๋ฌด๋ฅผ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. ํ˜‘๋ ฅ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๋Š” ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๊ฐ€ ๊ฑด์ถ• ํ”„๋กœ์ ํŠธ๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ  ๊ฑด์ถ•์—…์ž, ์†Œ์œ ์ฃผ ๋ฐ ํ† ์ง€์ฃผ์™€ ๊ด€๋ จ๋œ ๋‹ค๋ฅธ ๋‹น์‚ฌ์ž๋ฅผ ๋Œ€์‹ ํ•˜์—ฌ ํ˜‘๋ ฅํ•  ์ˆ˜ ์žˆ๋„๋ก ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ํ˜‘๋ ฅ๊ณต์ธ์ค‘๊ฐœ์‚ฌ๋Š” ๊ณต์ธ์ค‘๊ฐœ์‚ฌ์™€ ํ˜‘๋ ฅํ•˜์—ฌ ํ”„๋กœ์ ํŠธ๊ฐ€ ์›ํ™œํ•˜๊ฒŒ ์ง„ํ–‰๋˜๊ณ  ๊ถ๊ทน์ ์œผ๋กœ ์†Œ์œ ์ž๊ฐ€ ์›ํ•˜๋Š” ๊ฒฐ๊ณผ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ๋„๋ก ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
์ˆ˜์ถœ๋ฌผํ’ˆ์—๋„ ์›์‚ฐ์ง€ํ‘œ์‹œ๋ฅผ ํ•˜์—ฌ์•ผ ํ•˜๋‚˜์š”?
์ผ๋ฐ˜์ ์œผ๋กœ ์ˆ˜์ถœ๋ฌผํ’ˆ์— ์›์‚ฐ์ง€ํ‘œ์‹œ๋ฅผ ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์ด ์ผ๋ฐ˜์ ์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์›์‚ฐ์ง€ํ‘œ์‹œ๋Š” ์›์‚ฐ์ง€๊ฐ€ ์•„๋‹Œ ์ œํ’ˆ์„ ์ˆ˜์ถœํ•  ๊ฒฝ์šฐ์—๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค. ์›์‚ฐ์ง€ํ‘œ์‹œ ์ œ๋„๋Š” ์ œํ’ˆ์˜ ์›์‚ฐ์ง€๋ฅผ ํ‘œ์‹œํ•˜์—ฌ ์ˆ˜์ž… ์ œํ’ˆ์˜ ์›์‚ฐ์ง€ ๊ฑฐ์ง“ํ‘œ์‹œ๋ฅผ ๋ฐฉ์ง€ํ•˜๊ณ  ๊ตญ๋‚ด ์†Œ๋น„์ž์—๊ฒŒ ์ œํ’ˆ์˜ ์›์‚ฐ์ง€๋ฅผ ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๊ธฐ ์œ„ํ•ด ์‹œํ–‰๋˜๋Š” ์ œ๋„์ž…๋‹ˆ๋‹ค. ์›์‚ฐ์ง€ํ‘œ์‹œ๋Š” ํ‘œ์‹œ์˜๋ฌด๋Œ€์ƒ์ž๊ฐ€ ์›์‚ฐ์ง€ํ‘œ์‹œ ์˜๋ฌด๋Œ€์ƒ์ž์— ๋Œ€ํ•œ ํ‘œ์‹œ์˜๋ฌด๋ฅผ ์ดํ–‰ํ•˜์ง€ ์•Š์„ ๊ฒฝ์šฐ ์ตœ๋Œ€ 100๋งŒ์› ์ดํ•˜์˜ ๊ณผํƒœ๋ฃŒ๊ฐ€ ๋ถ€๊ณผ๋ฉ๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ˆ˜์ถœ๋ฌผํ’ˆ์—๋Š” ์›์‚ฐ์ง€ํ‘œ์‹œ๋ฅผ ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์ด ์ผ๋ฐ˜์ ์ด๋ฉฐ, ์ˆ˜์ž…๋ฌผํ’ˆ์—๋Š” ์›์‚ฐ์ง€ํ‘œ์‹œ๊ฐ€ ์˜๋ฌด์ ์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ˆ˜์ถœ๋ฌผํ’ˆ์— ์›์‚ฐ์ง€ํ‘œ์‹œ๋ฅผ ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์€ ์ผ๋ฐ˜์ ์ด๋ฉฐ, ์›์‚ฐ์ง€ํ‘œ์‹œ ์ œ๋„๋Š” ์ˆ˜์ž…๋ฌผํ’ˆ์—๋งŒ ์ ์šฉ๋ฉ๋‹ˆ๋‹ค.
์ž๋™์ฐจ ๊ณต๊ธฐ์•• ๊ด€๋ฆฌ๊ฐ€ ์™œ ์ค‘์š”ํ•˜๋‚˜์š”?
์ž๋™์ฐจ ๊ณต๊ธฐ์•• ๊ด€๋ฆฌ๋Š” ์—ฌ๋Ÿฌ ๊ฐ€์ง€ ์ด์œ ๋กœ ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค. ์ฒซ์งธ, ์ž๋™์ฐจ ๊ณต๊ธฐ์••์€ ๋…ธ๋ฉด ๋งˆ์ฐฐ๋ ฅ์„ ๋†’์—ฌ์ฃผ๋Š” ์—ญํ• ์„ ํ•˜๋ฉฐ, ๋…ธ๋ฉด ๋งˆ์ฐฐ ๊ฐ์†Œ๋กœ ์—ฐ๋น„๋ฅผ ํ–ฅ์ƒ์‹œํ‚ค๋Š” ํšจ๊ณผ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‘˜์งธ, ๊ณต๊ธฐ์••์ด ๋‚ฎ์œผ๋ฉด ๋…ธ๋ฉด ๋งˆ์ฐฐ๋ ฅ์ด ๋‚ฎ์•„์ง€๋ฉฐ, ๊ฒฐ๊ตญ ์ฐจ๋Ÿ‰ ์ œ๋™๋ ฅ์ด ๋–จ์–ด์ง‘๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๊ณต๊ธฐ์••์ด ๋‚ฎ์„ ๋•Œ๋Š” ๋…ธ๋ฉด ๋งˆ์ฐฐ๋ ฅ์„ ๋†’์—ฌ์ฃผ๋Š” ํšจ๊ณผ๊ฐ€ ์žˆ์œผ๋ฉฐ, ๋ฐ˜๋Œ€๋กœ ๊ณต๊ธฐ์••์ด ๋†’์„ ๋•Œ๋Š” ๋…ธ๋ฉด ๋งˆ์ฐฐ๋ ฅ์ด ๋†’์•„์ ธ ์—ฐ๋น„๊ฐ€ ์ €ํ•˜๋˜๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค.
์ฃผ์ฐจ์œ„๋ฐ˜์œผ๋กœ ๊ณผํƒœ๋ฃŒ๊ฐ€ ๋‚˜์™”๋Š”๋ฐ ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•  ์ˆ˜ ์žˆ๋‚˜์š”?
ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•˜๊ธฐ ์ „์— ๋ฒ•์› ํŒ๊ฒฐ์„ ํ™•์ธํ•ด๋ณด๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ํ–‰์ •์‹ฌํŒ ์ฒญ๊ตฌ ํ›„ ๋ฒ•์› ํŒ๊ฒฐ์— ๋”ฐ๋ผ ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋ฒ•์› ํŒ๊ฒฐ์— ๋”ฐ๋ผ ํ–‰์ •์‹ฌํŒ์„ ์ฒญ๊ตฌํ•  ์ˆ˜ ์—†์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ํ–‰์ •์‹ฌํŒ ์ฒญ๊ตฌ ํ›„ ํŒ๊ฒฐ์— ๋”ฐ๋ผ ์ฒญ๊ตฌ๋œ ์‚ฌ์•ˆ์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋Š” ๊ถŒ๋ฆฌ๋Š” ์—†์Šต๋‹ˆ๋‹ค.
ํ”„๋ฆฌ๋Š” ์–ด๋Š ๋‚˜๋ผ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜์ด์•ผ
์ผ๋ณธ\nใ€Šํ”„๋ฆฌใ€‹(ใƒ—ใƒชใƒผ ํ‘ธ๋ฆฌ์ด)๋Š” ์ผ๋ณธ์˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ ์ž‘ํ’ˆ์ด๋‹ค. 2003๋…„ 4์›” 10์ผ๋ถ€ํ„ฐ 2004๋…„ 3์›” 31์ผ๊นŒ์ง€ ํ›„์ง€ TV์—์„œ ๋ฐฉ์˜๋˜์—ˆ์œผ๋ฉฐ, ๋ฐฉ์˜์‹œ๊ฐ„์€ ์ด 108ํ™”์ด๋‹ค. ๋‹จํ–‰๋ณธ์€ ๋ชจ๋‘ 6๊ถŒ์ด๋ฉฐ, ์ „3๊ถŒ ๋ณธํŽธ, ์ „3๊ถŒ ์™ธ์ „, ์ „1๊ถŒ ์™„์ „ํŒ์ด ์žˆ๋‹ค. ใ€Šํ”„๋ฆฌใ€‹๋Š” ์ดˆ์‹ฌ ์‹œ์ ˆ์˜ ๊ฟˆ์„ ์žƒ์–ด๋ฒ„๋ฆฐ 20๋Œ€ ์ดˆ๋ฐ˜์˜ ์ฒญ๋…„์ด ์ž์‹ ์˜ ์ž‘ํ’ˆ์— ๋Œ€ํ•œ ์ž์‹ ๊ฐ์„ ๊ฐ–๊ณ  ์ž‘๊ฐ€๊ฐ€ ๋˜๊ธฐ ์œ„ํ•ด ๋…ธ๋ ฅํ•˜๋Š” ์ด์•ผ๊ธฐ๋ฅผ ๊ทธ๋ฆฐ ์ž‘ํ’ˆ์ด๋‹ค. ๋˜ํ•œ ๊ฟˆ์„ ํ–ฅํ•œ ์ฒญ๋…„์˜ ์—ด์ •๊ณผ ๋…ธ๋ ฅ์ด ์„ฑ๊ณต์œผ๋กœ ์ด์–ด์ง€๋Š” ๊ณผ์ •์„ ๊ทธ๋ฆฌ๊ณ  ์žˆ๋‹ค. ์ž‘ํ’ˆ ๋‚ด์—์„œ ์ž‘๊ฐ€์˜ ๋ชจ์Šต์ด ์ž์‹ ๊ณผ ๋‹ฎ์•˜๋‹ค๋Š” ์ ์—์„œ ๋งŽ์€ ํ™”์ œ๊ฐ€ ๋˜์—ˆ๋‹ค. ์ œ24ํšŒ ์‡ผ๊ฐ€์ฟ ์นธ ๋งŒํ™”์ƒ์„ ์ˆ˜์ƒํ–ˆ๋‹ค.
์˜ํ™” ํ•ด๋ฆฌํฌํ„ฐ ์‹œ๋ฆฌ์ฆˆ ๋ฐฐ๊ธ‰์‚ฌ๊ฐ€ ์–ด๋””์•ผ
์›Œ๋„ˆ ๋ธŒ๋ผ๋”์Šค\n๋ฐ์ด๋น„๋“œ ์ž‰๊ธ€๋ฆฌ์‹œ๋Š” 1990๋…„๋Œ€ ์ดˆ ์‹œ๋ฆฌ์ฆˆ๋ฅผ ์‹œ์ž‘ํ–ˆ๋‹ค. ์ด ์˜ํ™”๋“ค์€ ์ด 8๋ถ€์ž‘์œผ๋กœ ๋งŒ๋“ค์–ด์กŒ์œผ๋ฉฐ, ์ฒซ ๋ฒˆ์งธ ์ž‘ํ’ˆ์€ ใ€Šํ•ด๋ฆฌ ํฌํ„ฐ์™€ ๋งˆ๋ฒ•์‚ฌ์˜ ๋Œใ€‹์ด๋‹ค. ์ž‘๊ฐ€๋Š” J. K. ๋กค๋ง์ด๋ฉฐ, ์˜ํ™” ์‹œ๋ฆฌ์ฆˆ๋Š” ๋ฐฐ๊ธ‰์‚ฌ์ธ ์›Œ๋„ˆ ๋ธŒ๋ผ๋”์Šค๊ฐ€ ๋งŒ๋“ค์—ˆ๋‹ค. ์ดฌ์˜์€ 1997๋…„ 7์›” 11์ผ๋ถ€ํ„ฐ 12์›” 22์ผ๊นŒ์ง€ ๋Ÿฐ๋˜์—์„œ ์ด๋ฃจ์–ด์กŒ๋‹ค. ์ดฌ์˜ ์žฅ์†Œ๋กœ๋Š” ๋Ÿฐ๋˜ ํฌ๋ฆญ์Šค ์ŠคํŠœ๋””์˜ค์™€ ๋Ÿฐ๋˜ ์‹œํ‹ฐ ์˜คํ”ผ์Šค๊ฐ€ ์‚ฌ์šฉ๋˜์—ˆ๋‹ค. ๋ฐ์ด๋น„๋“œ ์ž‰๊ธ€๋ฆฌ์‹œ๋Š” ํ•ด๋ฆฌ ํฌํ„ฐ ์—ญํ• ์„ ๋งก์•˜๋‹ค.
์™œ ์„ธ๊ณ„์‹œ๊ฐ„์˜ ๊ธฐ์ค€์ด ์˜๊ตญ์˜ GMT์ธ๊ฐ€์š”? ๊ทธ ์ด์œ ๋Š” ๋ฌด์—‡์ผ๊นŒ์š”?
์˜๊ตญ์˜ GMT๋Š” ์„ธ๊ณ„์‹œ๊ฐ„์˜ ๊ธฐ์ค€์ด ๋˜๋Š” ์‹œ๊ฐ„๋Œ€์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ด ์‹œ๊ฐ„๋Œ€๋Š” ํ‘œ์ค€ํ™”๋˜์ง€ ์•Š์•˜์œผ๋ฉฐ, ๋”ฐ๋ผ์„œ ๋‹ค๋ฅธ ๋‚˜๋ผ์˜ ์‹œ๊ฐ„๋Œ€์™€ ์ฐจ์ด๊ฐ€ ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ด ์‹œ๊ฐ„๋Œ€๋ฅผ ์„ธ๊ณ„์‹œ๊ฐ„์œผ๋กœ ์ฐฉ๊ฐํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ, ์„ธ๊ณ„์‹œ๊ฐ„์˜ ๊ธฐ์ค€์€ ํ‘œ์ค€ํ™”๋œ ์‹œ๊ฐ„๋Œ€๋ฅผ ๋”ฐ๋ฅด๋„๋ก ํ•˜๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค.

Original model card: Meta's Llama 2 13B-chat

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.

Model Developers Meta

Variations Llama 2 comes in a range of parameter sizes โ€” 7B, 13B, and 70B โ€” as well as pretrained and fine-tuned variations.

Input Models input text only.

Output Models generate text only.

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.

Training Data Params Content Length GQA Tokens LR
Llama 2 A new mix of publicly available online data 7B 4k โœ— 2.0T 3.0 x 10-4
Llama 2 A new mix of publicly available online data 13B 4k โœ— 2.0T 3.0 x 10-4
Llama 2 A new mix of publicly available online data 70B 4k โœ” 2.0T 1.5 x 10-4

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.

Model Dates Llama 2 was trained between January 2023 and July 2023.

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.

License A custom commercial license is available at: https://ai.meta.com/resources/models-and-libraries/llama-downloads/

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/.

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.

Intended Use

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.

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.

Hardware and Software

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.

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.

Time (GPU hours) Power Consumption (W) Carbon Emitted(tCO2eq)
Llama 2 7B 184320 400 31.22
Llama 2 13B 368640 400 62.44
Llama 2 70B 1720320 400 291.42
Total 3311616 539.00

CO2 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.

Training Data

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.

Data Freshness The pretraining data has a cutoff of September 2022, but some tuning data is more recent, up to July 2023.

Evaluation Results

In this section, we report the results for the Llama 1 and Llama 2 models on standard academic benchmarks. For all the evaluations, we use our internal evaluations library.

Model Size Code Commonsense Reasoning World Knowledge Reading Comprehension Math MMLU BBH AGI Eval
Llama 1 7B 14.1 60.8 46.2 58.5 6.95 35.1 30.3 23.9
Llama 1 13B 18.9 66.1 52.6 62.3 10.9 46.9 37.0 33.9
Llama 1 33B 26.0 70.0 58.4 67.6 21.4 57.8 39.8 41.7
Llama 1 65B 30.7 70.7 60.5 68.6 30.8 63.4 43.5 47.6
Llama 2 7B 16.8 63.9 48.9 61.3 14.6 45.3 32.6 29.3
Llama 2 13B 24.5 66.9 55.4 65.8 28.7 54.8 39.4 39.1
Llama 2 70B 37.5 71.9 63.6 69.4 35.2 68.9 51.2 54.2

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.

TruthfulQA Toxigen
Llama 1 7B 27.42 23.00
Llama 1 13B 41.74 23.08
Llama 1 33B 44.19 22.57
Llama 1 65B 48.71 21.77
Llama 2 7B 33.29 21.25
Llama 2 13B 41.86 26.10
Llama 2 70B 50.18 24.60

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).

TruthfulQA Toxigen
Llama-2-Chat 7B 57.04 0.00
Llama-2-Chat 13B 62.18 0.00
Llama-2-Chat 70B 64.14 0.01

Evaluation of fine-tuned LLMs on different safety datasets. Same metric definitions as above.

Ethical Considerations and Limitations

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.

Please see the Responsible Use Guide available at https://ai.meta.com/llama/responsible-use-guide/

Downloads last month
6
Inference Examples
Inference API (serverless) has been turned off for this model.

Space using davidkim205/komt-Llama-2-7b-chat-hf-lora 1