Pendekatan fine-tuning

Pengantar LLM di Python

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

Fine-tuning

 

Kasus penggunaan fine-tuning LLMs di kimia

Pengantar LLM di Python

Full fine-tuning

 

  • Seluruh bobot model diperbarui
  • Mahal secara komputasi

 

Full fine-tuning

Pengantar LLM di Python

Partial fine-tuning

 

  • Beberapa layer dikunci
  • Hanya layer spesifik tugas yang diperbarui

 

Partial fine-tuning

Pengantar LLM di Python

Transfer learning

 

  • Model pralatih diadaptasi ke tugas lain yang terkait
  • Memanfaatkan pengetahuan dari satu domain ke domain terkait

Paradigma transfer learning

Pengantar LLM di Python

N-shot learning

  • Zero-shot learning: tanpa contoh
  • One-shot learning: satu contoh
  • Few-shot learning: beberapa contoh
Pengantar LLM di Python

One-shot learning

from transformers import pipeline

generator = pipeline(task="sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")

input_text = """
Classify the sentiment of this sentence as either Positive or Negative.
Example:
Text: "I'm feeling great today!" Sentiment: Positive
Text: "The weather today is lovely." Sentiment:
"""

result = generator(input_text, max_length=100)
print(result[0]["label"])
POSITIVE
Pengantar LLM di Python

Ayo berlatih!

Pengantar LLM di Python

Preparing Video For Download...