Marker-Inc-Korea/CoT-llama2

Chain-of-thought 방식을 활용하여 llama2를 fine-tuning

10

stars

14

commits

Nov 18, 2023

updated

README

CoT-llama2

CoT-llama2
Chain-of-thought 방식을 활용하여 llama2를 fine-tuning

CoT-llama-2k-7b: Hugging Face
KoCoT-2000: Hugging Face

Introduction

  • LLM 관련 프로젝트를 진행하면서, "LLM의 근본적인 성능의 문제는 파라미터보다 데이터셋의 품질에 더 의미가 있지 않을까?"라는 생각을 하게 되었습니다.

  • Kaist-CoTLIMA를 통해서 데이터의 개수보다 품질이 모델의 성능에 어느정도 기여한다는 사실을 깨닫게 되었습니다.

  • 이것을 동기부여로 삼아서, LIMA에서 1000~2000개의 데이터셋을 활용한 것을 기반으로 Kaist-CoT 데이터셋 중 2000개를 추출하여 학습하기로 하였습니다!🙂🙂

  • DeepL를 활용하여 번역하였고, 그 이후에 따로 직접적인 전처리를 하진 않고 바로 훈련에 도입했습니다.

  • 이렇게 만들어진 🥮KoCoT-2000🥮 데이터셋을 활용하여 beomi님의 llama-2-ko 모델을 fine-tuning 하였습니다.

  • 결과적으로 CoT-llama-2k-7b 모델을 만들게 되었고✌, 성능평가를 위해 Polyglot-Ko와 llama-2-ko 모델과 비교를 진행했습니다.🙂🙃

  • 본 연구는 (주)마커와 (주)미디어그룹사람과숲의 오픈소스 LLM 연구 컨소시엄에서 진행되었습니다.

Model Description

CoT-llama2-2k-7b

  • llama-2-ko-7B를 fine-tuning한 모델
  • 🥮CoT-llama2-2k-7b🥮 모델은 LIMA의 방법론을 이용하여 Kaist에서 제작한 데이터셋을 기반으로 Chain-Of-Thought를 잘 수행할 수 있도록 튜닝한 모델입니다✌✌

Training Hyperparameters (as LIMA)

HyperparametersValue
batch_size64
micro_batch_size1
Epochs15
learning_rate1e-5
cutoff_len2048
lr_schedulerlinear
base_modelbeomi/llama-2-ko-7b

Quick start

Colab Code: Open In Colab

Datasets

KoCoT_2000

Using DeepL Pro API, translate about Kaist-CoT.

Performance

When I evaluated Ko-Platy, I used this repo.
And, implement below code.

# In colab,
!python main.py \
    --model gpt2 \ 
    --model_args pretrained=..your_model_name.. \
    --tasks kobest_hellaswag,kobest_copa,kobest_boolq,kobest_sentineg \
    --device cuda:0 \
    --num_fewshot 0 # 5, 10, 25, ...

COPA (F1)

Model0-shot5-shot10-shot50-shot
Polyglot-ko-1.3b0.71960.71930.72040.7206
Polyglot-ko-3.8b0.75950.76080.76380.7788
Polyglot-ko-5.8b0.77450.76760.77750.7887
Polyglot-ko-12.8b0.79370.81080.80370.8369
Llama-2-Ko-7b 20B0.73880.76260.78080.7979
Llama-2-Ko-7b 40B0.74360.79270.80370.8259
KO-platypus2-7B-EX(ours)0.75090.78990.80290.8290
CoT-llama-2(ours)0.75280.78880.79980.8210

HellaSwag (F1)

Model0-shot5-shot10-shot50-shot
Polyglot-ko-1.3b0.52470.52600.52780.5427
Polyglot-ko-3.8b0.57070.58300.56700.5787
Polyglot-ko-5.8b0.59760.59980.59790.6208
Polyglot-ko-12.8b0.59540.63060.60980.6118
Llama-2-Ko-7b 20B0.45180.46680.47260.4828
Llama-2-Ko-7b 40B0.45620.46570.46980.4774
KO-platypus2-7B-EX(ours)0.45710.44610.43710.4525
CoT-llama-2(ours)0.45430.45540.46060.4579

BoolQ (F1)

Model0-shot5-shot10-shot50-shot
Polyglot-ko-1.3b0.35520.47510.41090.4038
Polyglot-ko-3.8b0.43200.52630.49300.4038
Polyglot-ko-5.8b0.43560.56980.51870.5236
Polyglot-ko-12.8b0.48180.60410.62890.6448
Llama-2-Ko-7b 20B0.36070.67970.68010.6622
Llama-2-Ko-7b 40B0.57860.69770.70840.7144
KO-platypus2-7B-EX(ours)0.60280.69790.70160.6988
CoT-llama-2(ours)0.58520.69470.70590.7213

SentiNeg (F1)

Model0-shot5-shot10-shot50-shot
Polyglot-ko-1.3b0.67900.62570.55140.7851
Polyglot-ko-3.8b0.48580.79500.73200.7851
Polyglot-ko-5.8b0.33940.88410.88080.9521
Polyglot-ko-12.8b0.91170.90150.93450.9723
Llama-2-Ko-7b 20B0.48550.82950.87110.8513
Llama-2-Ko-7b 40B0.45940.76110.72760.9370
KO-platypus2-7B-EX(ours)0.58210.76530.79910.8643
CoT-llama-2(ours)0.50450.80540.79420.9446

References

Kaist-COT CoT-llama
KoCoT-2000
llama-2-ko
ko-lm-evaluation-harness

TODO

  • Make CoT-llama2-7b
  • Share huggingface repo
  • Share evaluation results
  • Share sample code

Contributors

KyujinHan

14 commits

