← All posts
Srikaran Sankar4 min read

How Does AI Actually Work? A Beginner's Guide

The key ideas behind AI in plain language, from how a model learns to how a chatbot writes a reply, one word at a time.

  • AI basics
  • Neural networks
  • LLMs

In my last post, I wrote that AI isn't magic, it's a tool. That naturally leads to the next question: if it isn't magic, then how does it actually work?

You don't need a computer science degree to understand the basics. In this post, I'll walk through the key ideas behind AI in plain language, from how a model learns to how a chatbot writes a reply, one word at a time.

The three ingredients: data, model and computing power

Every modern AI system is built from three things.

  • Data is the raw material. It can be text, images, audio, numbers or code. The more varied and high-quality the data, the more the AI can learn.
  • A model is the structure that does the learning. Think of it as an empty brain with millions or even billions of adjustable settings, called parameters.
  • Computing power is the energy that makes learning possible. Training a large model can take thousands of specialised chips running for weeks.
Datatext · images · codeModelbillions of parametersComputethousands of chipsTrained AI model
Data, a model and computing power: the three ingredients of every AI system.

Put simply: the model learns from the data, and computing power makes that learning happen at scale.

How a model learns: training by trial and error

Training is where the real learning happens, and it works a lot like practising for an exam.

  1. Guess. The model is shown an example, say a photo, and makes a guess: "This is a dog."
  2. Check. The guess is compared with the correct answer: "Actually, it's a cat."
  3. Measure the error. The system calculates how wrong the guess was. This number is called the loss.
  4. Adjust. The model slightly tweaks its parameters so that next time, the guess is a little closer to right.
  5. Repeat. This loop runs millions or billions of times across the whole dataset.
1Guess2Check3Measure loss4Adjust5Repeat× millionseach loop nudges the parameters
The training loop. Each pass makes a tiny correction; millions of passes add up.

No single step teaches the model much. But after enough repetitions, those tiny adjustments add up, and the model becomes surprisingly good at the task. Once training is finished, the parameters are fixed, and the model is ready to be used.

Neural networks, simply explained

Most modern AI models are neural networks, loosely inspired by how neurons in the brain connect to each other.

Imagine a stack of layers. The first layer receives the input, such as the pixels of an image. Each layer passes signals to the next, and every connection has a strength, or weight, that decides how much one signal matters. These weights are the parameters the model adjusts during training.

Each layer learns to notice something slightly more complex than the one before. In an image model, early layers might detect edges and colours, middle layers might recognise shapes like eyes or ears, and later layers might put it all together to say "cat". Nobody programs these steps by hand. The network discovers them on its own during training.

catInputpixelsEarly layersedges & coloursMiddle layerseyes & earsOutput“cat”
Each layer builds on the last: pixels become edges, edges become shapes, shapes become “cat”.

When a network has many layers, we call it deep learning, which is the technology behind most of today's AI breakthroughs.

How AI chatbots write their answers

Chatbots like ChatGPT, Gemini and Claude are powered by large language models (LLMs). Here's what happens behind the scenes, step by step.

  1. Text becomes tokens. Your message is broken into small pieces called tokens. A token might be a whole word, part of a word or a punctuation mark. The model works with numbers, so each token is turned into a numerical form it can process.
  2. The model predicts the next token. During training, an LLM reads enormous amounts of text and learns one core skill: predicting what comes next. Given "The sun rises in the", it learns that "east" is a very likely next word.
  3. It builds the answer one piece at a time. When you ask a question, the model predicts the most suitable next token, adds it to the reply, then predicts the next one, and so on. That's why you often see answers appear word by word.
  4. It pays attention to context. Modern LLMs use a design called the transformer, which lets the model weigh how every word in your message relates to every other word. This "attention" is what helps it keep track of meaning across long sentences and conversations.
  5. It's fine-tuned to be helpful. A model that only predicts text isn't automatically a good assistant. So after the main training, it's refined with examples of good conversations and with feedback from people who rate its answers. This step teaches it to follow instructions, stay on topic and avoid harmful replies.
1 · Your text as tokensThesunrisesinthe?2 · Score every possible next tokeneast82%morning9%sky6%west3%3 · Add it to the reply“…rises in the east” → then predict the next token again
Next-token prediction, one step at a time. Percentages are illustrative.

Why AI still makes mistakes

Once you understand how AI works, its mistakes start to make sense.

  • It predicts; it doesn't look things up. A language model generates what sounds right based on patterns. If it hasn't learned a fact well, it may produce something plausible but false.
  • It only knows its training data. If information was missing, outdated or biased in the data, the model will reflect that.
  • It has no real-world experience. It has read about the world but never lived in it, so common sense can sometimes slip.

This is why many AI tools now connect to web search or trusted documents, so they can ground their answers in real sources. It's also why checking important facts yourself is still a good habit.

Final thoughts

Strip away the buzzwords, and AI comes down to a simple idea: learn patterns from lots of examples, then use those patterns to make predictions. Neural networks, training loops and transformers are just clever ways of doing that at enormous scale.

Understanding this makes you a better AI user. You'll know why it's brilliant at some tasks, why it stumbles on others, and when to trust your own judgement over its answer.

Which part of AI would you like me to explore next: image generators, AI in education, or the ethics of AI? Let me know in the comments below.

Want to talk about this?

Connect on LinkedIn