- Welcome to 14.1, Modern Large Language Models.
You may be asking yourself, "Large language models?
haven't we already been working with language models?"
And the answer is yes.
If you were to ask someone "What is a large language model?"
they would say, "Well
LLMs, large language models, are simply machine
learning models that are trained to process
and generate natural language text."
But we have already seen these.
In these lessons, we've seen BERT, GPT-2, T5,
all of these are LLMs, large language models,
but we're gonna shift our attention
to massively large language models.
Models like GPT three and beyond.
These contain billions of parameters,
whereas our previous models we've seen were
in the meager hundreds of millions of parameters.
But these massive language models are
on a order of magnitude larger in the number
of parameters that they contain,
and also in the size of the data sets they were trained on.
And again, we've talked about pre-training before.
We've seen web text that GPT-2 is trained on.
We've talked about common crawl that T5 was trained on,
but these massively large language models,
these massive LLMs, these models can perform a wide range
of language tasks ranging from translation, summarization,
question and answering.
And as we'll see a lot more, with absolutely
no further fine tuning required.
Coming back to the idea of size, we've saw, for example
BERT has around 110 million parameters, at least the base
model of BERT as it was introduced in 2018,
which is still considered large.
But again, when we talk about massively large, we're talking
in the order of, for example, GPT-3,
which has 175 billion parameters to its name.
And this number will only go up as these models
progress in advancements.
And they are obviously comparatively massive,
but size is not the only factor to consider here.
Bigger does not mean better for all
natural language processing tasks.
BERT still achieves strong results and in some cases
stronger results than these massively large language models
on particular types of tasks that BERT is suited for, like
for example, sequence classification, which we
have seen before.
To work with these massively large language models,
we are generally talking about what are called
closed sourced types of models,
meaning they are owned and operated by
a company or organization that creates them.
And to interact with them, we generally have to use
either what's called a Playground, or an API.
Playgrounds are graphical interfaces to play
with and also develop with these LLMs.
And we'll see an example of that in this lesson.
We'll also see an example
of interacting with these massive LLMs
through an API, an application programming interface,
which is just a programmatic interface to the LLM,
meaning we'll be able to actually call the LLM using
in our case, Python from a Jupyter notebook,
which we will also see in our examples later in this lesson.
For example, if we wanted to interact with say, GPT-3,
which is owned and operated by OpenAI,
the same people who made GPT-2 that we saw
in earlier lessons, you would have to use either their API
or as we're looking at here, their playground.
This is literally a website
that you can go to to talk to and interact with
GPT-3, the massive large language model.
As you can see, the playground is mostly taken
up by this large text area
in the middle, where you actually get to type in
a request or what we'll come to call a prompt
to the LLM and see its response.
However, you'll notice
on the right we do have some other options,
and some of these options should look familiar to you.
We see, for example, temperature,
which means exactly the same thing as it did with GPT-2.
It is an inference parameter that is used to
toggle the randomness of the model's output.
And we'll see these in action when we turn our attention
to actually using the playground for ourselves.
But pretty much all playgrounds will look
something like this.
You have a text area, you type in a request
to the LLM, you got a response back
and what you do with that response is now up to you.
So for example,
if I wanted to ask GPT-3 to write me a tweet talking
about how great GPT-3 is, it might look something
like this, in that large text area of the playground,
I would type in my prompt, my request to the LLM.
In this case, that prompt is "Write a tweet talking
about how great GPT-3 is.
highlighted in green is GPT-3 response
to me, giving me exactly what I asked for.
"GPT-3 is amazing.
It's already revolutionizing AI,
and it's only getting better."
With appropriate hashtags,
because I asked specifically for a tweet.
Now this is not a summarization task, nor is it a question
and answering task, nor is it really one
of the structured NLP tasks that we've talked
about throughout our lessons.
And this is what has caught the attention
and the eyes of so many people, is that
as you take these large language models and you enter
into the realm of massively large language models,
we start to see a great enhancement
in the types of tasks or just day-to-day requests
that these language models can perform for us.
We stop thinking so much
in terms of "What sequences am I classifying
or is this abstractive or extractive summarization?"
And you start to interact with these models on more
of an everyday, "Well, can you help me do this small task?
Can you help me solve this?
Can you help me rewrite this paragraph?
For example, for let's say my resume or my cover letter,
can you help me do these text-based tasks that I'm
having that aren't necessarily structured academic tasks?"
And this is what has really popularized these
large language models and thrust them into the media,
and also into the hands of everyday developers.
So here is that GPT-3 playground that I was talking about.
In its real form, I am actually on the playground.
So if I wanted to interact with the model,
I can just start typing
in any kind of instruction that I have.
For example, let's say I was tasked
with planning a birthday party
for a five-year-old who happens to Marvel and Disney.
So I'm gonna ask GPT-3, straight up,
what are some birthday party ideas
for a five-year-old who loves Marvel and Disney?
Now, for the most part, on the side here
I get to choose a lot of my parameters,
and I've actually not toggled any of these parameters.
So we're gonna see just a straight answer
from the model as is.
To do this, I'll hit submit, take my hands off the screen
and all of a sudden GPT-3, like its cousin
GPT-2, being an auto aggressive language model,
is going to start thinking token
by token about a response to my command, to my instruction.
So it's given me four ideas.
I'm not gonna read off all of them, but they range
from holding a superhero themed party, all the way
to having a combined Marvel Disney party
with decorations and activities.
Now, this could be the end of it.
We could be done here, but
if I wanna continue this conversation with the LLM,
I could hit enter a few times in the playground and say
"Can you tell me more about the third option?"
Now, if we're thinking in terms of an LLM or just
a language language model in general, we
kind of now understand how the language model is thinking.
It's going to take all of this information
as a prompt or an input
to the model, and generate a second output to our question.
This is not unlike how say T5 or GPT-2 works,
using an input to the model
we would ask it a certain task
and ask it to solve that task.
So if I hit submit again, it understands while
the third option it gave me, being the Marvel themed party
with a Marvel inspired cake and decorations,
it understands, it remembers rather,
or I should say more literally, it can see the third option
that it itself wrote and say, "Yeah, sure."
For the third option, you could host a Marvel themed party
with decorations featuring Marvel characters,
serving a Marvel inspired cake,
and have activities like Marvel movie
marathon, arts and crafts, and scavenger hunts with prizes.
Now, if this is all sounding a little common
and not so interesting, I'm gonna throw that back and say,
but doesn't this open up
an infinite number of possibilities?
It now understands what Marvel and Disney are.
It knows what parties are like for five-year-olds.
The world is now my oyster.
I don't have to be a natural language processing specialist
or a machine learning engineer
and train a model to understand what parties are.
At the massive level, we start to see general information
and general knowledge being encoded directly
into the parameters of these auto aggressive
language models, and we can see the result
of that being very fine-tuned answers to our question.
Now I'm painting in broad strokes here,
because later on in our lesson we're going to
see exactly how this came to be.
Because if we were to type something like this
into GPT-2 for example, we would not get anything close
to a specific answer like we're seeing here.
That comes with a special edition to GPT-3
courtesy of it's creator, OpenAI.