The big picture
Classic software is a list of instructions written by people: if this happens, do that. AI turns this around. Instead of writing the rules, engineers show a system many examples and let a learning algorithm discover the rules on its own.
Almost every AI system you use today follows the same pipeline.
| Stage | What happens | Example: a chat assistant |
|---|---|---|
| Data | Collect and clean examples. | Large amounts of text, code and conversations. |
| Model | Choose an architecture with adjustable parameters. | A Transformer neural network with billions of parameters. |
| Training | Adjust parameters to reduce errors. | Predict the next token, then refine with human and AI feedback. |
| Evaluation | Test on data the model has not seen. | Benchmarks, safety tests and human review. |
| Inference | Use the model on new input. | Answer your message in seconds. |
Step 1: Data
Data is the raw material of AI. A model can only learn patterns that are present in its training data, so the quality, variety and fairness of that data shape everything that follows.
- Structured data: tables such as transactions, sensor readings or medical records.
- Unstructured data: text, images, audio and video, which make up most of the world's information.
- Labeled data: examples with the correct answer attached, such as photos tagged "cat" or "dog".
- Synthetic data: examples generated by other AI models, now widely used to train and fine-tune new models.
Before training, data is cleaned, deduplicated, filtered for harmful or low-quality content and converted into numbers the model can process. For text, this means splitting it into tokens, which are words or pieces of words.
Step 2: Learning methods
Machine learning offers several ways to learn from data. Modern systems often combine them.
Supervised learning
Learns from labeled examples. Used for spam detection, medical image classification and price prediction.
Unsupervised learning
Finds structure in unlabeled data, such as customer segments or unusual transactions.
Self-supervised learning
Creates its own labels from raw data, for example by hiding a word and predicting it. This is how LLMs are pre-trained.
Reinforcement learning
Learns by trial and error from rewards. Used in game-playing AI, robotics and to train reasoning models.
Step 3: Neural networks
Most modern AI uses artificial neural networks. A network is made of layers of small units (neurons). Each unit multiplies its inputs by weights, adds them up and passes the result through a simple non-linear function to the next layer.
- The input layer receives numbers that represent the data, such as pixel values or token embeddings.
- Hidden layers transform those numbers step by step into more abstract features, such as edges, shapes and objects in an image.
- The output layer produces the result, such as a probability for each possible next word.
Deep learning simply means networks with many layers. Different architectures suit different data: convolutional networks for images, recurrent networks for older speech systems, diffusion models for image generation and Transformers for language and, increasingly, almost everything else.
Step 4: Training
Training is an optimization loop that repeats billions of times.
- Forward pass: the model makes a prediction for a batch of examples.
- Loss: a loss function measures how wrong the prediction was.
- Backpropagation: the algorithm calculates how much each weight contributed to the error.
- Gradient descent: every weight is nudged slightly in the direction that reduces the error.
Frontier language models are trained on enormous datasets using thousands of specialized chips (GPUs or TPUs) for weeks or months. Public estimates put the cost of training the largest models in the tens or hundreds of millions of dollars, which is why only a handful of companies build them from scratch.
A common failure is overfitting: the model memorizes the training examples instead of learning general patterns. Engineers detect it by testing on separate validation data and prevent it with more data, regularization and early stopping.
Step 5: Inference
Inference is what happens when you actually use AI. The trained weights are frozen, and your input flows through the network once (or, for text generation, once per generated token) to produce an output.
Inference is much cheaper than training, but at the scale of hundreds of millions of users it still requires large data centers. Providers therefore offer several model sizes: small, fast models for simple tasks and larger or reasoning models for hard problems.
How large language models work
Large language models (LLMs) such as OpenAI GPT, Anthropic Claude, Google Gemini and open-weight models like Llama, Mistral, Qwen or DeepSeek are built in several stages.
Tokens and embeddings
Text is split into tokens, and each token is mapped to an embedding: a long list of numbers that captures its meaning. Words with similar meanings end up with similar embeddings.
The Transformer and attention
The Transformer architecture, introduced in 2017, uses a mechanism called attention. For every token, attention decides which other tokens in the context matter most. This lets the model connect a pronoun to the right noun or a question to the relevant part of a long document.
Pre-training
The model reads huge amounts of text and learns to predict the next token. To do this well, it has to absorb grammar, facts, styles of reasoning and coding patterns.
Post-training
A raw pre-trained model only continues text. Instruction tuning, reinforcement learning from human feedback (RLHF) and similar methods teach it to follow instructions, hold a conversation, refuse harmful requests and admit uncertainty.
Context and tools
At inference time, the model sees a context window containing your conversation, instructions and sometimes retrieved documents. Retrieval-augmented generation (RAG) and web search give the model up-to-date facts it did not learn during training.
Reasoning models and AI agents
Since 2024, two developments have changed how advanced AI works in practice.
Reasoning models are trained, often with reinforcement learning, to think through a problem in intermediate steps before giving a final answer. Spending more computation at answer time tends to improve results on math, science, coding and planning tasks. Most major providers now offer reasoning or "thinking" modes.
AI agents wrap a model in a loop: plan, act with a tool, observe the result, and plan again. Tools can include web browsing, code execution, file editing or other software. Agents can complete multi-step tasks, but they still need clear goals, permissions and human review.
Multi-agent systems go one step further and let several AI roles collaborate or argue with each other. Research on "AI debate" suggests that having models critique each other can surface errors a single model would miss.
What this means for everyday use
Knowing how AI works leads to better habits.
- Give context. The model only knows what is in its training data and in your prompt.
- Ask for reasoning and sources for important facts, then verify them.
- Use a reasoning model for complex problems and a fast model for quick drafts.
- Compare perspectives. Different models, trained on different data, can reach different conclusions.
Debatly makes the last point easy: several AI personas debate your question and an AI judge summarizes who argued best and why. You can also chat directly with the latest models from OpenAI, Anthropic and Google in the same app.