Gen AI and AI Agents (9/23)

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/21

encourage image

There's no tags or description

Looks like no tags are added yet.

22 Terms

1
New cards

LLM’s Intro

  • systems trained to predict and generate text sequences

  • often predicting the next word

  • all built on architecture of deep neural networks


2
New cards

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


3
New cards

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


4
New cards

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)


5
New cards


6
New cards

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)


<ul><li><p>giving model a sequence of words and asking what is the next word</p></li><li><p>similar to backpropagation (give neural network batch of 10, have it make predictions, adjust weights) </p></li></ul><p></p>
7
New cards

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.


8
New cards

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


9
New cards

LLMs

  • tokenizer: breaks down the sentence into tokens

    • calculates the probability of each token being the next thing in the sequence


<ul><li><p>tokenizer: breaks down the sentence into tokens</p><ul><li><p>calculates the probability of each token being the next thing in the sequence </p></li></ul></li></ul><p></p>
10
New cards

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.

<ul><li><p>not all at once</p><ul><li><p>LLM picks okay here is my input, let me predict next token</p></li><li><p>okay now i have input and now lets generate new token</p></li><li><p>repeat….</p></li></ul></li></ul><p></p><p>this is incredibly computationally expensive. to generate a single token, a trillion mathematical operations are performed. </p>
11
New cards

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


12
New cards

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)


13
New cards

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


14
New cards

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


15
New cards

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


<ul><li><p>base models have strong capabilities, including reasoning, summarization, translation, etc </p></li><li><p>post training helps polish these model behaviors by using a smaller set of training examples</p></li></ul><p></p>
16
New cards

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


<ul><li><p>first step of post training</p></li><li><p>aka instruction tuning b/c its where a model is trained to follow instructions we give in prompts</p></li></ul><p></p>
17
New cards

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


18
New cards

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


<ul><li><p>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</p></li><li><p>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</p></li></ul><p></p>
19
New cards

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


20
New cards

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.


<ul><li><p>“an agent is anything that can be viewed as perceiving its environment through sensors and and acting upon that environment through actuators” </p></li><li><p>the agent program or brain of an LLM-backed agent is a “reasoning” LLM which is a model capable of complex thinking. </p></li></ul><p></p>
21
New cards

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


<ul><li><p>LLMs are often connected to other commands and processes on the computer</p></li><li><p>on its own, it just generates text but connected with other tools and programs, it can connect to multiple things  </p></li></ul><p></p>
22
New cards

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


<ul><li><p>the LLMs are creating a plan, thinking through multiple steps at a time</p><ul><li><p>this is a sequence of tasks i need to carry out</p></li><li><p>carry out each one </p></li></ul></li></ul><p></p>