That Neuroscience Guy - The Neuroscience of ChatGPT
Episode Date: June 17, 2024ChatGPT is an artificial intelligence assistant that is growing in popularity in daily life. It can generate answers to your questions faster than anyone could've previously imagined, but is it actual...ly thinking about those questions? In today's episode of That Neuroscience Guy, we discuss the neuroscience of ChatGPT and similar AI models.
Transcript
Discussion (0)
Hi, my name is Olof Kregolsen, and I'm a neuroscientist at the University of Victoria.
In my spare time, I'm that neuroscience guy.
Welcome to the podcast, and welcome back.
Matt and I have taken a fairly long period of time off, almost two months, but we haven't given up.
We're going to keep going, so don't worry about that.
We're going to record a 10-episode summer season, and we're going to start playing those right away, middle of June to the middle of August.
Then we're going to take a quick break, and then we'll be back for a longer season in September.
So sorry for the long break, but we both needed it and we were both away traveling
and doing stuff. But anyway, let's get on with it. So you've probably heard about ChatGPT or any of
the other versions of AI like this, and you might've been curious. You might have even been scared. But a question that actually came in to us was,
does ChatGPT really think?
So on today's podcast, the neuroscience of ChatGPT.
So the simple answer is no.
ChatGPT doesn't truly think.
Or does it? I'm going to start with no, but maybe by the end of
this, I'll have convinced you that either we as humans don't think, or that chat GPT does think.
So it starts with a database. All of these AI things need data to do what they do.
And this is actually not that hard to acquire.
You basically could write a computer program to pull information off the internet or any other, you know, any online source and just store it.
So imagine you were just trying to learn, you know, the capitals of all the countries in the world.
Well, this is something you can easily pull off of the internet.
You can pull off the logic behind math. You can pull off how grammar works and how languages work. And you can pull off multiple languages. So the start of these AI programs
is mining the internet for data. Now, it doesn't have to store all of it on the local computer.
It just needs to know where it is, right?
To put everything on one computer would require quite a bit of memory
and quite a big hard drive.
But it needs to learn.
And it learns first by just reading.
And if you think of how humans learn, this is how we start.
When we're born, we're basically just interacting with the world and pulling in information.
We're looking at things, we're hearing things, we're tasting things, we're smelling things,
we're touching things, and we're getting information into our brain about the world.
And as we learn language, for instance, then we start listening to stories and we learn
about the world and our
parents teach us or our teachers teach us and information just keeps coming in. And that's
kind of what ChatGPT is doing in this initial phase. It's just learning about the world. It's
pulling in all of the information it can and storing it, or as I said earlier, indexing it so it knows where that
information is. Okay, so that's the database. A key part of this is to realize that it never
stops doing this. All right, it's not like you do it one time and you say, well, hey, that's all
I've learned. Think about the human experience. You know, we never stop learning throughout our lifespans.
We're constantly pulling in new information.
Or we see something that we know, and we go, okay, that's a Ford.
Or that's a piece of pizza.
Or that's my friend Joe.
But if we go somewhere new, so this summer I'm going to spend some time in Italy.
I've never been, other than a brief trip to Venice a long time ago. I'm going to spend some time in Italy. I've never been other than a brief trip to Venice a long time ago.
I'm going to be learning.
I'm going to be learning about the food, the culture, what it looks like.
And you're always learning.
And so are these AI things like chat GPT.
They're always learning, just like we as humans are.
They're bringing in new information all the time.
Now, that's one form of learning.
All right, we call that observational learning,
where we just see the world and we just extract information from it.
But what makes AI truly tick is it uses another kind of learning.
Because you might have asked it, for instance,
how do you write a paragraph?
Or to write a paragraph, better yet,
you know, write a paragraph about Napoleon Bonaparte. And ChatGPT will give you a paragraph
about Napoleon Bonaparte. And if you change the prompt a little bit and you ask it, it will give
you another paragraph that looks different. This is, of course, why college professors like myself
were initially scared because the fear was that students would use chat GPT and other forms of AI to write essays.
Well, it turns out that that's not as bad a problem as we thought it was going to be,
and I'll give you more on that at the end. But how does it know to write that paragraph that way?
Because it's not direct plagiarism. All right. It's not just taking
a paragraph on Napoleon that found on Wikipedia and sticking it in front of you. Now, sometimes
it does do things like that, but it can write what we would call a unique paragraph. So how does chat
GPT or other AI forms, I'm just using this one as an example, learn to do this. Well, we've actually
talked about this before, but just to refresh your minds, it uses something that we call reinforcement learning.
Now, the way reinforcement learning works is very simple. It tries something out.
All right, so say it puts together a sentence, and if the sentence is correct,
it basically rewards itself, And it says, okay,
the way I've done this is good. All right. I've got the words in the right order. And this is the
same as what humans do. All right. If a human does this, a young child tries a sentence and we go,
yay, you did it. Because the kid said, I don't know, the dog ate the dog food. All right. And
we go, yay. And that reinforces that sentence structure. But if the kid says food ate the dog
food, then we go, oh, that's a little bit wrong. And that's a punishment. Now I'm not going to
review everything we talked about with humans, but you might remember that ties into the midbrain dopamine system and the strengthening of neural connections.
Well, obviously, computers don't have dopamine, but you simulate that.
When ChatGPT gets something right, it rewards itself, and it just basically makes a little notation that says, this combination worked.
And then it tries something that doesn't work. It punishes
itself. All right. And this is similar to how like computers learn to play chess. All right.
When a computer learns to play chess, if you build the AI right, it just plays itself over and over
and over and over again. And when it wins games, it basically rewards itself. And when it loses
games, it punishes itself. And it loses games, it punishes itself
and in that way, it figures out what are good moves
and what are bad moves.
And I mentioned this in the past,
but the famous example of this
is something called TD Gammon.
Someone programmed a computer
to learn how to play backgammon
and if you haven't played backgammon,
I'm not gonna go through all the rules,
but it's a game, you roll some dice,
you move some pieces, it's reasonably game. You roll some dice. You move some pieces.
It's reasonably complicated.
And what Andy Tazaro did is he just had it play itself over and over and over and over again.
And it just used this basic reinforcement learning principle of if it works and I did it right,
I'm going to reward myself.
And if I did it wrong, then I'm going to reward myself and if I did it wrong then I'm going to punish myself and in computer
terms it just basically means like I said an annotation that this is a good move so in the
case of td gammon if it makes a good move it rewards itself and in the case of a bad move
it punishes itself which is that annotation that I talked about and if it plays itself enough times
it gains experience. Well,
this is what ChatGPT does. It tries things. Whenever it gives you a solution, it's tried
these solutions many, many, many times. And if it gets it right, then it rewards itself in that
pattern. So in that way, it learns mathematical structure. It learns programming languages.
It learns English grammatical structure. It learns geography.
It learns whatever you want it to learn. And it works, almost. You might have noticed that
sometimes ChatGPT does goof things up, and that's because it's not perfect. It's always learning.
Now, it is going to get smarter and smarter and smarter. I'm assuming that the companies behind these AI programs didn't show us the true version one, the beta version,
because my guess is that would have made a lot of mistakes. And at some point it got to a point
where the accuracy was high enough that they said, all right, we can release AI on the world.
But I want you to see the parallel because this is how humans learn through trial and error. And
that's essentially what the AI does.
And if you have one of those vacuum cleaners at home that learns how to vacuum your living room and it's an intelligent one, this is how it learns as well.
Computers can learn through trial and error.
Now, one big question is, what about it being unique?
It seems like that every time it tries something,
it gives you something different. Well, the reason it seems unique is it's got this massive database
that I talked about, and it's just combining things in new and different patterns, all right?
So it doesn't have to use the same example over and over again. It can try new combinations of words.
And we all know this.
Some of us use a thesaurus on a regular basis just to look for similar words.
Well, imagine that concept.
What ChatGPT is doing is using a thesaurus basically for every word or every idea.
It's looking for things it can swap out.
And it does just randomly.
All right.
If it can swap something out, if you ask it what the capital of Canada is,
it says Ottawa every time because it can't swap it out.
All right.
So that's how it seems unique is it's just got this massive database
and it's trying all these combinations.
And this is where it gets a little bit interesting
because are we as humans unique?
What happens in our brain when we have an original idea?
Is it really original?
I would argue from a neuroscience perspective that it's not.
It's just a unique combination of everything you know already.
You're pulling up ideas and things you've heard about, things you might have even forgot about,
and you're combining them together into what you think is a unique pattern. And that's what we call originality or uniqueness.
But the reality is, if we had no experience with the world, we had nothing that we could do. We
had no knowledge. We couldn't do anything unique. All right? And the fact that we've heard so many
songs and seen so many movies and talked to so
many people and read so many books allows us all of this information that we can pull together
and put into a new pattern that is a unique pattern. But the reality is it's based on our
database within our brain. And that's what ChatGPT is doing. It's combining things from its database into a unique pattern. So in principle,
what ChatGPT is doing when it writes a paragraph is no different than what we as humans do.
It's just got this advantage that its memory doesn't fail the way ours does. It can literally
access everything that it's encountered before, where for most of us, we tend to forget
or lose our ability to access a lot of previous information. So that is how ChatGPT works and the
neuroscience behind it. As an addendum, a lot of people have sort of said, is this going to put
professors out of business? Is this what people are going to use for everything? And right now, with the current state, I'd say no. It's pretty obvious when a student
uses ChatGPT to write an essay. The reality is, if the professor knows the material really well,
ChatGPT makes enough mistakes and says things a little bit wrong in enough instances that you can spot it.
Now, for simple tasks, it's always accurate.
It's when you get to these more challenging things,
like writing an entire essay,
where it's going to make enough small mistakes that you can sort of see through it.
And funnily enough, people are now using AI to detect AI.
So you can actually get programs that analyze, say, written content to see if it
was generated by AI. So the AI is checking the AI. Anyway, I thought people might find that
interesting, the neuroscience of ChatGPT and how it really works. And is it really thinking? I guess
I have to leave you with a sort of. It's doing something very similar to what we do as humans.
Okay, the website is still there, thatneuroscienceguy.com.
There's links to Patreon where you can support graduate students in my lab
and specifically Matt by making donations.
For those of you that have made the donations, thank you so much.
I know that Matt appreciates it.
There's also links to
our Etsy store. We've done a horrible job of putting up new merch. And to be honest, if anyone
wants to design merch, please email us thatneuroscienceguy at gmail.com. On that note,
if you have ideas for upcoming episodes, we do really want to know what you want to know
about the neuroscience of daily life. So you can get me on threads or X at that neuroscience guy, or you can email us that neuroscience guy at gmail.com.
And finally, the podcast. Sorry, we took so long off. We were both a bit burnt out and needed a
break. Not from the podcast, just from daily life and work as neuroscientists. But we're back for a
10 episode summer season,
a short break, and then back in September to parallel the academic year for us.
Please subscribe if you haven't already. It means a lot, and thank you so much for listening.
My name is Olive Kregolson, and I'm that neuroscience guy.
I'll see you soon for another episode of the podcast.