Careers

How LLMs work: a simple guide for students

What really happens when you ask an AI chatbot a question, explained step by step with everyday examples. No maths needed.

On this page

You type a question into an AI chatbot and a full answer appears in seconds. It feels like magic, but the idea behind it is surprisingly simple. This guide explains how LLMs work in plain words, so you can talk about them confidently in class, in interviews and in your own projects.

If some words here are new, keep our AI terms glossary for beginners open in another tab.

The one skill an LLM has

An LLM (large language model) has one core skill: guessing the next piece of text.

Give it "The capital of France is" and it predicts that "Paris" is very likely to come next. That is all. Everything else, from writing essays to fixing code, is built on top of this one skill, repeated again and again.

Everyday comparison: the word suggestions on your phone keyboard. An LLM is the same idea, trained on far more text and with a much better sense of meaning.

How it learned: reading a huge library

Before you ever use it, the model goes through training. During training it reads a huge amount of text: books, websites, articles and code.

For every sentence, it plays a guessing game:

  1. Hide the next word.
  2. Guess what it is.
  3. Check the real answer.
  4. Adjust itself a tiny bit so the next guess is better.

After billions of rounds of this game, the model has picked up grammar, facts, writing styles and even some reasoning patterns. Nobody wrote these rules by hand; they were learned from examples.

Note

Training costs a lot of money and computing power, so only big companies and research labs do it. As a developer you almost always use a model that someone else trained. Using a model is called inference.

From "next word" to a full answer

A full answer is just next-word guessing in a loop:

your promptguess next pieceadd it to the textrepeat until doneanswer
An LLM writes one small piece at a time.

The model guesses one piece, adds it to the text, then looks at everything again and guesses the next piece. This is why chatbots show the answer appearing word by word: you are watching the loop run.

Why it seems to "understand"

To guess the next word well, a model has to notice a lot. To finish "She put the ice cream in the freezer because it was ___", it needs to know that ice cream melts. So while learning to predict text, the model also learns a lot about the world.

But it does not know things the way you do. It has no memory of where a fact came from, and it does not check a source before answering. That is why it can sound confident and still be wrong. Our post on why AI makes things up explains this in detail.

From raw model to helpful assistant

A model that only predicts text from the internet is not a good assistant yet. Ask it a question and it might reply with more questions, because that is common on the web.

So companies add a second stage of training. People write examples of good answers and rate the model's replies, and the model is tuned to be helpful, follow instructions and refuse harmful requests. This is the step that turns a text predictor into a chat assistant.

What this means for you

Knowing how an LLM works helps you use it better:

  • Be specific. The model continues from what you give it. A clear prompt leads to a clear answer. See six habits for better prompts.
  • Check important facts. It predicts likely text, not verified truth.
  • Give it the material. If you need answers about your notes or documents, paste them in, or use RAG to do it automatically.

Quick recap

IdeaIn one line
LLMA model that predicts the next piece of text
TrainingLearning patterns from a huge amount of text
InferenceUsing the trained model to get answers
AnswerMany next-word guesses in a row
Chat tuningExtra training so it follows instructions and helps

Rahul Agarwal

Instructor, SkillByAI

Web developer for 15 years. Teaches developers and founders to build real products with open-source AI tools.

Get the next tutorial by email

One email when a new post lands, with the code ready to run. No spam.

By subscribing you agree to receive emails from SkillByAI. Unsubscribe anytime.