Sign in to save

Bookmark this page so you can find it later.

Sign in to save

Bookmark this page so you can find it later.

Chatbots are computer programs that use artificial intelligence to respond to human language. They do not understand words the same way people do, but they can find patterns in huge collections of text. This matters because chatbots are used for studying, searching, coding, customer service, and creative writing.

Learning how they work helps students use them wisely and check their answers carefully.

A modern chatbot turns words into numbers, processes those numbers through a machine learning model, and predicts what text should come next. During training, the model adjusts millions or billions of settings so its predictions better match examples from real text. When a user types a prompt, the chatbot estimates probabilities for possible next words or tokens and chooses a response step by step.

Statistics, computer science, and careful data design all shape how useful and reliable the answer will be.

Key Facts

  • A chatbot breaks text into tokens, which may be words, word parts, punctuation, or symbols.
  • Language models represent tokens as vectors so a computer can compare meanings and patterns using numbers.
  • Training reduces prediction error by adjusting model parameters, often using loss functions such as cross-entropy loss.
  • The model predicts probabilities for possible next tokens, such as P(next token | previous tokens).
  • Higher probability tokens are more likely to be chosen, but settings like temperature can make outputs more predictable or more varied.
  • A chatbot response is generated one token at a time until it reaches an ending point or a maximum length.

Vocabulary

Token
A token is a small piece of text, such as a word, word part, punctuation mark, or symbol, that a language model processes.
Machine Learning
Machine learning is a method where a computer improves at a task by finding patterns in data instead of being given every rule directly.
Neural Network
A neural network is a computing system made of connected layers that transform input numbers into useful predictions.
Probability
Probability is a number from 0 to 1 that describes how likely an event or choice is to happen.
Prompt
A prompt is the text or instruction a user gives to a chatbot to guide its response.

Common Mistakes to Avoid

  • Thinking the chatbot truly understands like a human, which is wrong because it mainly predicts patterns in language using learned statistical relationships.
  • Assuming every chatbot answer is factually correct, which is wrong because a fluent sentence can still contain false information or invented details.
  • Treating the first response as the final answer, which is wrong because prompts can be improved and answers should be checked against reliable sources.
  • Ignoring training data and bias, which is wrong because a model can reflect errors, gaps, or unfair patterns found in the data it learned from.

Practice Questions

  1. 1 A sentence is split into 12 tokens, and a chatbot generates a 48-token reply. How many total tokens are processed if you count the prompt and reply together?
  2. 2 A chatbot assigns next-token probabilities of 0.50 for "the", 0.20 for "a", 0.15 for "this", 0.10 for "that", and 0.05 for "one". What is the total probability, and which token is most likely to be chosen?
  3. 3 Explain why a chatbot can write a confident answer about a science topic but still need human fact-checking.