Fine-tuning d'un LLM

Présentation

  • Personnaliser un LLM
  • Comment fine-tuner ?
  • Travaux pratiques 🛠
  • Références

Personnaliser un LLM

  • Prompt Engineering
  • Retrieval-Augmented Generation (RAG)
  • Fine-tuning
  • Full training

Prompt engineering

Retrieval-Augmented Generation (RAG)

Comment fine-tuner ?

On part avec :

  • un LLM
  • un dataset spécifique à notre domaine ou tâche
  • une méthode d'évaluation

Qu'est-ce qu'on modifie ?

LLama 7B, 13B, 70B c'est :

7 000 000 000
13 000 000 000
70 000 000 000

paramètres !

ML CO2 Impact

Quantifying the Carbon Emissions of Machine Learning

https://mlco2.github.io/impact

Apprentissage

L'apprentissage d'un LLM est très coûteux :

💵

PEFT !

Parameter Efficient Fine-Tuning

  • méthodes sélectives
  • méthodes de reparamétrisation (LoRA)
  • méthodes additives

LoRA: Low-Rank Adaptation

Quantification (1/2)

Quantification (2/2)

Méthodes d'alignement

  • Reinforcement Learning by Human Feedback (RLHF)
  • Direct Preference Optimization (DPO)

TP 🛠

Notebook de fine-tuning (wandb)
Notebook d'inférence (vanilla)

Générateur de dataset

Références

Ressources

Outils

Infra

  • Google Colab
  • GPU dédié sur runpod.io
  • Inference sur octoai.cloud

Librairies

Sources des données

Utiliser un RAG est très efficace.

Le fine-tuning n'est pas souvent la solution.

https://www.tidepool.so/blog/why-you-probably-dont-need-to-fine-tune-an-llm

https://arxiv.org/abs/1706.03762

Epoch, ‘Parameter, Compute and Data Trends in Machine Learning’. Published online at epochai.org. Retrieved from: https://epochai.org/data/epochdb/visualization

https://blogs.nvidia.com/blog/tensorfloat-32-precision-format/

https://intellabs.github.io/distiller/algo_quantization.html