The Mission

How do AI chatbots work?

How do AI chatbots work? A plain guide to large language models, tokens and training, why answers vary, and whether AI understands what it says.

Envoy Mission Editorial Team8 min read
On this page6 sections
  1. The short answer
  2. What a large language model is
  3. How it learns to answer you
  4. How it writes a reply, and what it remembers
  5. Does a chatbot understand what it says?
  6. Using a chatbot carefully, for the gospel

You type a question into a chat box, and a moment later an answer appears in clear, friendly sentences. It may thank you for asking, or apologize when you correct it. It’s natural to wonder whether anyone is on the other end.

No person is writing that reply, and nothing magical is going on. What answers you is a large language model, and the way it works is easier to grasp than most people expect. Once you see it, chatbots become less unsettling and easier to use wisely.

The short answer#

An AI chatbot is an app built around a large language model: a computer program trained on an enormous amount of text to do one thing well, which is to predict what comes next.

When you ask it something, it doesn’t look up a prepared answer. It writes a new reply, one small piece at a time. At each step it weighs which piece is likely to come next, given your question and everything written so far, chooses one, and repeats. That is what “generative” AI means: it generates new text rather than retrieving stored answers. Further training teaches it to use that ability to follow instructions and answer helpfully.

What a large language model is#

A language model is a program that has learned how text tends to continue. You do a version of this without thinking. If someone at church begins, “The Lord is my…,” you already know the next word (Psalm 23:1). A language model learns something similar from far more text than any person could read in many lifetimes: books, articles, web pages and more.

It doesn’t actually work in whole words. It breaks text into tokens, which are small chunks. A short, common word may be a single token, while a long or unusual word is split into several pieces. Punctuation is broken into tokens too. So, strictly, a model predicts the next token, not the next word.

Large describes two things: the vast amount of text it was trained on, and the size of the model itself. Inside a large language model are billions of adjustable numbers, called parameters, or weights. In training, the model is shown passage after passage, guesses each next token, and is scored on how far off it was. Then every weight is nudged slightly in the direction that would have made the right tokens more likely. Repeated an enormous number of times, those tiny adjustments add up to a model that predicts very well. (How do neural networks work? explains the numbers and nudges, and How does AI work? gives the bigger picture.)

To predict well across so much writing, a model has to pick up a great deal: grammar, what words mean in different settings, facts that appear often, how arguments are put together and how questions are usually answered. None of this is written into it as rules. It is spread across those billions of weights. There is no stored copy of the training text to consult, though passages the model saw many times can come back nearly word for word.

There is something humbling here. A small child learns to speak from a tiny fraction of the words these systems are trained on, and means what she says. When Moses protested that he was no speaker, the Lord answered, “Who has made man’s mouth?” (Exodus 4:11). Speech is God’s gift, and a language model, for all its ingenuity, is built from the words of people made in his image.

How it learns to answer you#

A model trained only to predict text isn’t yet a helpful assistant. Type a question into one, and it might reply with more questions, as if it were writing a quiz, because that is a likely continuation too.

So it is trained further. People write or select examples of good conversations, with clear questions and helpful, honest answers, and the model is trained on them. Then people compare or rate its answers, and it is adjusted toward the kinds of answers they preferred and away from careless or harmful ones. It is also trained to decline some requests altogether.

This is a big part of why a chatbot responds like a thoughtful person: it has been shaped, with a great deal of human effort, to answer the way people judged a good answer should sound. Its warmth is a learned style, not a sign of feelings.

How it writes a reply, and what it remembers#

When you send a message, the app passes your words, along with the conversation so far, to the model. The model works out, for every token it knows, how likely that token is to come next. One is chosen and added to the reply, and the process runs again with that token included. Token by token the answer is built, until the model signals that it has finished. When an app shows the reply appearing a few words at a time, you are usually watching it being written.

The choice at each step usually isn’t simply the single most likely token. Apps typically pick from among the likely options with a measure of randomness, because always taking the top choice tends to produce flat, repetitive writing. That is why asking the same question twice can bring two different answers: one different choice early on sends the rest of the reply down another path.

A chatbot seems to remember what you said a few messages ago, and in a limited way it does. Each time it replies, it is given the conversation so far. That text is its whole working memory, and there is a limit to how much it can take in at once, called its context window. In a very long conversation, the earliest parts may be trimmed or summarized to fit. Talking to it doesn’t change the model itself; its weights stay the same while you chat. If a chatbot seems to remember you from last week, the app saved notes from earlier conversations and added them in. Apps can also add web search results or passages from documents for the model to draw on.

