Approches d’affinage

Introduction aux LLM en Python

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

Affinage

 

LLMs fine-tuning chemistry use case

Introduction aux LLM en Python

Full fine-tuning

 

  • Les poids de l'ensemble du modèle sont mis à jour
  • Coûteux en termes de calcul

 

Full fine-tuning

Introduction aux LLM en Python

Partial fine-tuning

 

  • Certaines couches sont fixes
  • Seules les couches spécifiques à la tâche sont mises à jour

 

Partial fine-tuning

Introduction aux LLM en Python

Apprentissage par transfert

 

  • Un modèle pré-entraîné est adapté à une tâche différente mais connexe
  • Exploite les connaissances d'un domaine dans un domaine connexe

The transfer learning paradigm

Introduction aux LLM en Python

Apprentissage N-shot

  • Apprentissage zero-shot : aucun exemple
  • Apprentissage one-shot : un exemple
  • Apprentissage few-shot : plusieurs exemples
Introduction aux LLM en Python

Apprentissage one-shot

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
Introduction aux LLM en Python

Passons à la pratique !

Introduction aux LLM en Python

Preparing Video For Download...