상세 컨텐츠

본문 제목

Lab 2 walkthrough

Generative AI with Large Language Models

by Taeyoon.Kim.DS 2023. 8. 23. 18:07

본문

https://www.coursera.org/learn/generative-ai-with-llms/lecture/A6TDx/lab-2-walkthrough

 

Lab 2 walkthrough - Week 2 | Coursera

Video created by deeplearning.ai, Amazon Web Services for the course "Generative AI with Large Language Models". Fine-tuning and evaluating large language models

www.coursera.org

In this week's lab, you'll be exploring fine-tuning using Parameter-Efficient Fine-Tuning (PEFT) with LoRA to improve the summarization capabilities of the Flan-T5 model. Chris will guide you through the lab.

Lab 2 involves hands-on experience with both full fine-tuning and PEFT with instruction prompts. You'll fine-tune the Flan-T5 model for your specific summarization task using your own prompts. You'll start by training the model and evaluating its performance.

First, you'll perform full fine-tuning by fine-tuning the model with specific prompts for your task. You'll load the dataset, the original model, and create prompts with instructions. Then, you'll use training arguments for fine-tuning.

After training, you'll compare the performance of the fine-tuned model with the original Flan-T5 using qualitative and quantitative methods, particularly focusing on ROUGE scores. You'll observe a significant improvement in ROUGE scores after fine-tuning.

Next, you'll dive into Parameter-Efficient Fine-Tuning (PEFT) with LoRA. PEFT allows you to fine-tune models with reduced resource requirements. You'll configure LoRA parameters and train only a small percentage of model parameters. This is done to minimize resource consumption.

You'll perform inference using the PEFT model, and there's a flag set to reduce resource usage as you're only interested in inference, not training. This helps minimize resource requirements during inference.

You'll build sample prompts and compare the results qualitatively between the original model, instruction fine-tuned model, and PEFT fine-tuned model. While PEFT may show a slight drop in performance compared to full fine-tuning, it's much more resource-efficient.

Finally, you'll compare the ROUGE metrics for all models, demonstrating that PEFT offers resource savings without significant loss in summarization quality.

 

이번 주의 실험에서는 파라미터 효율적 미세 조정 (PEFT) 및 LoRA를 사용하여 Flan-T5 모델의 요약 능력을 개선하는 방법을 살펴보게 됩니다. Chris가 실험을 안내해줄 것입니다.

Lab 2는 전체 미세 조정 및 명령 프롬프트를 사용한 PEFT를 경험하는 것을 포함하며, 특정 요약 작업에 대한 자체 프롬프트를 사용하여 Flan-T5 모델을 미세 조정할 것입니다. 먼저, 실험을 위해 모델을 훈련하고 성능을 평가할 것입니다.

먼저, 특정 작업을 위한 프롬프트로 모델을 미세 조정하여 전체 미세 조정을 수행합니다. 데이터 세트, 원래 모델을로드하고 명령 포함 프롬프트를 생성합니다. 그런 다음 미세 조정을 위한 교육 인수를 사용합니다.

훈련 후, 미세 조정 모델의 성능을 원래 Flan-T5와 비교하며, 특히 ROUGE 점수에 중점을 둡니다. 미세 조정 후 ROUGE 점수에서 상당한 개선을 관찰하게 될 것입니다.

다음으로, 파라미터 효율적 미세 조정 (PEFT)과 LoRA에 대한 내용을 자세히 살펴봅니다. PEFT를 사용하면 리소스 요구 사항을 줄이면서 모델을 미세 조정할 수 있습니다. LoRA 매개 변수를 구성하고 모델 매개 변수의 작은 비율만 교육합니다. 이것은 리소스 소비를 최소화하기 위해 수행됩니다.

PEFT 모델을 사용하여 추론을 수행하며 추론 중 리소스 사용량을 줄이기 위해 플래그가 설정됩니다. 여기에서 교육이 아닌 추론만 관심이 있으므로 리소스 요구 사항을 최소화하는 데 도움이 됩니다.

샘플 프롬프트를 작성하고 원래 모델, 명령 프롬프트로 미세 조정된 모델 및 PEFT로 미세 조정된 모델 간의 결과를 질적으로 비교합니다. PEFT는 전체 미세 조정과 비교하여 성능이 약간 하락할 수 있지만 리소스 효율성이 훨씬 더 뛰어납니다.

마지막으로 모든 모델에 대한 ROUGE 지표를 비교하여 PEFT가 요약 품질에서 큰 손실 없이 리소스 절감을 제공하는 것을 보여줍니다.

 

Lab_2_fine_tune_generative_ai_model.ipynb
0.10MB

'Generative AI with Large Language Models' 카테고리의 다른 글

Introduction - Week 3 (Notion AI)  (0) 2023.08.28
Introduction - Week 3  (0) 2023.08.23
PEFT techniques 2: Soft prompts  (0) 2023.08.23
PEFT techniques 1: LoRA  (0) 2023.08.23
Parameter efficient fine-tuning (PEFT)  (0) 2023.08.23

관련글 더보기