Generative AI with LLMs (Week 3)

Generative AI with LLMs (Week 3)

Tags
machine-learning
python
Published
October 6, 2023
Author
Chris Chan
Generative AI with LLMs (Week 3)

Generative AI with LLMs (Week 3)

Course Notes and Slides from DeepLearning.AI’s Generative AI with LLMs course.
 

Reinforcement Learning with Human Feedback (RLHF)

 
notion image
RL algorithm typically used is PPO (proximal policy optimization)
 
 
notion image
 
KL divergence is used to penalize model outputs that shift too far from reference model.
 

Constitutional AI

Using model self supervision to train harmless AI assistant.
System is given a set of rules to follow.
Supervision Phase: Generate self-critiques and revisions
 
In the supervised phase we sample from an initial model, then generate self-critiques and revisions, and then finetune the original model on revised responses. In the RL phase, we sample from the finetuned model, use a model to evaluate which of the two samples is better, and then train a preference model from this dataset of AI preferences
 

Model Optimizations

notion image
Distillation - Train smaller model with larger model
Quantization - Reduce precision of model weights
Pruning - Removing model weights with value close or qual to zero (retraining, PEFT, LORA)
 

Time and Effort in Lifecycle

notion image
 

LLM Applications

 
notion image
Modern LLM applications involve orchestration libraries interacting with LLMs, data sources and applications to facilitate user request.

Retrieval Augmented Generation

notion image
Adding external information sources to the context window to
 

Chain of Thought Prompting

notion image
 
Guiding LLM to breakdown a problem by steps.

Program Aided Language Model

notion image
Get LLM to work with code interpreter. Allows for better math responses.
 

ReAct: Synergizing Reasoning and Actions in LLMs

 
notion image
ReAct Prompt consists of:
Question - Problem that requires advanced reasoning and multiple steps to solve.
Thought - identifies how model will tackle problem (e.g search [entity])
Action - info to lookup
Observation - new info found
 

LLM App Architecture

 
Modern apps will contain the following:
  • API
  • LLM Tools & Frameworks
  • Info sources
  • LLM Models
  • Generated feedback
  • Infrastructure
notion image
 
Â