Skip to content

How AI Works: A Complete Guide From Beginner to Master

A six-level learning path: what AI is, how models learn, how chatbots generate answers, why AI is accurate and why it still makes mistakes, what makes AI run, and the master-level ideas behind today's models.

11 min read

How AI works: learning path from beginner to master

Key takeaways

  • Modern AI is pattern learning at enormous scale: a model adjusts billions of numbers (weights) until it gets good at predicting data, such as the next word of a sentence.
  • A chatbot writes one token (word piece) at a time, each chosen from probabilities. It predicts what is likely, not what is checked to be true.
  • That is why AI is often accurate but can still hallucinate: it fills gaps with plausible guesses, especially on rare facts, recent events, exact numbers and letter counting.
  • AI runs on data, algorithms, compute, memory, networking, energy and software. GPUs with Tensor Cores do the math; VRAM and HBM feed them the weights.
  • This guide goes from Level 1 (no background) to Level 6 (scaling laws, reasoning models, quantization and alignment), with a hands-on project for each level.

How to use this guide

Each level builds on the one before it. Read in order if you are new, or jump to your level. Every level ends with a short project so you learn by doing, not just reading.

LevelYou will learnYou need
1. BeginnerWhat AI, machine learning and generative AI areNothing
2. ExplorerHow a model learns from dataLevel 1
3. UserHow chatbots like ChatGPT, Claude and Gemini produce answersLevel 2
4. Critical userWhy AI is accurate, why it makes mistakes and how to get better answersLevel 3
5. BuilderWhat hardware and software make AI runLevel 3
6. MasterScaling laws, mixture of experts, reasoning models, quantization and alignmentLevels 1–5

Level 1: What AI actually is

Artificial intelligence (AI) is software that does tasks we used to think needed human intelligence: recognising speech, translating, answering questions, spotting tumours in scans or writing code. The terms nest inside each other:

  • AI is the whole field, including old rule-based systems where people wrote every rule by hand.
  • Machine learning is AI that learns rules from examples instead of being told them.
  • Deep learning is machine learning with large neural networks: many layers of simple maths units stacked together.
  • Generative AI is deep learning that creates new text, images, audio, video or code. Large language models (LLMs) are the text kind.

Every AI system today is narrow in an important sense: it can be superhuman at some things, like chess or protein folding, and surprisingly weak at others. A system that matches people across almost every thinking task would be artificial general intelligence (AGI), and one that far exceeds us would be superintelligence. Neither exists yet.

Try it: ask a chatbot the same question three times. Notice the answers differ in wording. You will learn why in Level 3.

Level 2: How a model learns

A neural network is a very large function: numbers go in, numbers come out. What it does is set by its parameters, also called weights. A small model has a few billion; frontier models have hundreds of billions or more.

Training works like this:

  1. Show an example. For a language model, a piece of text with the next word hidden.
  2. Make a guess. The model outputs a probability for every possible next word.
  3. Measure the error. A number called the loss says how wrong the guess was.
  4. Nudge the weights. An algorithm called gradient descent works out which direction to move each weight to make that error a little smaller, and moves them.
  5. Repeat trillions of times over a huge dataset.

Nobody programs grammar, facts or reasoning into the model. They emerge because they help predict the next word. To predict how a sentence about physics ends, it helps to have absorbed some physics.

Training (learning the weights) happens once and is enormously expensive. Inference (using the finished weights to answer you) happens every time you send a message. Read how much it costs to train an LLM for real numbers.

Try it: explain to a friend why a model trained only to predict the next word can still answer questions. If you can, you have Level 2.

Level 3: How a chatbot writes an answer

When you send a prompt, a language model goes through the same steps for every word piece it writes. Our homepage shows them as a diagram: see how AI works visually.

  1. Tokenize. Your text is split into tokens, common word pieces. "Tensor Cores" might be three tokens.
  2. Embed. Each token becomes a list of thousands of numbers that captures its meaning.
  3. Transform. The numbers pass through dozens of transformer layers. In each, an attention step lets every token look at the others to understand context ("bank" near "river" vs near "loan"), then a feed-forward step multiplies by learned weights.
  4. Predict. The model outputs a probability for every token in its vocabulary.
  5. Sample. One token is picked. A setting called temperature controls how adventurous the pick is, which is why the same question can get different wording.
  6. Repeat. The new token is added to the text and the whole process runs again until the answer is complete.