Marker-Inc-Korea/CoT-llama2

Chain-of-thought 방식을 활용하여 llama2를 fine-tuning

10

stars

14

commits

Nov 18, 2023

updated

README

CoT-llama2

CoT-llama2
Chain-of-thought 방식을 활용하여 llama2를 fine-tuning

CoT-llama-2k-7b: Hugging Face
KoCoT-2000: Hugging Face

Introduction

  • LLM 관련 프로젝트를 진행하면서, "LLM의 근본적인 성능의 문제는 파라미터보다 데이터셋의 품질에 더 의미가 있지 않을까?"라는 생각을 하게 되었습니다.

  • Kaist-CoTLIMA를 통해서 데이터의 개수보다 품질이 모델의 성능에 어느정도 기여한다는 사실을 깨닫게 되었습니다.

  • 이것을 동기부여로 삼아서, LIMA에서 1000~2000개의 데이터셋을 활용한 것을 기반으로 Kaist-CoT 데이터셋 중 2000개를 추출하여 학습하기로 하였습니다!🙂🙂

  • DeepL를 활용하여 번역하였고, 그 이후에 따로 직접적인 전처리를 하진 않고 바로 훈련에 도입했습니다.

  • 이렇게 만들어진 🥮KoCoT-2000🥮 데이터셋을 활용하여 beomi님의 llama-2-ko 모델을 fine-tuning 하였습니다.

  • 결과적으로 CoT-llama-2k-7b 모델을 만들게 되었고✌, 성능평가를 위해 Polyglot-Ko와 llama-2-ko 모델과 비교를 진행했습니다.🙂🙃

  • 본 연구는 (주)마커와 (주)미디어그룹사람과숲의 오픈소스 LLM 연구 컨소시엄에서 진행되었습니다.

Model Description

CoT-llama2-2k-7b

  • llama-2-ko-7B를 fine-tuning한 모델
  • 🥮CoT-llama2-2k-7b🥮 모델은 LIMA의 방법론을 이용하여 Kaist에서 제작한 데이터셋을 기반으로 Chain-Of-Thought를 잘 수행할 수 있도록 튜닝한 모델입니다✌✌

Training Hyperparameters (as LIMA)

HyperparametersValue
batch_size64
micro_batch_size1
Epochs15
learning_rate1e-5
cutoff_len2048
lr_schedulerlinear
base_modelbeomi/llama-2-ko-7b

Quick start

Colab Code: Open In Colab

Datasets

KoCoT_2000

Using DeepL Pro API, translate about Kaist-CoT.

Performance

When I evaluated Ko-Platy, I used this repo.
And, implement below code.

# In colab,
!python main.py \
    --model gpt2 \ 
    --model_args pretrained=..your_model_name.. \
    --tasks kobest_hellaswag,kobest_copa,kobest_boolq,kobest_sentineg \
    --device cuda:0 \
    --num_fewshot 0 # 5, 10, 25, ...

COPA (F1)

Model0-shot5-shot10-shot50-shot
Polyglot-ko-1.3b0.71960.71930.72040.7206
Polyglot-ko-3.8b0.75950.76080.76380.7788
Polyglot-ko-5.8b0.77450.76760.77750.7887
Polyglot-ko-12.8b0.79370.81080.80370.8369
Llama-2-Ko-7b 20B0.73880.76260.78080.7979
Llama-2-Ko-7b 40B0.74360.79270.80370.8259
KO-platypus2-7B-EX(ours)0.75090.78990.80290.8290
CoT-llama-2(ours)0.75280.78880.79980.8210

HellaSwag (F1)

Model0-shot5-shot10-shot50-shot
Polyglot-ko-1.3b0.52470.52600.52780.5427
Polyglot-ko-3.8b0.57070.58300.56700.5787
Polyglot-ko-5.8b0.59760.59980.59790.6208
Polyglot-ko-12.8b0.59540.63060.60980.6118
Llama-2-Ko-7b 20B0.45180.46680.47260.4828
Llama-2-Ko-7b 40B0.45620.46570.46980.4774
KO-platypus2-7B-EX(ours)0.45710.44610.43710.4525
CoT-llama-2(ours)0.45430.45540.46060.4579

BoolQ (F1)

Model0-shot5-shot10-shot50-shot
Polyglot-ko-1.3b0.35520.47510.41090.4038
Polyglot-ko-3.8b0.43200.52630.49300.4038
Polyglot-ko-5.8b0.43560.56980.51870.5236
Polyglot-ko-12.8b0.48180.60410.62890.6448
Llama-2-Ko-7b 20B0.36070.67970.68010.6622
Llama-2-Ko-7b 40B0.57860.69770.70840.7144
KO-platypus2-7B-EX(ours)0.60280.69790.70160.6988
CoT-llama-2(ours)0.58520.69470.70590.7213

SentiNeg (F1)

Model0-shot5-shot10-shot50-shot
Polyglot-ko-1.3b0.67900.62570.55140.7851
Polyglot-ko-3.8b0.48580.79500.73200.7851
Polyglot-ko-5.8b0.33940.88410.88080.9521
Polyglot-ko-12.8b0.91170.90150.93450.9723
Llama-2-Ko-7b 20B0.48550.82950.87110.8513
Llama-2-Ko-7b 40B0.45940.76110.72760.9370
KO-platypus2-7B-EX(ours)0.58210.76530.79910.8643
CoT-llama-2(ours)0.50450.80540.79420.9446

References

Kaist-COT CoT-llama
KoCoT-2000
llama-2-ko
ko-lm-evaluation-harness

TODO

  • Make CoT-llama2-7b
  • Share huggingface repo
  • Share evaluation results
  • Share sample code

Contributors

KyujinHan

14 commits