UD Logo
School of Education

ChatGPT & AI Chatbots

Module 3. How Do AI Chatbots Work?

AI chatbots create a conversation with a user who types messages to which the chatbot generates a response. The quality of the conversation partly depends on the user’s ability to write well formed messages, which are called prompts. Learning how to write effective messages is called prompt engineering.

In responding to a prompt, the AI looks to a database in search of information related to your prompt. This database typically has a huge amount of information upon which the chatbot has been pre-trained. This pre-training is the “P” in GPT. In ChatGPT, the database is huge containing more than 175 billion parameters. This database gets created through Natural Language Processing (NLP) that creates a statistical distribution of word (or token) sequences in the information upon which the chatbot is being pre-trained. This information can be huge, such as the entire Wikipedia or everything at Common Crawl.

The chatbot’s database is a neural network (NN) in which the nodes are connected in a layered structure that resembles the human brain; hence the term, neural networking. This is what enables Machine Learning (ML), whereby computers learn from their mistakes and keep improving. To learn more about neural networking, follow this link to Amazon’s article about networking:

Prior to the release of ChatGPT, which is based on GPT 3.5, previous versions were more prone to generating harmful, false, or biased output. Through a process called Reinforcement Learning from Human Feedback (RLHF), ChatGPT has made substantial progress overcoming these problems. To understand how RLHF works, follow this link to AssemblyAI’s explanation of how ChatGPT works:

In processing your prompt, the chatbot continually works to decide what the next word (or token) should be in its response. You can play with such a tokenizer here:

When the chatbot is not sure about what word to put into its response, the chatbot inserts a mask for a word to be decided later. The more a chatbot works with users, the better it becomes at making these decisions. That is because the chatbot’s human researchers study your interactions (assuming you granted permission for ChatGPT to keep your data) for use in improving the model. The goal is to make the model more helpful, truthful, and harmless.

In generating its response, ChatGPT works far beyond individual words or tokens. All the patterns and relationships ChatGPT learned in its training enables it to generate the next sentences or even paragraphs that could follow. How many patterns does it know? GPT-3's neural network has 175 billion parameters, and GPT-4 has even more. When you input your prompt, ChatGPT uses this neural network’s  values and weightings to output what best matches your request.

Whereas GPT-3 is text based, GPT-4 also processes images. A large language model (LLM) that also processes images or sound or video is called a multimodal large language model (MLLM). Here is an article about a new MLLM from Microsoft:

This is only the beginning of what promises to be an amazing future for generative AI. The final module of this course helps you keep up with emerging AI technology.