The text the model can see at once is its context window, from tens of thousands to over a million tokens in current models. Anything outside it is invisible to the model.

From text predictor to helpful assistant

A raw model trained on internet text is good at continuing documents, not at helping. Three more stages turn it into an assistant:

  • Pre-training: next-token prediction on trillions of tokens of text and code. This is where knowledge comes from.
  • Instruction tuning: training on examples of questions and good answers so it follows requests.
  • Reinforcement learning from feedback: people or other models rate answers, and the model is trained toward the preferred ones. This shapes helpfulness, tone and safety.

Many assistants can also use tools: web search, a code interpreter or your documents. Pulling in documents to answer from is called retrieval-augmented generation (RAG), and it is one of the best ways to improve accuracy.

Try it: paste a long article into a chatbot and ask questions about it. Then ask the same questions without the article. Compare the accuracy.

Level 4: Why AI is accurate, and why it makes mistakes

Why it is so often right

  • Scale: models have seen more text than any person could read in thousands of lifetimes, so common facts and patterns are learned many times over.
  • Compression into understanding: to predict text well, the model builds internal representations of concepts, not just memorised phrases, so it can handle questions it has never seen.
  • Feedback training: answers people rated as correct and helpful are reinforced.
  • Reasoning models: newer models are trained to work through problems step by step before answering, which raises accuracy on maths, code and logic.
  • Tools: search, calculators and code execution replace guessing with checking.

Why it still makes mistakes

The core reason is simple: a language model predicts plausible text, and plausible is not the same as true. It has no built-in database of verified facts. When it knows something well, the most plausible answer is the correct one. When it does not, it still produces the most plausible-sounding answer, confidently. That is a hallucination.

OpenAI researchers argued in 2025 that training and testing make this worse: most benchmarks score "I don't know" the same as a wrong answer, so models learn that guessing pays, much like students on a multiple-choice exam.

MistakeWhy it happensHow to reduce it
Made-up facts, quotes or sourcesRare facts were seen too few times to learn; the model fills the gap with something plausibleAsk for sources and open them; use search or give it the document
Out-of-date answersKnowledge stops at the training cutoff dateTurn on web search for anything recent
Wrong letter counts or spelling tasksThe model sees tokens, not individual lettersAsk it to spell the word out first, or use code
Arithmetic slipsIt predicts digits as text rather than calculatingAsk it to use a calculator or code tool
Missing details in long inputsAttention can favour the start and end of a long contextPut key instructions at the end; split very long tasks
Agreeing with a wrong premiseFeedback training can reward pleasing answers (sycophancy)Ask neutral questions; ask it to argue the other side
Answering a different questionThe prompt was ambiguousGive context, the goal and an example of what you want
Biased or one-sided outputPatterns in the training dataAsk for multiple perspectives and check sources

How to get more accurate answers

  1. Give context: who you are, what you need and what you already know.
  2. Paste the source material instead of relying on the model's memory.
  3. Turn on search for anything recent, numerical or niche.
  4. Ask it to say when it is unsure, and to list its assumptions.
  5. Check every number, name, quote and link that matters before you use it.

Try it: ask a chatbot without search for a niche fact you know well, like a local history detail. Then turn search on and compare.

Level 5: What makes AI run