The app also gives the model written instructions, usually hidden from you and placed ahead of your conversation. These set its tone, describe its purpose, and tell it what to do and avoid. Two chatbots built on the same model can behave quite differently because of them.

Does a chatbot understand what it says?#

A large language model captures patterns of meaning in language extraordinarily well. It can explain a parable, summarize a long letter or translate between languages in ways that look like understanding. It can also stumble on tasks a child finds easy, such as counting the letters in a word, partly because it sees text as tokens rather than letters. Researchers and philosophers disagree about whether what it does should be called understanding, or only resembles it from the outside.

What can be said more confidently is what it lacks. There is no good reason to think today’s chatbots have awareness, beliefs or experiences. When one says it is glad to help or sorry for a mistake, it is producing the kind of sentence people write at such moments. Jesus said the mouth speaks out of what fills the heart (Luke 6:45). A person’s words reveal a heart. A chatbot’s words are not the overflow of a heart. Whether a machine could ever have a soul is a separate question, taken up in Does AI have a soul?

This also explains why a chatbot can be wrong: because it produces likely-sounding text rather than checking facts, it can state something false as smoothly as something true. More on that in Why does AI make things up?

Using a chatbot carefully, for the gospel#

Knowing how chatbots work shows where care has to be built in: in the instructions a model is given, in how honestly it speaks about itself, and in checking what it says. Envoy Mission’s free, gospel-centered AI chat is one example. Envoy gives its AI written instructions grounded in core Christian beliefs. The AI is honest that it is an AI and never claims to believe, feel or have faith. Because any AI can make mistakes, every reply is automatically reviewed against core Christian beliefs, and anything that could mislead is flagged for the team. It meets people searching about Jesus in their own language, day or night, in more than 100 countries, including many where asking about Jesus out loud is costly. It points them to Scripture and encourages them toward believers and a church where that’s safe.

Afghanistan · فارسی

Seeking

Real, anonymized conversation

+ 11 earlier messages

آیا تا به حال درباره عیسی مسیح چیزی شنیده‌ای؟ نه آنچه که دیگران گفته‌اند، بلکه خودت داستان او را خوانده‌ای؟
از زبان مردم در باره عیسی مسیح شنیده ام اما جز از داستان زندگی نامه شان چیزی دیگر نمیدانم
خوب است که صادقانه می‌گویی فقط از زبان دیگران شنیده‌ای. اما عیسی بیش از یک داستان تاریخی است. او ادعا کرد که خود خدا به صورت انسان آمده است. وقتی مردم به او گفتند: «به ما خدا را نشان بده»، عیسی جواب داد: «کسی که مرا دیده است، پدر را دیده است» یوحنا ۱۴:۹. آیا کنجکاوی داری بدانی عیسی چه کرد که نشان می‌دهد خدا تنهایی و درد تو را می‌بیند؟
Openness shift detected
بلی

+ 22 more messages

If you’d like to help open more of these conversations, read how your giving works.

And the next time a chatbot answers you in friendly sentences, you’ll know what is happening: no hidden person and no magic, just a remarkable tool built from human words. Knowing that, you can use it with open eyes, neither fearing it nor trusting it more than it deserves.

Frequently asked questions

What is a large language model in simple terms?

It is a computer program trained on an enormous amount of text to predict what comes next. “Large” refers both to the amount of text it learned from and to the billions of adjustable numbers inside it that hold what it learned.

Does AI understand what it says?

It captures patterns of meaning in language remarkably well, and researchers disagree about whether that counts as understanding. But there is no good reason to think it has awareness, beliefs or experiences, so it doesn’t mean its words the way a person does.

Why does a chatbot give different answers to the same question?

At each step it picks the next piece of its reply from among several likely options, with a measure of randomness. One different choice early on can send the whole reply in a different direction.

Does an AI chatbot remember my past conversations?

The model itself works only with the text the app gives it, usually the current conversation, and chatting with it doesn’t change what it learned in training. If a chatbot seems to remember an earlier conversation, the app has saved notes and added them in.

Keep reading

Give

Fund a conversation

Choose the countries on your heart or the Envoy Managed Fund, and see the journeys your giving makes possible.

More on The Mission
Give now