Enfoques de ajuste fino

Introducción a los LLMs en Python

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

Ajuste fino

 

Caso de uso de ajuste fino de LLMs en química

Introducción a los LLMs en Python

Ajuste fino completo

 

  • Se actualizan todos los pesos del modelo
  • Coste computacional alto

 

Ajuste fino completo

Introducción a los LLMs en Python

Ajuste fino parcial

 

  • Algunas capas se fijan
  • Solo se actualizan las capas de la tarea

 

Ajuste fino parcial

Introducción a los LLMs en Python

Aprendizaje por transferencia

 

  • Se adapta un modelo preentrenado a una tarea distinta pero relacionada
  • Aprovecha conocimiento de un dominio a otro afín

El paradigma del aprendizaje por transferencia

Introducción a los LLMs en Python

Aprendizaje N-shot

  • Zero-shot learning: sin ejemplos
  • One-shot learning: un ejemplo
  • Few-shot learning: varios ejemplos
Introducción a los LLMs en 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
Introducción a los LLMs en Python

¡Vamos a practicar!

Introducción a los LLMs en Python

Preparing Video For Download...