Behind every answer is a full technology stack. Our homepage diagrams show how the CPU, RAM, VRAM and GPU work together and how an AI factory is set up.

  • Data: trillions of tokens of text, code, images and video, cleaned and filtered. Data quality matters as much as quantity.
  • Algorithms: the transformer architecture, published in 2017, plus training recipes refined since.
  • Compute: GPUs and other accelerators do the matrix maths. Tensor Cores are units built just for it, and lower-precision formats like FP8 and FP4 make them faster.
  • Memory: the weights must sit in fast memory. Graphics cards use VRAM; data-center chips use HBM. When generating text, speed is mostly limited by memory bandwidth (see our benchmarks).
  • Networking: training spreads across thousands of GPUs joined by NVLink, InfiniBand or Ethernet.
  • Energy and cooling: the International Energy Agency estimates data centres used about 415 TWh of electricity in 2024, around 1.5% of the world's total, with AI the fastest-growing part.
  • Software: CUDA and similar platforms, frameworks like PyTorch, and inference engines such as vLLM and llama.cpp.
  • People: researchers, engineers, data labellers and safety teams.

You can run smaller models on your own computer. The VRAM calculator shows which models fit your GPU, and best GPU for local LLMs helps you choose hardware.

Try it: install Ollama or LM Studio and run a small model such as Llama 3.2 3B or Qwen3 4B on your own computer. Watch how speed changes with model size.

Level 6: Master-level concepts

Scaling laws

In 2020, researchers showed that loss falls predictably as you scale up parameters, data and compute together. In 2022 DeepMind's Chinchilla study found many models were undertrained and that roughly 20 training tokens per parameter was compute-optimal. These laws are why labs spend billions on bigger clusters.

Mixture of experts (MoE)

Instead of using every weight for every token, an MoE model routes each token to a few specialist sub-networks. DeepSeek-V3 has 671 billion parameters but activates about 37 billion per token, giving big-model knowledge at a fraction of the compute.

Reasoning and test-time compute

Reasoning models are trained with reinforcement learning to think through problems before answering. Spending more compute at answer time, not just training time, became a second scaling axis. See prefill vs decode for what this means for hardware.

Efficient inference

Quantization stores weights in fewer bits. The KV cache avoids recomputing past tokens. FlashAttention makes attention memory-efficient. Distillation trains a small model to copy a large one.

Evaluation

Benchmarks measure knowledge, coding, maths and agent tasks, but they saturate fast and can leak into training data. Serious teams build their own tests on real tasks.

Alignment and interpretability

Alignment is making models reliably do what people intend and refuse what is harmful. Interpretability studies what is happening inside the network, so we can check behaviour rather than just observe it. Both become more important as models become more capable, which is the subject of our guide to superintelligence.

Try it: train a tiny GPT from scratch with Andrej Karpathy's nanoGPT on a free cloud GPU, then fine-tune a small open model with LoRA on your own data.

Your learning path at a glance

LevelProjectYou have mastered it when you can…
1Compare three chatbots on the same tasksExplain AI vs machine learning vs generative AI
2Watch a model train in a free online notebookExplain weights, loss and training vs inference
3Test answers with and without a pasted documentDescribe tokens, attention and sampling
4Catch a chatbot hallucinating, then fix it with sourcesPredict when AI is likely to be wrong
5Run a model locally and measure tokens per secondPick hardware for a given model
6Train nanoGPT and fine-tune with LoRARead a model card and paper and explain the trade-offs

Frequently asked questions

Does AI understand what it says?

It builds internal representations of concepts that let it reason about new problems, but it has no senses, lived experience or built-in way to check facts. Whether that counts as understanding is still debated.

Why does AI give different answers to the same question?

Each token is sampled from probabilities, so wording and sometimes content vary. Lower temperature makes answers more consistent.

Can AI hallucinations be eliminated?

Not completely with today's methods, but they can be reduced a lot with search, retrieval from trusted documents, tools and training that rewards admitting uncertainty.

Do I need a powerful computer to use AI?

No. Cloud chatbots run on the provider's GPUs. You only need a good GPU to run models locally.

How long does it take to go from beginner to master?

Levels 1 to 4 take days of regular use. Levels 5 and 6 take months of hands-on practice, plus some Python and basic linear algebra.

Sources and further reading

Think you understand it now? Prove it.

Solve real Tensor Core math in the TensorCore.si Challenge and earn a certificate with your name.

Take the challenge

Leave a Reply

Your email address will not be published. Required fields are marked *