1/21
Looks like no tags are added yet.
LLM’s Intro
systems trained to predict and generate text sequences
often predicting the next word
all built on architecture of deep neural networks
Deep learning for text
deep learning makes it possible to apply the same learning algorithm to many diff tasks. if we look at the code that is used to build an image classifier using ImageNet, relatively little is specific to the fact that what’s being classified is images
the fact that the weights of trained model correspond to visual concepts is a consequence of training data not algorithm
LLMs
language models are systems that are trained to predict and generate text sequences. their inputs and outputs are best understood initially as sequences of words (or tokens)
language modeling is the task of presenting a model with a sequence of words and asking it to predict the next work that is most likely to appear
Training data
what makes next-word-prediction-task appealing is there’s an astronomical amount of training data online
dont need specific training data
even better, training data does not need to be labeled. the sequence of words itself forms the labels.
BUT only because AI companies appropriate the labor of those who generated the task, without credit. (meaning they scrape data from the internet without compensation for people writing those things)
Training the “base” model
giving model a sequence of words and asking what is the next word
similar to backpropagation (give neural network batch of 10, have it make predictions, adjust weights)

Tokens
the atomic unit that language models are trained on and make predictions on
a word (dogs or cats)
a character (one token for each character)
subwords (roots, prefixes, etc)
a token in a LLM is the equivalent to a pixel in an image generation model
sentence of text broken down into some number of tokens
AI has no meaningful concept of what a word but knows token. thinks in terms of tokens.
Transformer
the “T” in chatGPT stands for transformer
this is needed to account for “long-range dependencies” in text
early automated language translation apps worked well for short sentences but ran into trouble with longer ones
allows model to have larger sense of context when predicting what the word might be
developed by Google in 2017
transformer is a brute-force solution involving computing a big matrix when processing a piece of text
the matrix quantifies the degree to which each word in the text was related to every other word
processing big matrix was just the kind of task that GPUs excel in because it involves performing a large number of calculations in parallel
using transformers, neural networks are able to build more complex concepts
ex: input is a story
lower layers of network might track relationships like connection between noun and verb
as network “reads through” it may keep track of information about characters, timeline, etc
LLMs
tokenizer: breaks down the sentence into tokens
calculates the probability of each token being the next thing in the sequence

LLMs step by step text generation
not all at once
LLM picks okay here is my input, let me predict next token
okay now i have input and now lets generate new token
repeat….
this is incredibly computationally expensive. to generate a single token, a trillion mathematical operations are performed.

Sampling
may choose the highest probability token but there may be good reasons for picking other tokens
sampling: choosing from the distribution in a way where higher-probability tokens have a higher chance of being picked
this is why the same prompt can lead to different responses
text generation is deterministic
Halluciantions
LLMs are trained to produce plausible text not true statements
even if AI developers were to accomplish the task of filtering dataset to only contain true statements, it would not matter
the model cannot memorize all those facts, can only learn patters and remix them when generating text
its kind of like the LLM is just writing stuff without knowing what it will end up with
its created to predict the next best word not the next best true word (e.g. book recommendations)
Pretrained Chatbots
the P in ChatGPT means pre-trained
all of these chatbots are just a multitude of large language models that have been trained on a massive dataset of text.
they have broad knowledge of patterns of text
pretrained models are often general purpose and can then be customized
Fine-tuning Chatbots
fine tuning is the process of taking a pre-trained model and further training it on task or domain specific data.
instead of training a model from scratch, fine tuning starts with a model that already understands general patterns and adjusts its parameters to perform well on a particular case
understanding medical terms, coding abilities, etc
fine tuning tailors the model
Post-training Chatbots
base models have strong capabilities, including reasoning, summarization, translation, etc
post training helps polish these model behaviors by using a smaller set of training examples

Supervised fine tuning
first step of post training
aka instruction tuning b/c its where a model is trained to follow instructions we give in prompts

Reinforcement learning from human feedback
one of most commonly used reinforcement learning (RL) methods in training LLMs
replies on preference scores collected from humans or specialized models called reward models, themselves often being LLMs as well
rather than simply providing a training set with responses, would create a reward model or a scorer to provide scores to help an LLM understand which set of responses are more deemed helpful
RLHF (reinforcement learning from human feedback)
to teach a model to be funny with SFT not only requires the cost and labor of writing or acquiring enough jokes to constitute a learnable pattern but also requires what a given data scientist thinks is funny aligns with what the user base would find funny
RHLF provides a mathematically crowdsourced alternative: prompt the LLM to generate jokes and have human testers rate the quality. these ratings can be used to train a reward model to predict the kinds of jokes that will receive positive feedback and in turn that reward model can be used to train the LLM through RL

Human Labor
RHLF requires human labor.
need for training gen AI has led to a reliance on labor in countries outside the US and Europe
training chatbots to provide helpful responses to prompts
preventing toxic content
costs
low pay
high workloads
unpleasant tasks
AI Agent
“an agent is anything that can be viewed as perceiving its environment through sensors and and acting upon that environment through actuators”
the agent program or brain of an LLM-backed agent is a “reasoning” LLM which is a model capable of complex thinking.

AI Agent Tools
LLMs are often connected to other commands and processes on the computer
on its own, it just generates text but connected with other tools and programs, it can connect to multiple things

AI Agent Planning and Reflection
the LLMs are creating a plan, thinking through multiple steps at a time
this is a sequence of tasks i need to carry out
carry out each one
