Foundations of AI / Chapter 1
22 min

Understanding Artificial Intelligence

Artificial intelligence is the broad name for computer systems that perform tasks we usually associate with human thinking: recognizing patterns, understanding language, making predictions, generating media, and helping people make decisions. The phrase covers a lot of ground, and that breadth is exactly why "AI" can feel confusing. The goal of this chapter is to replace that vague feeling with a clear mental model you can carry into every later chapter.

The most useful first move is to stop treating AI as a single product and start treating it as a way of building software. Once you can see that pattern, every AI system you meet, from a photo app to a chatbot, becomes easier to reason about.

Example

Think about an ordinary day. Your phone unlocks when it sees your face. A maps app reroutes you around traffic it predicted. A streaming service lines up a show you did not search for. An email client quietly drops a scam message into spam. Later, you ask a chatbot to explain a topic and it writes a fluent paragraph in seconds.

These feel like five different kinds of magic, but they share one shape. Each takes some input, compares it against patterns it learned from large amounts of past data, and produces an output: a match, a prediction, a recommendation, a decision, or a piece of generated text. Spotting that shared shape is the first real skill in understanding AI.

Concept

Artificial intelligence is a family of techniques for getting software to do jobs that normally demand human judgment, and its defining trait is that the behavior is learned from data rather than spelled out by a programmer. Underneath the variety, almost every system reduces to one of a few core tasks: sorting things into categories, predicting what comes next, generating new content, or weighing options to support a decision. This matters because it turns an intimidating, ever-growing landscape of tools into something you can size up with a single question, what is this system trying to classify, predict, generate, or decide, and judge accordingly.

How AI Differs From Ordinary Software

To see what makes AI distinctive, compare it to the software you already trust. A calculator is built from exact rules. Press 2 + 2 and it returns 4 every single time, because a programmer wrote an instruction for that exact case. This is the model most traditional software follows: a human anticipates the situations, writes explicit rules, and the computer obeys them precisely.

Many AI systems work in a fundamentally different way. Instead of being handed the rules, they are shown many examples and left to discover the patterns themselves. A spam filter is not told "any message containing this exact phrase is spam." It is shown thousands of messages already labeled spam or not-spam, and it learns the statistical fingerprints that tend to separate the two. Faced with a brand-new message, it estimates a probability rather than looking up a fixed answer.

Example How Google Translate Got Fluent

For years, machine translation was built from hand-written grammar rules, and the results were famously clunky. Google Translate improved dramatically when it switched to learning from millions of documents that humans had already translated, letting the system discover for itself how phrases in one language tend to map onto phrases in another. Nobody wrote a rule for any particular sentence; the fluency came from the examples.

That single difference explains both the strength and the weakness of AI. Because it works with patterns and probabilities, it can handle messy, open-ended situations that nobody could write rules for in advance, like recognizing a face in poor lighting or summarizing an article it has never seen. But because its answers are estimates, it can also be confidently wrong. It does not "understand" the world the way you do; it produces what its learned patterns suggest is likely.

Advanced From patterns to parameters

The basic idea that "AI learns patterns" has a more precise meaning worth knowing. A model rarely stores the examples it saw during training. Instead, it stores a large set of internal numbers called parameters. During training, the system repeatedly makes a prediction, measures how far off it was, and nudges those parameters in the direction that would have reduced the error. Repeat this across enormous amounts of data and the parameters end up encoding general patterns rather than specific memorized cases.

This is also why the same system behaves in two distinct modes. Training is the expensive, one-time-ish process that sets the parameters and produces the model. Inference is what happens every time you use it: the parameters are frozen, your input flows through them, and an output comes out. Almost everything an everyday user does, from chatting to generating an image, is inference. Keeping training and inference separate in your mind will make the next several chapters click into place, because most AI vocabulary is really describing one phase or the other.

Where You Already Meet AI

Once you know what to look for, AI stops being something locked away in research labs and starts appearing everywhere in normal digital life. Search engines rank results, translation tools cross languages, photo apps find every picture of your dog, voice assistants turn speech into commands, games adapt to your skill, and recommendation systems shape much of what you read and watch.

The point of noticing this is not to be impressed. It is to stay grounded. AI is already woven into ordinary tools, which means understanding it is less about science fiction and more about everyday literacy: knowing, in each case, what the system is predicting or deciding on your behalf.

Example The Keyboard That Predicts You

The next-word suggestions above your phone's keyboard are one of the quietest AI systems you use. Every time you type, a small model predicts which word you are most likely to want next, drawing on patterns learned from vast amounts of text as well as your own habits. You accept or ignore its guesses all day long without ever thinking of it as artificial intelligence, which is exactly how most AI shows up in ordinary life.

Advanced Why AI feels invisible: the feedback loop

The reason AI fades into the background of daily tools is that many of these systems quietly learn from you while you use them. Each time you accept a suggested word, skip a recommended show, or correct a misheard command, you generate a tiny labeled example that feeds back into refining the model, a pattern sometimes called a human-in-the-loop feedback loop. This is why a recommendation feed seems to "know" you better over weeks, and it also explains a subtle risk: because the system optimizes for the behavior it can measure, such as clicks or watch time, it can drift toward what keeps you engaged rather than what genuinely serves you.

What AI Can and Cannot Do Well

Building on that, it helps to be concrete about strengths and limits, because the two are tightly linked. AI is excellent at working through huge amounts of information quickly, surfacing patterns a person would miss, and producing fast first drafts, examples, and alternatives. It is genuinely good at helping you start when a blank page feels intimidating.

What it cannot do is guarantee truth. A model does not automatically know your goals, your context, the rules of your assignment, or the real-world consequences of being wrong. It can repeat biases hidden in its training data, invent details that sound plausible, and express all of it in confident, polished language. The fluency is the trap: a smooth answer is not the same as a correct one.

Example The Court Cases That Never Existed

In a widely reported incident, lawyers filed a legal brief that cited several court decisions supplied by a chatbot, complete with convincing names, quotes, and citations. The cases turned out not to exist; the model had generated what its patterns suggested a brief should contain, not what the legal record actually held. The story has since become the standard cautionary tale about trusting polished output without checking it.

This is why the human stays in the loop. AI changes how we learn, work, create, and communicate, but it adds a new responsibility rather than removing one. The skill that matters is knowing when to trust an output, when to verify it, and when not to use AI at all. The diagram below contrasts the two ways of building software and shows where your judgment fits.

flowchart TB
  subgraph TRAD[Traditional software]
    direction LR
    TI[Input] --> TR[Fixed rules written by a programmer]
    TR --> TO[Same exact output every time]
  end
  subgraph AISYS[AI system]
    direction LR
    AI1[Input] --> AM[Model that learned patterns from data]
    DATA[(Training data)] -.->|shapes| AM
    AM --> AO[Most likely useful output]
  end
  TO --> J{Human judgment}
  AO --> J
  J -->|verify, edit, decide| USE[Responsible use]
Advanced Hallucination is a feature of how the model works, not a bug

When a language model invents a plausible-but-false fact, it is not malfunctioning, it is doing exactly what it was built to do: produce the most statistically likely continuation of the text, which is not the same as the most true one. Because the model optimizes for fluency and plausibility rather than verified correctness, fabricated details, known as hallucinations, are an inherent side effect of generation rather than an occasional glitch that a future patch will fully remove. This reframes the human's job in precise terms: AI is strongest where being approximately right and fast is valuable, like brainstorming or drafting, and weakest where a single false detail carries real cost, which is exactly where verification belongs.

Key Takeaways

  • AI is a broad field of techniques, not a single product or only chatbots.
  • Traditional software follows fixed rules; many AI systems learn patterns from data instead.
  • Because AI works with probabilities, it is flexible but can be confidently wrong.
  • A useful question for any tool is what it classifies, predicts, generates, or decides.
  • Fluent output is not proof of truth, so human judgment stays essential.
?

Knowledge Check

Question 1 of 3

What most clearly separates a typical AI system from traditional rule-based software?

A spam filter sorts incoming mail without anyone writing a rule for each message. Which description fits best?

An AI assistant gives you a confident, well-written answer to a factual question. What is the most responsible next step?

Further Reading

Foundations of AI / Chapter 2
24 min

Levels of AI

People talk about "AI" as if every system belonged to the same category, but a spam filter and a hypothetical machine that outthinks humanity are not remotely the same kind of thing. They differ along two axes that matter enormously: how broad their capabilities are, and how much they can act on their own. Learning to place a system on those two axes is what turns AI headlines from hype into information.

This chapter walks up a ladder, from the systems you use today to ideas that remain firmly in the realm of speculation. The aim is not to memorize definitions but to build a habit: whenever you read about "AI," ask which rung of the ladder is actually being described.

Example

Picture three systems side by side. The first recommends songs by predicting what you might enjoy next. The second is a chatbot that can answer questions, summarize documents, and draft emails across many topics. The third is a research assistant that, given a goal, plans its own steps, searches sources, runs tools, checks whether it has succeeded, and only then reports back.

All three might be introduced as "AI," yet they sit at clearly different levels. The first does one narrow job. The second is flexible across tasks but still waits for each prompt. The third pursues a goal over many steps with far less hand-holding. The single word "AI" hides those differences, which is exactly why we need more precise terms.

Concept

AI systems are best understood not as a single category but as positions along two independent axes: how broad their capabilities are, and how much they can act on their own. Narrow AI and agentic AI mark where today's systems actually sit, while AGI and ASI name hypothetical levels far up the breadth axis that no system has reached, and the technological singularity describes a possible rate of change rather than a level of ability. Separating breadth of skill from depth of understanding, and capability from autonomy, is what keeps expectations grounded and turns vague talk of "AI" into something you can reason about precisely.

Narrow AI: the systems you actually use

Narrow AI, sometimes written as ANI, is built to operate within a defined range of tasks. A spam filter sorts mail. A recommendation engine ranks content. A modern language model can write, translate, summarize, and answer questions across a huge variety of subjects, which can make it feel general, but it still works within the design, training, and limits of the tool. It does not set its own goals or step outside its lane.

Essentially every AI product on the market today is narrow AI, including the most impressive chatbots and image generators. This is not a criticism. Narrow systems are extraordinarily useful precisely because they are focused. The key insight is that breadth of skill is not the same as general understanding.

Example AlphaFold's narrow brilliance

DeepMind's AlphaFold predicts the three-dimensional shapes of proteins so well that it transformed a decades-old problem in biology, and researchers around the world now rely on it daily. Yet for all that brilliance, it cannot write an email, translate a sentence, or hold a conversation. It is a perfect illustration of the narrow AI bargain: world-changing depth in one lane, and nothing at all outside it.

Advanced The distribution behind the lane

The "lane" of a narrow system is more precise than it first appears: a model performs well on inputs that resemble the statistical distribution of its training data and degrades on inputs that fall outside it, a failure mode researchers call distribution shift. What looks like breadth in a large language model is really competence across many tasks that were all well represented in an enormous training corpus, not a single faculty of understanding that generalizes on its own. This is why a system can be superhuman on protein folding yet helpless at translation: each capability is a separate region of learned competence rather than a facet of one underlying intelligence.

Agentic AI: from answering to acting

The next rung up is less about raw intelligence and more about autonomy. Agentic AI describes systems that pursue a goal across multiple steps. Rather than responding to a single prompt and stopping, an agent reads instructions, decides what to do first, uses a tool, observes the result, and continues until it judges the goal complete.

For example, an agent helping with research might search for sources, summarize what it finds, notice gaps in the evidence, and draft an outline, looping back to fill in weak spots. Agentic systems are still narrow in their underlying capability and still need clear boundaries and oversight, but they matter because they shift AI from "answer this question" toward "help me complete this workflow." Much of today's AI development is happening on exactly this frontier.

Example Coding agents fixing bugs

Modern coding agents make this shift easy to see. Ask one to fix a failing test and it will read the relevant code, form a plan, edit files, run the tests, study the error output, and try again until the suite passes. No single step demands intelligence beyond today's narrow models; what changes the experience is the loop of acting, observing, and adjusting toward your goal.

Advanced Closing the loop between perception and action

What separates an agent from a chatbot is a control structure familiar from robotics and decision theory: a perception–action loop, in which the system observes a state, chooses an action, and then perceives the new state its action produced before choosing again. Each pass feeds the result of the last step back as fresh context, letting the model correct course rather than commit to a single plan in advance. The underlying language model is unchanged and still narrow, but wrapping it in this loop, often alongside external tools and a persistent memory of intermediate results, converts a one-shot predictor into something that can carry a task forward over time, with the trade-off that small errors can compound across steps if no checkpoint catches them.

AGI: the hypothetical generalist

Artificial General Intelligence, or AGI, refers to a system that could learn and perform most intellectual tasks at roughly a human level, transferring knowledge fluidly across domains the way a person can. Crucially, AGI does not exist, and there is no agreed definition or timeline for it.

It is easy to confuse a flexible chatbot with AGI because both seem to "do everything." The difference is reliability and depth: current systems remain dependent on their training, fail in surprising ways, and lack the durable, transferable understanding that the term AGI implies. Treat AGI as a serious research goal and a useful reference point, not as a description of any product you can buy.

Example Why self-driving stays hard

Self-driving cars handle highway cruising with remarkable smoothness, yet the industry has spent years wrestling with the long tail of rare situations: an unusual construction zone, a traffic officer waving cars through a red light. A human driver copes with these on the first encounter by transferring general understanding of the world. That distance between polished performance on familiar tasks and reliable judgment in novel ones is exactly the gap the term AGI points to.

Advanced Transfer, generalization, and the long tail

The technical core of the AGI question is transfer learning: the ability to take understanding acquired in one domain and apply it, without retraining, to a problem the system has never seen. Humans do this fluidly because they build causal and compositional models of the world, whereas current systems mostly interpolate within patterns they have already absorbed, which is why they stumble on the long tail of rare cases that any robust generalist must handle. There is also no settled way to measure general intelligence, so claims that a system "has reached AGI" are as much about which benchmark and definition one accepts as about the system itself, which is part of why no agreed threshold exists.

ASI: beyond human ability

Artificial Superintelligence, or ASI, pushes further still: a hypothetical system that would surpass the best human minds across nearly all important intellectual work. This is even more speculative than AGI and is not a product category at all.

ASI shows up mainly in long-term safety discussions. The reasoning is straightforward: a system far more capable than its creators could be extremely difficult to control or correct if its goals, limits, or oversight were poorly designed. Whether or how soon ASI is possible is genuinely uncertain, which is why careful thinking matters more than confident predictions.

Advanced Why capability and control come apart

Much of the serious discussion of ASI turns on the control problem: the observation that a system's level of capability and the question of whether its behavior stays aligned with human intentions are largely independent. A system can become more powerful at achieving goals without becoming any better at having the right goals, and the harder it is for less capable overseers to anticipate or evaluate a more capable system's actions, the harder correction becomes after the fact. This is why researchers emphasize alignment and oversight as engineering challenges to be solved in advance rather than problems that capability alone will dissolve, since a system that surpasses its designers offers fewer chances to fix mistakes once they appear.

The technological singularity: a claim about speed

The technological singularity is a different kind of idea. Rather than naming a level of capability, it describes a possible moment when AI progress becomes so fast and self-reinforcing, especially if advanced systems could improve other systems, that it outruns human ability to predict or steer it. It is a debated forecast, not an established fact.

When you encounter the term, the useful move is to ask what is really being claimed: a description of current technology, a reasoned projection, or speculation dressed as certainty. The chart below places the four system levels on the two axes that matter, with the singularity left off because it describes a rate of change rather than a system you could point to.

quadrantChart
  title AI levels by capability and autonomy
  x-axis Narrow skill --> General skill
  y-axis Responds to one prompt --> Acts independently over many steps
  quadrant-1 General and autonomous
  quadrant-2 Focused but self-directed
  quadrant-3 Focused and prompt-bound
  quadrant-4 Broad but prompt-bound
  Narrow AI: [0.2, 0.18]
  Agentic AI: [0.36, 0.66]
  AGI: [0.8, 0.82]
  ASI: [0.95, 0.95]
Advanced Recursive self-improvement and why the ladder bends

The reason AGI, ASI, and the singularity are so often discussed together is a single idea: recursive self-improvement. If a system ever became capable enough to meaningfully improve its own design, it could use the improved version to improve itself again, and each cycle might be faster than the last. In theory, this feedback loop could turn steady progress into a sudden, hard-to-predict acceleration, which is the mechanism behind most singularity scenarios.

For a working professional, the value of this concept is calibration rather than alarm. It explains why some serious researchers and policymakers treat long-term AI risk as worth studying now, while today's systems clearly cannot improve themselves in this way. Holding both facts at once, taking the long-term question seriously without mistaking current tools for the scenario, is exactly the kind of judgment AI literacy is meant to build.

Key Takeaways

  • Narrow AI is what people use today, even when a tool feels broadly capable.
  • Agentic AI adds autonomy: it plans and acts across steps, usually with tools.
  • AGI and ASI are hypothetical and have no agreed definition or timeline.
  • The singularity is a debated claim about the speed of change, not a kind of system.
  • When reading AI news, identify which level is actually being described.
?

Knowledge Check

Question 1 of 3

Which type of AI do people most commonly use today?

What primarily distinguishes agentic AI from a standard chatbot?

A news article claims a new product "is basically AGI." What is the most accurate response?

Further Reading

Foundations of AI / Chapter 3
26 min

AI, Machine Learning, and Neural Networks

Three terms get used almost interchangeably in everyday conversation, AI, machine learning, and neural networks, yet they describe different things at different levels. Sorting them out is one of the highest-value moves in this whole handbook, because nearly every later topic, from transformers to training to safety, sits somewhere inside this structure.

The cleanest way to hold it in your head is as a set of nested boxes. Artificial intelligence is the big outer box: the goal of making software behave intelligently. Machine learning is a large box inside it: one powerful family of methods for reaching that goal. Deep learning is a box inside that, and neural networks are the engine that makes deep learning run.

Example

Suppose you want software to read handwritten digits. The old approach would be to write rules by hand: "if the shape has one closed loop on top, it might be a 9." You would quickly drown in exceptions, because everyone's handwriting bends the rules.

A machine learning approach flips the problem around. You collect thousands of labeled images of digits and let the system adjust itself until it reliably maps each image to the right number. It is not memorizing your specific examples; it is tuning itself to recognize the kind of pattern that distinguishes a 9 from a 4, so it can handle handwriting it has never seen. That shift, from writing rules to learning from examples, is the heart of machine learning.

Concept

Intelligent software can be built in two fundamentally different ways: by spelling out rules in advance, or by letting a system discover patterns from examples on its own. The second path, machine learning, matters because the world is full of tasks no one can fully describe in rules, like recognizing a face or understanding a sentence. Deep learning pushes this idea furthest by stacking many layers of simple computation, each refining the information a little, so that together they capture relationships too subtle and tangled for any human to write down. Neural networks are the adjustable mathematical machinery that makes this layered learning work.

AI versus machine learning

It is tempting to treat "AI" and "machine learning" as synonyms, but the relationship is one of goal versus method. AI names the destination: software that performs tasks we associate with intelligence. Machine learning is the route most modern systems take to get there, replacing hand-coded rules with data and a learning process.

The distinction matters because not all AI is machine learning. Some systems still rely on explicit rules, logical reasoning, or search through possibilities, and these approaches remain useful, especially where the rules are well understood and decisions must be explainable. But the AI tools dominating today's headlines, the chatbots, image generators, and recommendation engines, almost all learn from data. So while machine learning is not the whole of AI, it is the part driving the current wave.

Example A Chess Champion Without Learning

When IBM's Deep Blue defeated world champion Garry Kasparov, it did so without any machine learning. The program searched through vast numbers of possible move sequences and scored them with rules crafted by human chess experts, classic AI built from explicit logic rather than data. Set that next to today's chatbots, which learned their abilities from text rather than hand-written rules, and you can see both routes to intelligent behavior side by side.

Advanced Symbolic versus statistical approaches to intelligence

The two routes have formal names worth knowing. The rule-based tradition is often called symbolic AI or "good old-fashioned AI," because it manipulates explicit symbols and logical statements that a person could read and check. Machine learning belongs to the statistical or connectionist tradition, where knowledge lives implicitly in numerical parameters fitted to data rather than in human-readable rules. The trade-off is real and recurring: symbolic systems are transparent and verifiable but brittle outside their hand-coded scope, while statistical systems generalize gracefully to messy, unseen inputs at the cost of becoming opaque, which is why so much current research tries to combine the two.

Deep learning and why it took over

Within machine learning, one approach has come to dominate the hardest problems: deep learning. The word "deep" refers to depth in layers. A deep network stacks many processing layers, and each one transforms its input a little before passing it on. Early layers tend to pick up simple features, edges in an image, say, and later layers combine those into richer concepts, like shapes and then whole objects.

Deep learning was not always the favorite. It surged ahead once two ingredients arrived together: very large datasets and hardware powerful enough to crunch them, especially GPUs. With enough data and computation, deep networks began to outperform older methods on image recognition, speech, translation, and language, and they now underpin most generative AI. Understanding this dependence on data and compute also explains a recurring theme in later chapters: capability, cost, and hardware are deeply linked.

Example Google Translate's Sudden Leap

Google Translate ran for years on older statistical methods that matched phrases between languages, producing translations that were usable but often clunky. When the service switched to a deep neural network, people around the world noticed almost overnight that sentences read more smoothly and naturally. The recipe behind that leap was exactly the one described above: enormous amounts of multilingual text combined with hardware finally powerful enough to train deep networks on it.

Advanced Why depth buys expressive power, and why it was hard to train

Depth matters because each layer composes the features found by the one below it, letting a network build a hierarchy of representations, from edges to textures to objects, far more efficiently than a single wide layer could. In principle even a shallow network can approximate any function, but depth lets it do so with dramatically fewer units, which is the practical advantage. The reason this remained out of reach for decades is that training many layers was unstable: backpropagation multiplies one derivative per layer, so the error signal reaching the earliest layers looks like g = d₁ · d₂ · … · d_L, and when each factor d is smaller than one, this product shrinks toward zero, the vanishing gradient problem that stalls learning deep in the stack. Better activation functions, smarter initialization, and the sheer scale of modern data and GPU compute were what finally tamed it.

What a neural network actually is

A neural network is a system of simple connected units. Each unit takes in numbers, combines them, applies a small transformation, and passes the result onward. Stack enough of these units across enough layers and the network can represent strikingly complex relationships. Learning happens by adjusting the strength of the connections so the network's outputs gradually become more useful.

It is worth setting aside the brain metaphor here. The "neuron" name is historical and loose; there is no tiny mind inside the machine. A neural network is better understood as a flexible mathematical function with many adjustable knobs, tuned automatically until it fits the patterns in the data. That demystified view will serve you far better than imagining a digital brain.

Advanced What one unit computes, and why nonlinearity is essential

Concretely, a single unit computes y = σ(w₁·x₁ + w₂·x₂ + … + b), where the weights w scale each input x, the bias b shifts the total up or down, and σ is a nonlinear activation function such as the popular ReLU, which simply outputs zero for negative inputs and the value itself otherwise. That nonlinearity is not a cosmetic detail: without σ, stacking layers would collapse mathematically into a single linear transformation, no more expressive than one layer, so the network could only ever draw straight-line boundaries. The nonlinear step is precisely what lets stacked layers bend and fold the input space, turning a pile of simple units into a function capable of curving around the intricate patterns real data contains.

Training and inference: the distinction that explains everything

All of that adjustment happens during one phase, and using the result happens in another. Training is the process of creating the model: the system sees examples, makes predictions, measures its mistakes, and updates its internal values to do better next time. It is computationally heavy and usually done once by the people who build the model.

Inference is using the finished model. When you type a prompt into an assistant, the model's internal values are frozen; your input simply flows through them and an output emerges. Almost everything an everyday user does is inference. This single distinction quietly organizes most AI vocabulary, so the diagram below shows how the nested concepts connect to these two phases.

Example Asking Your Phone for the Weather

When you ask a voice assistant about tomorrow's weather, the model interpreting your words was trained long before, in data centers, on enormous collections of recorded speech. Your question teaches it nothing in that moment; the audio simply flows through the model's frozen values and out comes an answer in a blink. That is inference: millions of people sharing the same finished model, each request costing only a sliver of the effort it took to build it.

flowchart TB
  subgraph AI[Artificial Intelligence - software that seems intelligent]
    RULES[Rule-based, logic, and search systems]
    subgraph ML[Machine Learning - learns patterns from data]
      CLASSIC[Other methods: decision trees, clustering]
      subgraph DL[Deep Learning - many stacked layers]
        NN[Neural Networks]
      end
    end
  end
  NN --> TRAIN[Training: adjust internal values from examples]
  TRAIN --> MODEL[Trained model]
  MODEL --> INFER[Inference: run new input through frozen values]
Advanced Weights, loss, and backpropagation

Inside a neural network, the "adjustable knobs" have names: weights and biases. A weight scales how strongly one unit's output influences the next; a bias shifts the result up or down. Training is the search for a set of weights and biases that makes the network's predictions good.

The search is guided by a loss function, a single number measuring how wrong the current prediction is; a common choice is the mean squared error L = (1/n) Σ (ŷ - y)², which averages the squared gap between each predicted value ŷ and its true value y. After each prediction, the system uses backpropagation to work backward through the layers and estimate how much each weight contributed to that error. An optimizer then applies the gradient-descent update w ← w - η · ∂L/∂w, nudging every weight a small step against the slope of the loss, where the learning rate η sets how big that step is. Repeat this millions of times over the training data and the loss falls, meaning the network's outputs steadily improve.

You never have to compute any of this by hand, and you do not need calculus to use AI well. The professional takeaway is conceptual: learning is an automatic, error-driven optimization loop, and the quality of that loop depends heavily on the data and the objective you choose, themes the chapter on creating and training AI develops further.

Key Takeaways

  • AI is the goal; machine learning is the dominant method for reaching it today.
  • Not all AI is machine learning, but most of today's well-known tools are.
  • Deep learning uses many-layered neural networks and took off with big data and GPUs.
  • A neural network is a flexible mathematical function with many adjustable connections, not a digital brain.
  • Training creates or improves the model; inference uses the finished model.
?

Knowledge Check

Question 1 of 3

How are AI, machine learning, and deep learning related?

What is the difference between training and inference?

Why did deep learning become dominant only relatively recently, even though neural networks are an old idea?

Further Reading

Foundations of AI / Chapter 4
24 min

AI Models

When people say a chatbot "knows" something or an app "recognizes" a face, the thing actually doing the work is a model. A model is the learned core of an AI system: the part that takes an input and turns it into an output, whether that means labeling an image, predicting the next word, summarizing a document, or generating a picture. Everything else, the app, the website, the buttons, is packaging around this core.

This chapter follows a model through its life. We will see what feeds it (datasets), what it stores (parameters), how it is built (training), how it is used (inference), and why even a strong model gets things wrong. By the end, the vocabulary that surrounds AI products should feel like descriptions of one object rather than a pile of jargon.

Example

Ask an AI assistant to explain photosynthesis and it answers in seconds. It is tempting to imagine a giant lookup table somewhere with a pre-written paragraph for every possible question. That is not what happens.

Your prompt is handed to a model, which produces a response from the general patterns it absorbed during training, not from a stored answer it copied. That is why it can respond to questions nobody anticipated, and also why the same question can yield slightly different wording each time. The flip side is that the answer can be incomplete or wrong, because the model is reconstructing a plausible response rather than retrieving a verified fact. A model is powerful, not magical.

Concept

A model is the learned core of an AI system: a large set of internal values, shaped by exposure to example data, that together encode the patterns found in that data. At use time it applies those patterns to a fresh input and produces an output, generalizing rather than looking anything up. This matters because it explains both the power and the limits of modern AI in one idea, a model can respond to situations it was never explicitly shown, yet it remains a compressed, statistical reflection of its data rather than a perfect record of the world.

Datasets: what a model learns from

A model is only as good as what it learned from, and what it learned from is a dataset: a collection of examples. For an image model the examples might be pictures paired with labels; for a language model, vast amounts of text; for a recommendation system, records of clicks, ratings, and viewing history.

Because the model's behavior is shaped by these examples, the dataset's qualities become the model's qualities. If important cases are missing, if the data is biased, low quality, or out of date, the model tends to inherit those flaws. This is why a sharp first question about any model is simply: what was it trained on? Much of a system's strength and many of its blind spots trace directly back to that answer.

Example Spam filters learn from flagged mail

The spam filter guarding your inbox was trained on enormous numbers of emails that real people marked as junk or rescued from the junk folder. That history is its dataset, and it explains both the filter's strengths and its gaps: scams resembling past examples get caught reliably, while a genuinely new trick can sail through until enough people flag it and fresh examples enter the data. The filter is only as alert as the examples it has seen.

Advanced Sampling, distribution, and the shadow of the dataset

A dataset is best understood as a sample drawn from some underlying distribution of real-world cases, and a model learns the distribution of its sample, not the distribution of reality. When the two diverge we get distribution shift, which you can picture as shift = P_real - P_train, where P_train is the pattern of the data the model was trained on and P_real is the pattern it actually meets in practice; the larger that gap, the more accuracy quietly degrades. This is also where sampling bias hides, because groups or situations that are underrepresented in the examples are correspondingly underrepresented in what the model can do well, which is why curating and balancing data is as consequential as the choice of algorithm.

Parameters: where the patterns live

During training, what a model learns gets stored in its parameters, the internal numbers introduced in the previous chapter as weights and biases. You can think of parameters as the model's adjustable memory of patterns. They do not hold a tidy list of facts; they encode statistical relationships that let the model generalize to new inputs.

You will often see models advertised by parameter count, billions or even trillions of them. More parameters can mean more capacity to capture detail, but size alone does not guarantee quality. A smaller model trained on better data, with a better method, can outperform a larger one. Parameter count is a rough hint about scale, not a quality score.

Advanced Compression and quantization

Models can also be compressed to run faster or fit smaller hardware. The memory a model needs is roughly size ≈ parameters × bytes-per-weight, where each parameter is stored using some number of bytes, so the precision you keep per weight is a direct lever on the total. Quantization, the most common technique, pulls that lever by storing each parameter with less numerical precision; moving from 32-bit to 8-bit weights cuts memory about ~4× and speeds up inference, usually with a small drop in quality. This is why a single model often ships in several variants with different size, speed, cost, and accuracy trade-offs, and why "which model" and "which version of that model" are both real choices, a thread the chapters on running and choosing AI pick up again.

Training and inference, revisited through the model

We met training and inference in the last chapter; here they describe two phases in the model's own life. Training is where the parameters are set. The model repeatedly predicts, compares its prediction to the expected result, and adjusts, demanding large amounts of data, computation, time, and careful evaluation. This work is almost always done by model developers, not by everyday users.

Inference is the phase you live in. You provide a prompt, a photo, or some other input; the model processes it through its frozen parameters and returns an output. You are not retraining the model when you use it, you are giving it context to work with. Keeping these phases distinct clears up a common confusion: chatting with an assistant does not teach it anything permanent, because that would require training, not inference.

Example Voice assistants answer without relearning

When you ask a voice assistant for the weather, the speech model turning your words into text was trained long before the device reached you, in a slow and expensive process run by its developers. Your request is simply a new input flowing through those finished parameters, which is why the answer comes back in a moment. It also explains a familiar frustration: repeating yourself to an assistant all afternoon does not make it permanently better at understanding you, because everyday use is inference, not training.

Advanced Gradient descent and the asymmetry of the two phases

The adjustment at the heart of training is usually gradient descent, captured by the update rule w ← w - η · ∂L/∂w: each weight w measures how the loss L changes with it (the gradient ∂L/∂w), then steps a little against that direction, scaled by a small learning rate η that controls step size, repeating over many passes until the loss settles. This iterative search is what makes training so costly, since it touches the whole parameter set again and again, whereas inference is a single forward pass through values that are now frozen, an asymmetry that explains why your conversation cannot change the model. What feels like memory within a single chat is the prompt and prior turns being fed back in as context, not a permanent rewriting of any parameter.

Why models make mistakes

A model is a compressed, statistical reflection of its training data, not a perfect copy of reality, and that gap is the root of most errors. It can overgeneralize from common patterns, miss context that a human would catch, repeat information that was already outdated when it was trained, or produce something that sounds authoritative but is simply wrong.

Example When translation sounds right but isn't

Machine translation tools like Google Translate handle everyday sentences impressively, yet they can stumble on idioms, rendering a phrase word for word so the output reads fluently while meaning something else entirely. The system is reproducing statistical patterns between languages, not understanding your intent, so a confident-sounding result can occasionally hide a real error. Anyone relying on machine translation for a contract or a medical instruction quickly learns to have a human check it.

None of this makes models useless; it makes them tools with a known failure mode. The practical consequence is consistent with everything so far: check the output whenever accuracy, fairness, safety, or originality genuinely matters. The diagram below separates the two phases of a model's life so it is clear which steps the builders own and which step is yours.

flowchart LR
  subgraph TP[Training phase - done once by model builders]
    direction TB
    DS[(Dataset of examples)] --> LEARN[Learning process]
    LEARN --> PARAM[Parameters: learned values]
  end
  subgraph IP[Inference phase - every time you use it]
    direction TB
    IN[Your input or prompt] --> MOD[Trained model]
    MOD --> OUT[Output]
  end
  PARAM ==>|frozen and loaded| MOD
Advanced Generalization and knowledge cutoffs

Two practical properties of models follow directly from how they are built. The first is generalization: because parameters encode patterns rather than stored examples, a model can respond sensibly to inputs it never saw, but it can also generalize badly. One way to measure this is the generalization gap, gap = error_test - error_train, the difference between how often the model errs on fresh, unseen inputs versus on its training examples; a large gap signals a model that confidently extends a pattern into cases where it does not hold. The second is the knowledge cutoff: a model only reflects the data available when it was trained, so without external tools it cannot know events after that point and may state stale information as current fact.

Key Takeaways

  • A model is the learned core of an AI system that turns input into output.
  • Datasets shape what a model can do, including its biases and blind spots.
  • Parameters store learned patterns; more parameters can help but do not guarantee quality.
  • Training sets the parameters; inference uses them, and ordinary use does not retrain the model.
  • Models make mistakes because they reflect data statistically, so important outputs need checking.
?

Knowledge Check

Question 1 of 3

What is an AI model, in the sense used in this chapter?

Two language models are compared. Model A has more parameters than Model B. What can you safely conclude?

You spend an afternoon chatting with an AI assistant, correcting it several times. Will it permanently remember your corrections for other users tomorrow?

Further Reading

Foundations of AI / Chapter 5
26 min

AI Architectures

So far we have treated "the model" as a single kind of object, but models come in different designs, and the design is called the architecture. An architecture describes how information flows through the network and, as a result, which kinds of problems the model is naturally good at. Two models can both be neural networks and still be built as differently as a bicycle and a cargo ship.

You do not need to build these systems to benefit from knowing them. The goal of this chapter is recognition, not engineering: enough familiarity that when a tool is described as a "convolutional" vision model or a "transformer-based" assistant, you immediately have a rough sense of what it is suited for and why.

Example

Consider three apps: one unlocks your phone by recognizing your face, one translates a menu in real time, and one paints a picture from a sentence you type. All three are "AI," yet under the hood they are built around different architectures, because each task has a different shape. Faces are spatial patterns in an image. Translation is a sequence-to-sequence problem in language. Image generation is about turning random noise into structure.

It is the same logic as choosing a vehicle. A bicycle, a car, and a freight train all move things, but you would not commute on a freight train or ship cargo on a bicycle. Architectures are specialized in the same way, and matching the design to the job is half of what makes a system work.

Concept

An architecture is the wiring plan of a neural network: the fixed pattern of how information flows from input to output. That pattern is not a cosmetic detail, because it bakes in assumptions about the data and so decides what the model can learn easily, what it learns only with great effort, and what it never grasps well at all. A design that treats an image as a grid of local patterns and one that treats a sentence as an ordered stream will reach for different strengths, which is why matching the shape of the network to the shape of the problem is the foundation everything else is built on.

Feedforward networks: the straight-through baseline

The simplest design is the feedforward neural network. Information enters, passes through one layer after another in a single direction, and an output emerges, with no loops and no memory of previous inputs. This is the architecture implied by the basic "stacked layers" picture from earlier chapters.

Feedforward networks handle many everyday prediction and classification jobs, especially on structured, tabular data such as predicting a price from a row of features. They are also the right starting point conceptually, because once the straight-through case makes sense, the other architectures are easier to understand as clever variations on it.

Example Estimating a home's value

When a real-estate site estimates what a house is worth, the input is not a photo or a sentence but a row of features: square footage, location, age, number of rooms. A feedforward network is a natural fit here, because the data simply flows in one end and a single estimate comes out the other. Many of the quiet, everyday predictions around you, from insurance quotes to delivery time estimates, run on exactly this kind of straight-through design.

Advanced The universal approximator, and why depth still matters

At heart, each neuron does something simple: it takes a weighted sum of its inputs and then bends the result through a curve. A single neuron computes y = f(w₁x₁ + w₂x₂ + … + b), where the xs are inputs, the ws are learned weights saying how much each input matters, b shifts the result, and f is the all-important activation that bends the line into a curve. Remarkably, a network with even one hidden layer is a universal approximator: given enough neurons it can mimic almost any input-to-output mapping, which is why this humble design is so general. The catch is that "enough" can mean an impractically wide layer, so in practice we stack narrower layers instead, and we rely on that non-linear f at every neuron, because without it the whole stack would collapse back into a single straight line.

Convolutional networks: built for images

The first major variation tackles a weakness of the plain feedforward design on images, where what matters is local structure. Convolutional neural networks, or CNNs, scan across an image looking for small local patterns, edges, corners, textures, and build up from there. Early layers might detect simple edges; later layers combine those into shapes and eventually whole objects.

This focus on local patterns is what made CNNs the workhorse of computer vision for years, powering face recognition, medical image analysis, object detection, and photo organization. Whenever a task is fundamentally about what is where in a picture, a convolutional design is a natural fit.

Example Searching your photo library

When you type "dog" or "beach" into your phone's photo app and the right pictures appear, a convolutional network has usually done the quiet work in advance. It scanned each image for edges, textures, and shapes, built those up into recognizable objects, and tagged the photo without you ever labeling anything yourself. The same layered pattern-spotting is what helps systems flag suspicious regions in medical scans for a specialist to review.

Advanced Weight sharing and translation invariance

The core trick of a CNN is to reuse the same tiny pattern-detector everywhere on the image instead of learning a fresh one for every pixel. That detector is a small grid of weights called a kernel, and at each spot it computes feature = Σ (kernel · patch), meaning it multiplies its weights by the little patch of pixels underneath, sums those products (Σ just means "add them all up"), and reports how strongly that pattern is present, then slides one step over and does it again. Because the same kernel is reused across the whole image, this weight sharing slashes the number of parameters and builds in translation invariance, the useful assumption that a cat is a cat whether it sits in the top-left corner or the bottom-right. And because each layer only looks at a small neighbourhood at a time, deeper layers see progressively larger regions, their growing receptive field, which is how a network assembled from tiny edge detectors can eventually recognise an entire object.

Recurrent networks: a first answer for sequences

Images are spatial, but language, speech, and sensor readings are sequential: order carries meaning. Recurrent neural networks, or RNNs, were an early answer to this. They process a sequence step by step and carry a small running memory of what came before, so earlier words can influence how later ones are interpreted.

Example Speech recognition word by word

For years, the speech recognition behind voice dictation and early virtual assistants relied on recurrent networks. Spoken language arrives as a stream, one sound after another, and an RNN's running memory lets the words you have already said shape how the next ones are interpreted, which is how "recognize speech" gets told apart from the nearly identical sounds of "wreck a nice beach." It was a natural match between an architecture built for sequences and a task that unfolds in time.

RNNs were historically important and taught the field a lot about modeling sequences. But processing strictly step by step made them slow to train and weak at connecting information across long distances, a sentence's beginning and its end, for instance. Those limits set the stage for the architecture that replaced them in most language work.

Advanced The vanishing gradient and the hidden state

An RNN keeps a little summary of everything it has read so far and updates that summary with each new word. That summary is the hidden state, and at step t the network computes hₜ = f(W·hₜ₋₁ + U·xₜ), which simply blends the previous summary hₜ₋₁ with the new input xₜ (the W and U are learned weights deciding how much of each to keep, and f bends the result). Because the same weights are reused at every step, training has to multiply error signals by them over and over as it works backward, and those signals tend to shrink toward zero, the notorious vanishing gradient problem, so the influence of early words fades long before the end. Gated variants such as the LSTM eased this by adding learnable channels that let information skip most of that multiplication, but the strictly step-by-step processing remained a hard ceiling on both speed and reach.

Transformers: rethinking sequences with attention

Transformers handle sequences in a fundamentally different way. Instead of marching through a sequence one step at a time, a transformer can look at all the parts at once and use a mechanism called attention to decide which parts are most relevant to each other. This both speeds up training, because the work parallelizes well, and makes long-range relationships far easier to capture.

That combination is why transformers became the foundation of modern large language models and why they scale so well to huge datasets and huge models. They have also spread well beyond chatbots into translation, code generation, search, and vision-language systems. Transformers matter enough that the next chapter is devoted entirely to them and to the LLMs built on top of them.

Advanced Why attention beat recurrence

The big idea behind attention is that every word can look directly at every other word and decide for itself which ones matter, instead of waiting for information to trickle down a chain. That weighing-up is captured by attention = softmax(Q·Kᵀ / √d) · V, where each word issues a query Q and every other word offers a key K; their match score Q·Kᵀ says how relevant they are, softmax turns those scores into percentages that add to one, the √d just keeps the numbers from getting too large, and V is the actual information that gets pulled in according to those weights. Because any position can consult any other in a single step, the path between distant words is short and the strict step-by-step dependency of recurrence disappears, so the work also parallelizes neatly across modern hardware.

Diffusion models: generating by refining noise

Generation is a different goal again, and image generators commonly use a distinct design: the diffusion model. A diffusion model learns to start from random noise and refine it, step by step, into an image that matches a prompt or condition, essentially running a denoising process in reverse of how it was trained.

This is why text-to-image tools can conjure detailed, original pictures from a short description. The same refine-from-noise idea has since extended to audio and video generation, making diffusion one of the central architectures behind today's creative AI.

Advanced Learning to reverse a noising process

A diffusion model learns to clean up a picture by first being shown exactly how that picture was dirtied. The training game is to take a real image, add a sprinkle of random Gaussian noise ε, and ask the network one thing: guess what noise was added. Written out, the model sees a noisy image and tries to predict that hidden ε (the Greek letter epsilon, just a name for "the noise"), and once it can name the noise it can subtract it to step back toward a clean image. Generation runs this in reverse: start from pure static, predict-and-remove a little ε at a time, and because each step is a gentle nudge rather than one leap, a text prompt can steer the process along the way, turning random static into a coherent picture of exactly what you asked for.

Choosing an architecture

Pulling these together, there is no single best architecture, only a best fit for a given combination of data, goal, available computation, and required quality. Vision problems lean convolutional or, increasingly, transformer-based; language leans transformer; image generation leans diffusion; many simple prediction tasks need nothing more than a feedforward network.

The practical lesson is not to memorize engineering details but to internalize that "AI model" is not one design. Different designs create different strengths, weaknesses, and costs, so the architecture is one of the first clues to what a system can and cannot do. The diagram below lines up each architecture with the kind of task it most naturally fits.

flowchart LR
  subgraph ARCH[Architecture]
    direction TB
    FNN[Feedforward network]
    CNN[Convolutional network]
    RNN[Recurrent network]
    TR[Transformer]
    DIFF[Diffusion model]
  end
  subgraph TASK[Naturally suited to]
    direction TB
    TAB[Tabular data and simple prediction]
    IMG[Images: recognition and detection]
    SEQ[Early sequence and time-series tasks]
    LANG[Language, code, and multimodal]
    GEN[Generating images, audio, and video]
  end
  FNN --> TAB
  CNN --> IMG
  RNN --> SEQ
  TR --> LANG
  DIFF --> GEN
Advanced Why lines are blurring

The neat one-architecture-per-task mapping is more of a starting guide than a hard rule, because the field keeps mixing and matching good ideas across designs. Vision transformers, for instance, now rival or beat CNNs by chopping an image into patches and feeding those patches through the very same attention formula, attention = softmax(Q·Kᵀ / √d) · V, that powers language models, where each patch (a Q) weighs how much to attend to every other patch (the Ks) before pulling in their information (V). Transformer and diffusion ideas combine in modern image and video generators, and large multimodal systems handle text, images, and audio in one network. The durable lesson is about trade-offs rather than fixed rules: each design encodes assumptions about the data, and progress often comes from importing one design's best idea, like attention, into a domain it was never built for.

Key Takeaways

  • An architecture is a model's design: how information flows and what it is good at.
  • Feedforward networks are the simple straight-through baseline for many prediction tasks.
  • CNNs specialize in images by detecting local visual patterns.
  • RNNs were an early approach to sequences but struggle with long-range links.
  • Transformers use attention to handle sequences in parallel and power modern LLMs.
  • Diffusion models generate images, audio, and video by refining noise.
?

Knowledge Check

Question 1 of 3

Why is it useful for a non-engineer to know about AI architectures?

A team needs to recognize objects in photographs. Which architecture is the most natural starting point?

What key advantage do transformers have over older recurrent networks for language?

Further Reading

Foundations of AI / Chapter 6
28 min

Transformers and Large Language Models

Most of the AI tools that made headlines, the chat assistants you can talk to, are large language models, or LLMs, and almost all of them are built on the transformer architecture introduced in the previous chapter. Because these tools are so widely used, the ideas in this chapter, tokens, context, attention, hallucinations, do more practical work in daily life than almost anything else in the course.

The single most important reframing is this: an LLM is not a database of facts that it looks things up in. It is a model that learned the statistical patterns of language and uses them to generate a likely, useful continuation of whatever text you give it. That is why it can sound fluent, confident, and helpful, and also why it can be fluently, confidently wrong. Keep that one idea in view and the rest of the chapter explains itself.

Example

When you ask ChatGPT, Claude, or Gemini to summarize an article, the tool does not read the way you do. It first chops your text into small pieces called tokens, then works through the relationships among those tokens, then produces its answer one token at a time, each new token chosen based on everything that came before it.

The result can be genuinely useful, but notice what just happened: the system generated language that fits, it did not verify that each sentence is true. That distinction is the source of both the power and the risk, and it is why "useful draft, then check" keeps returning as the practical habit.

Concept

A large language model is a system that has learned the statistical structure of language so thoroughly that it can continue any text with a plausible, useful next piece. It reads and writes in tokens, small fragments of text, and can only reason over what currently sits inside its context window, the bounded span of tokens it holds at once. The engine that makes this work is attention, a mechanism that weighs how strongly each token relates to every other so that meaning, not just word order, shapes the output. This matters because it explains both the fluency and the failure mode: a model optimized to sound right is not the same as a model that knows what is true.

Tokens: the units a model reads and writes

Models do not process words the way they appear on a page. They process tokens, fragments that may be a whole word, part of a word, a space, or a punctuation mark. A common word is usually one token; a rare or long word may be split into several pieces.

This matters for two concrete reasons. First, model limits are measured in tokens, not pages or characters, so "how much can I fit?" is really a question about token counts. Second, tokens explain how the model writes: it predicts one token, appends it, then predicts the next, repeating until it reaches a natural stopping point. Generation is fundamentally a one-token-at-a-time process, which is why long answers stream out gradually.

Advanced How a tokenizer carves up text

The mapping from text to tokens is not arbitrary; it is learned by a subword algorithm such as byte-pair encoding, which starts from individual characters and repeatedly merges the most frequent adjacent pairs until it has a fixed vocabulary, often tens of thousands of entries. Common words survive as single tokens because they appear often enough to earn their own slot, while rare words, names, or unusual spellings get broken into several smaller pieces, and this is why token counts vary across languages and why a model can still spell out a word it has never seen. Every prediction is really a probability distribution over this whole vocabulary, written P(token | previous tokens), where P is the probability the model assigns to each candidate given everything before it; a setting called temperature (T) reshapes those numbers, so a low T sharpens the choice toward the single most likely token while a high T flattens it and invites exploration.

The context window: the model's working memory

All the tokens the model can attend to at once live in the context window. It holds your current prompt, the earlier conversation, any system instructions, attached documents or retrieved passages, and the answer being generated. Think of it as the model's working desk: only what is on the desk can be used right now.

The practical consequences are immediate. If something important is not in the context window, the model cannot use it, no matter how relevant it is. A larger context window helps with long documents, but it is not a guarantee of understanding, because the model still has to find what matters among everything present. Better context, clear instructions plus genuinely relevant material, usually produces better answers than simply dumping in more text.

Example The Chat That Forgets

If you have ever had a very long conversation with ChatGPT or Claude and noticed it stopped honoring an instruction you gave at the start, you have seen the context window in action. Once the conversation grows beyond what fits on the model's desk, the earliest messages fall out of view, and the model behaves as if they were never said. That is why restating a key instruction late in a long chat genuinely works: it puts the instruction back on the desk.

Advanced Position, and why placement inside the window matters

A transformer has no inherent sense of order, so the position of each token has to be encoded explicitly and added alongside its meaning. What the model actually receives at each slot is therefore roughly input = meaning + position, where meaning is the token's learned embedding and position is a separate signal for where it sits in the sequence, and this sum is how the model knows that "dog bites man" differs from "man bites dog." This positional signal is also why the length of the context window is a hard architectural boundary rather than a soft preference: stretching a model to handle far more tokens than it was trained on tends to degrade its grip on position unless the encoding is specifically designed to extrapolate. A practical consequence, observed across many models, is that information is not weighted uniformly across the window; material near the beginning and end of a long context is often used more reliably than material buried in the middle, an effect sometimes called lost in the middle, which is why where you place a key instruction can matter almost as much as whether you include it.

Attention: weighing what is relevant

The mechanism that lets the model use its context well is attention. Language is full of relationships that span distance: in "The laptop wouldn't start because it needed charging," the word "it" refers back to "laptop." Attention is how a transformer connects "it" to "laptop" rather than to some other word, by learning, for each token, which other tokens it should weigh most heavily.

Example Translation Across Word Order

Machine translation is where attention first proved its worth. Turning English into German or Japanese often means a word from the start of a sentence must move toward the end, or a pronoun must take the grammatical gender of a noun mentioned much earlier. Tools like Google Translate improved noticeably when they adopted attention-based models, precisely because attention lets the system connect distant words instead of translating one fragment at a time.

In a real prompt those relationships get elaborate, linking an instruction to an example, a question to a supporting paragraph, a requested format to the content it should shape. Attention is a powerful way to compute these relationships, but it is worth saying plainly: it does not mean the model understands like a person. It means the model has an effective method for weighing connections among the tokens in front of it.

Advanced Inside attention: query, key, and value

Attention has a more concrete mechanism worth knowing. For each token, the model produces three vectors: a query Q (what this token is looking for), a key K (what this token offers to others), and a value V (the information it would contribute). The whole operation compresses to attention = softmax(Q·Kᵀ / √d) · V, which reads almost as plain English: compare each query against every key with a dot product (Q·Kᵀ), scale the scores down by √d so they stay stable as the vector dimension d grows, pass them through softmax to turn them into weights that sum to one, and use those weights to blend the values V. The output for each position is therefore a relevance-weighted mixture of information drawn from across the context.

Real transformers run many of these attention operations in parallel, "multi-head" attention, so different heads can specialize, one tracking grammatical links, another tracking which noun a pronoun refers to. Two practical points follow. First, attention can only weigh information that is actually present in the context, which is the formal reason missing context produces weak answers and why retrieval helps. Second, comparing every token with every other token means the work grows like for n tokens (double the context and the attention cost roughly quadruples), which is a core reason very long context windows are computationally expensive and why context length is a real engineering and cost trade-off, not a free dial to turn up.

Transformers and LLMs, in motion

The transformer, then, is an architecture for processing sequences in which attention does the heavy lifting, letting the model relate many parts of the input at once instead of crawling through it step by step. That efficiency is what allowed models and datasets to scale to today's sizes, and scaling that up on vast text collections is essentially how an LLM is made.

A trained LLM applies the patterns it learned to your prompt, which is why one model can summarize, explain, translate, classify, draft, brainstorm, write code, and reformat data without a separate hand-written program for each task. Its flexibility comes from broad training and instruction tuning. But that same generality is the risk: if your prompt is vague, the needed source material is missing, or the model absorbed a misleading pattern, it will still produce a confident answer, just not necessarily a reliable one. The diagram below traces a prompt through these stages, including the optional retrieval step described shortly.

sequenceDiagram
  autonumber
  actor User
  participant Tok as Tokenizer
  participant Ctx as Context window
  participant Model as Transformer model
  participant Ret as Retrieval (optional)
  User->>Tok: Prompt text
  Tok->>Ctx: Split into tokens
  opt Retrieval-augmented generation
    Ctx->>Ret: Look up related passages
    Ret-->>Ctx: Add source text to context
  end
  loop One token at a time
    Ctx->>Model: Current tokens
    Model->>Model: Attention weighs relationships
    Model-->>Ctx: Append predicted next token
  end
  Ctx-->>User: Generated response
Advanced Why scale, not new rules, produced today's abilities

What separates a modern LLM from earlier sequence models is less a clever new rule and more the consequence of training a single objective, predicting the next token, on an enormous and varied corpus until the model's parameters, the billions of adjustable numbers that store what it learned, capture an extraordinary range of patterns. Researchers have found that performance improves smoothly and predictably as model size, data, and compute grow together, a scaling law that takes the shape error → a · N^(-b), meaning the model's error keeps shrinking as the scale N (parameters, data, or compute) rises, with positive constants a and b setting how fast; certain capabilities such as multi-step reasoning or following instructions also appear to strengthen sharply once a model crosses a threshold of scale. The flexibility you experience, one model handling translation, code, and summarization alike, is therefore not the sum of many hand-built skills but a side effect of compressing the statistics of human text deeply enough that many tasks become special cases of the same prediction problem.

Hallucinations: confident but unsupported output

Because an LLM is optimized to produce plausible language rather than verified truth, it sometimes generates a hallucination: a confident output that is incorrect, unsupported, or invented. Hallucinations include fabricated facts, fake citations, wrong calculations, and claims that contradict the very source you provided.

Example Court Cases That Never Existed

In a widely reported incident, lawyers filed a legal brief built with ChatGPT that cited several court cases, complete with convincing names, courts, and quotations. None of the cases existed, and the court sanctioned the lawyers who had trusted the output without checking it. The episode shows the mechanism perfectly: the model produced text shaped exactly like real citations, because that is what citations look like in its training data, with no internal check on whether the cases were real.

This is not a rare glitch to be surprised by; it is a direct consequence of how the model works. There is no built-in truth meter inside it. Some tools reduce the risk by adding search, retrieval, citations, or tool calls, but none of these remove the need for judgment. For schoolwork and professional work alike the rule is the same: use AI to think, draft, organize, and explain, and verify factual claims against reliable sources before you rely on them.

Advanced Why fluency and truth come apart

The training objective rewards the model for assigning high probability to text that resembles its training data, so what it actually maximizes is P(plausible text), the likelihood of correct-sounding language, which is not the same quantity as truth: in short, high P(text) ≠ true. The model is therefore optimized for plausibility, the surface form of correct-sounding language, rather than for factual grounding, an actual correspondence to the world, and because a fabricated citation and a real one are nearly indistinguishable in their statistical shape, it will happily generate the fake with the same confidence, since nothing in its objective penalizes inventing a reference that merely looks right. Researchers also distinguish intrinsic hallucinations, where the output contradicts a source you supplied, from extrinsic ones, where it asserts something unverifiable against any source; both stem from the same gap between modeling language and modeling reality, and the most reliable defenses work by narrowing that gap, either by feeding the model trustworthy material to condition on or by checking its claims with an external tool that can actually verify them.

Embeddings and retrieval: grounding answers in real sources

One of the most effective ways to reduce hallucination deserves its own explanation, and it rests on embeddings. An embedding is a numerical representation of meaning, a way of turning text into numbers so that passages with similar meaning end up close together, even when they use different words. This lets a system find relevant text by meaning rather than by exact keyword.

This is the engine behind retrieval-augmented generation, or RAG, the optional step in the diagram. Before answering, the system uses embeddings to find passages relevant to your question, then places that real source text into the context window for the model to draw on. The model is still generating language, but now it is generating from grounded material, which makes answers more accurate and, when the tool shows its sources, more checkable. RAG is one of the most common patterns in serious AI applications precisely because it attacks the hallucination problem at its root: missing context.

Advanced Meaning as geometry: vectors, distance, and similarity

An embedding places each piece of text at a point in a high-dimensional space, a list of hundreds or thousands of numbers, arranged so that semantic closeness becomes geometric closeness: passages about the same idea land near one another even when they share no words. Similarity is usually measured by the angle between two such vectors a and b, the cosine similarity similarity = (a · b) / (|a| |b|), where the dot product a · b rewards vectors that point the same way and dividing by their lengths |a| and |b| cancels out raw magnitude so only direction matters; retrieval then becomes the concrete problem of finding the stored vectors nearest to the vector for your question, which specialized vector databases can do quickly even across millions of passages. The quality of a RAG system therefore hinges on more than the language model: it depends on how faithfully the embedding captures meaning, how the source documents are split into retrievable chunks, and how many neighbors are pulled in, since retrieving too little starves the answer of evidence while retrieving too much reintroduces the very clutter that dilutes the model's attention.

Key Takeaways

  • An LLM generates likely, useful language; it is not a fact database.
  • Tokens are the fragments a model reads and writes, and limits are measured in tokens.
  • The context window is the model's working memory; only what is in it can be used.
  • Attention weighs relationships among tokens but is not human understanding.
  • Hallucinations are a built-in risk, so factual claims should be verified.
  • Embeddings power retrieval (RAG), which grounds answers in real source text.
?

Knowledge Check

Question 1 of 3

What is a hallucination in an LLM?

You paste a long report and ask for a summary, but a crucial detail sits in a separate file you did not include. Why might the model miss it?

A team wants an assistant that answers questions about their internal documents and cites where each answer came from. Which approach fits best?

Further Reading

Foundations of AI / Chapter 7
24 min

Running AI

A model is software, but software has to run somewhere, and with AI that "somewhere" is unusually consequential. The same model behaves differently depending on whether it runs in a distant data center, on your laptop, or inside the camera on your phone. Where AI runs shapes its speed, its cost, its privacy, its reliability, and even which models you can use at all.

This is easy to overlook because two tools can look identical on screen while working completely differently underneath. One might quietly send your every word to a remote server; another might process everything locally and never touch the network. Learning to ask where the computation happens is what lets you reason about both capability and risk, and it turns "which AI tool" into a thoughtful decision rather than a guess.

Example

Open a web-based chat assistant and the heavy lifting almost certainly happens on remote servers; your laptop is mostly a window into a data center. Now let your phone find every photo of a friend or improve your typing suggestions, and some of that AI is running directly on the device, no round trip required. Try to run a frontier-scale model on an ordinary laptop, though, and it will crawl or fail outright, because the hardware cannot hold it.

Same idea, "use some AI," but three very different setups, each with its own trade-offs in speed, privacy, and capability. The setup, not just the feature, is what you are really choosing.

Concept

A model is just a set of instructions until it is given a machine to run on, and that machine's location quietly governs everything that follows. Pushing the computation far away, into a data center, unlocks enormous power but means your data must travel there and back; keeping it close, on your own device, protects that data and removes the network but caps what the hardware can handle. Every practical choice about AI is therefore a negotiation between three scarce resources, processing power, memory, and energy, and where you spend them decides what is fast, what is private, and what is even possible.

Cloud AI: power you rent

Cloud AI runs on servers operated by a provider, which you reach through a website, app, or API. The model itself sits in a data center packed with powerful processors and large amounts of memory, so the work happens far from your device.

The headline benefit is access. A modest laptop can use a state-of-the-art model because none of the heavy computation happens locally, and providers can update models, add safety features, and connect to other services centrally. The trade-off is dependence: cloud tools usually need an internet connection, often cost money, and require sending your prompts, files, or metadata to an external system, a fact that becomes central when we reach privacy.

Advanced The economics of shared infrastructure

Cloud AI works because a provider can buy specialized hardware that no individual would, then amortize its cost across millions of requests. Rather than dedicating a machine to you, the system places many users' work onto the same accelerators through batching, processing several requests together so the expensive parallel hardware stays busy. This pooling is what makes a single state-of-the-art model affordable to serve, but it also explains the dependence: your access exists only as long as the provider keeps the servers running, the network reachable, and your account in good standing.

Local AI: capability you own

Local AI flips that arrangement, running on your own computer, phone, or device. This is valuable when connectivity is unreliable, when costs must be predictable, or, above all, when data should never leave the machine.

The catch is hardware. Local models are typically smaller than the largest cloud models, which can make them slower, less capable, or more limited in context length. Even so, local AI is advancing quickly as devices improve and small models get better, and it reinforces the chapter's recurring point: "AI" is not one fixed thing. A local note-summarizer, a cloud chatbot, and a camera's built-in AI can differ enormously in both ability and privacy.

Example A Chatbot on Your Own Laptop

Tools like Ollama let you download an open model and chat with it entirely on your own machine, even with the network unplugged. Ask it the same question you would put to a frontier cloud model and you will probably notice the gap in depth and polish, because the local model is far smaller. In exchange, nothing you type ever leaves your computer, which is precisely the trade this section describes.

Advanced Why ownership shifts the bottleneck

Running a model locally moves you from paying for service to paying for capacity. The full set of weights, the trained numbers that define the model, must be loaded into your own memory and computed by your own processor, so your device's silicon becomes the hard ceiling on size and speed rather than a remote provider's. The upside is that this capacity is genuinely yours: there is no per-request fee, no rate limit, and no third party in the loop, so the same hardware can answer as many questions as you like, offline and unobserved, for the fixed cost of the machine and the electricity it draws.

Edge AI: computing where the data is born

Edge AI is a particular, increasingly important flavor of local AI: running the model right at the source of the data, on a phone, camera, car, sensor, or classroom device, instead of shipping that data to the cloud first.

Doing the work on the spot has real advantages. It cuts latency, because there is no wait for a remote server, and it reduces data transfer while improving privacy, because raw data can stay put. The limitation is power: edge devices have far less capacity than data-center infrastructure, so the models must be small and efficient. You meet edge AI constantly without noticing, in wake-word detection ("Hey..."), photo enhancement, safety sensors, on-device translation, and many accessibility features.

Example Translating in Airplane Mode

Popular translation apps let you download an offline language pack so the model itself lives on your phone. Point the camera at a foreign menu mid-flight, with no signal at all, and the translation still appears, because the work happens right where the image is captured. That is edge AI in its purest form: a small, efficient model doing useful work with no network in sight.

Advanced Latency, bandwidth, and the physics of the round trip

Edge AI is driven partly by a constraint no amount of cloud power can erase: information takes time to travel, and a request to a distant server and back can never be instant. For tasks where milliseconds matter, such as a car detecting an obstacle or a microphone catching a wake word, that round-trip delay is unacceptable, so the computation must happen on the spot. Keeping data local also sidesteps bandwidth limits, the finite rate at which information can be sent, since a camera generating a continuous stream of images would saturate most connections if every frame were uploaded. The price is that the on-device model must be aggressively compressed and specialized, trading general ability for the speed and independence the situation demands.

What the hardware actually limits

Behind the cloud-versus-local choice sits one physical reality: AI models perform an enormous number of calculations, and something has to do them. GPUs matter here because they perform many operations in parallel, which suits the math of neural networks far better than a general-purpose CPU, making them central to both training and inference.

Equally important is memory. RAM is the computer's main working memory; VRAM is the faster memory attached to the graphics processor. Large models need a lot of it, and the rule is unforgiving: if a model does not fit in available memory, it runs painfully slowly or not at all. This is why AI hardware conversations revolve around GPUs, VRAM, accelerators, and specialized chips, the model may be software, but it cannot escape physical resources.

Advanced Why small models can now run locally

Two numbers govern whether a model fits on a given machine: its parameter count and the precision used to store each parameter. A model with billions of parameters stored at full precision can need tens of gigabytes of memory, well beyond a typical laptop or phone. Quantization, the compression technique from earlier chapters, stores those parameters with fewer bits, often shrinking memory needs several-fold with only a modest quality loss. This, together with steadily better consumer GPUs and increasingly capable small models, is the real reason useful local AI has become practical rather than a research curiosity.

Privacy and the path your data takes

Hardware leads naturally to privacy, because privacy is mostly a question of where data goes. It depends not on whether a tool is branded "AI" but on what data is collected, where it is processed, how long it is stored, who can access it, and whether it is used to train future models.

Example Same Microphone, Different Journey

Tap the dictation button on a recent phone and your speech may be transcribed entirely on the device, while an older voice assistant behind a nearly identical microphone icon streams your audio to a remote server for processing. On screen the two feel the same, yet your words take completely different paths, and only one of them ever leaves your hands. The interface tells you almost nothing; the data path tells you everything.

A useful habit is to ask, before pasting anything in: What am I sending? Where is it processed? Could it include personal, private, or sensitive information? Would I be comfortable if this prompt or file were reviewed later? This is not an argument against cloud AI, which is often the right choice; it is an argument for matching the tool to the sensitivity of the information.

Advanced Data in transit, at rest, and in training

Privacy with AI is best understood as three distinct stages, each with its own protections and risks. Data in transit, moving between your device and a server, is normally encrypted so it cannot be read along the way, yet encryption protects the journey, not the destination. Data at rest, stored on the provider's systems, raises separate questions of retention and access: how long it is kept and who is permitted to see it. The most consequential stage is whether your inputs become training data, folded into a future model's weights, because information absorbed that way is no longer a record that can simply be deleted. Reading a service's terms through these three lenses tells you far more than any "AI" label ever could.

Cost and energy

Finally, all of this computation costs money and uses energy. Training large models requires expensive hardware, and even a response that feels instant and free represents real work on real servers somewhere. Those costs do not disappear; they are simply hidden from view.

For everyday users the bill shows up indirectly, as usage limits, paid subscriptions, slower responses at peak times, or tiers that reserve the most capable models for paying or enterprise customers. Understanding this explains a lot of otherwise puzzling product behavior, and it sets up the deliberate model-selection and cost choices that later, practical chapters explore. The diagram below turns these factors into a simple decision flow.

flowchart TD
  START([New AI feature: where should it run?]) --> PRIV{Must the data stay private or on-device?}
  PRIV -->|Yes| CAP{Is the local hardware powerful enough?}
  PRIV -->|No| CAP2{Do you need the most capable model?}
  CAP -->|Yes| LOCAL[Local AI - runs on the user's own computer]
  CAP -->|No, it is a phone, camera, or sensor| EDGE[Edge AI - small model near the data source]
  CAP2 -->|Yes, capability first| CLOUD[Cloud AI - large models on remote servers]
  CAP2 -->|No, low latency or offline use matters| EDGE
Advanced Why providers tier their models

The same economics shape cloud products. Every inference request consumes GPU time, memory, and energy that the provider pays for, and larger models cost more per request than smaller ones. That is why providers offer tiers, a fast, cheap small model for routine work and a slower, pricier large model for hard problems, and why "which model for which task" becomes a genuine cost-versus-capability decision rather than always reaching for the biggest option. The practical chapters on model selection and token economics build directly on this trade-off.

Key Takeaways

  • Where AI runs shapes its speed, cost, privacy, reliability, and capability.
  • Cloud AI rents access to powerful models but sends data to remote servers.
  • Local AI keeps data on your device but is limited by your hardware.
  • Edge AI runs small models right where data is created, cutting latency and improving privacy.
  • GPUs and memory (RAM and VRAM) decide what can run; AI always costs real compute and energy.
?

Knowledge Check

Question 1 of 3

What is one core trade-off of cloud AI?

A wake-word detector ("Hey...") on a phone responds instantly and works offline. Which approach best explains this?

Someone wants to run a very large language model locally but their computer keeps running out of memory. What is the most likely explanation?

Further Reading

Foundations of AI / Chapter 8
28 min

Creating and Training AI

Up to now we have mostly used finished models. This chapter goes behind the curtain to ask how one gets made, not to turn you into a machine learning engineer, but to give you the vocabulary and instincts to judge AI systems: where they come from, why they behave as they do, and where they tend to fail.

The most important thing to understand is that building AI is a loop, not a one-shot act of "writing a program." A team chooses a goal, gathers data, trains a model, evaluates it honestly, and improves it, often many times, and then keeps watching it after release. And here is the part that surprises newcomers: most AI failures are not dramatic technical bugs. They come from quieter problems, an unclear goal, weak or unrepresentative data, sloppy evaluation, or using a model in a situation it was never built for.

Example

A school wants a tool that flags whether plant leaves look healthy. The team gathers example photos, labels each as healthy or unhealthy, and trains a model that scores well in testing. Everyone is pleased, until it is used in a different classroom and accuracy collapses.

The culprit is usually the data. If every training photo came from one room with the same lighting and the same camera angle, the model may have quietly learned "this lighting" instead of "leaf health." It performs beautifully on data like its training set and poorly on anything else. The lesson echoes through the whole chapter: good training depends less on clever tricks than on good data and honest evaluation.

Concept

Training a model means letting it discover patterns from examples rather than being told explicit rules, and the central tension is generalization, the ability to perform well on data it has never seen, not just on the examples it studied. This matters because an AI system's behavior is shaped almost entirely by the data it learns from and the way that learning is measured, far more than by any single clever algorithm. Get the data and the evaluation right, and the rest follows; get them wrong, and even a sophisticated model will quietly fail.

The AI project loop

AI projects begin with a problem, not a model. Before any code runs, the team should be able to say what the system is for, what success would look like, what data is realistically available, and what risks have to be managed. Skipping this framing is how projects end up with an impressive model that solves the wrong problem.

From there the work cycles: prepare data, train or adapt a model, evaluate how well it does, and feed what you learn back into the next round of data and training. This loop may run many times before the system is good enough to release. And crucially, deployment is not the finish line. Real users behave differently from tidy test examples, and the world keeps changing, so models need ongoing monitoring and maintenance to stay useful. The diagram later in the chapter shows this loop as a cycle with a feedback path, which is exactly how it behaves in practice.

Example Spam filters never stop learning

Email spam filters show the loop in action. A filter trained once would slowly become useless, because spammers study what gets blocked and change their wording and tricks in response. Providers therefore keep watching what slips through, fold those new examples back into the data, and retrain, which is exactly the feedback path from monitoring back to data collection.

Advanced Why models drift after deployment

A trained model encodes a fixed snapshot of the statistical relationship between inputs and outputs as it existed in the training data, yet the world it operates in keeps moving. When the distribution of incoming data shifts, new slang, new spammer tactics, a changing user base, the phenomenon is called data drift; when the relationship between inputs and the correct answer changes, it is concept drift. We can picture both as a growing gap drift = error_live - error_train, where error_live is the error on today's incoming data and error_train the error measured at training time. The gap quietly widens even though the model's parameters are unchanged, which is precisely why the loop never truly closes: continuous monitoring exists to detect drift, and periodic retraining exists to re-align the model with a reality that refuses to stand still.

Datasets: the raw material

Because everything downstream depends on it, data deserves the first close look. A dataset is simply a collection of examples, text, images, audio, sensor readings, ratings, labels, whatever the task requires, and its quality sets a ceiling on how good the model can be.

If the data is incomplete, biased, outdated, or mislabeled, the model tends to absorb those exact flaws, and more data does not help if it fails to represent the real task. This is why a recurring habit pays off: to understand what a model can do, ask what examples it likely learned from. The leaf example was really a data-representativeness failure, and most real-world disappointments are too.

Example Voice assistants and unfamiliar accents

Early voice assistants famously understood some speakers far better than others. Systems trained mostly on a narrow range of accents and dialects stumbled when users spoke differently, not because the technology cared who was talking, but because those voices were scarce in the training data. The fix was not a cleverer model; it was gathering speech that actually represented everyone expected to use it.

Advanced Sampling bias and the gap between data and reality

Formally, a model learns the distribution it is shown, not the distribution it will face, and the difference between the two is sampling bias. Training minimizes an average over the examples actually collected, L = (1/n) Σ loss(ŷ, y), where ŷ is the model's prediction, y the true label, and the sum runs over the n training examples, so the objective rewards good average performance on exactly those examples and nothing else. If certain groups, conditions, or edge cases appear far less often in that sum than in real use, the model has little incentive to handle them well. This is why representativeness outweighs raw volume: a billion near-identical examples narrow the model's view, while a smaller but well-balanced dataset that mirrors the true variety of the task generalizes better, and the discipline of asking who and what is missing from this data is, in rigorous terms, an audit of whether the training distribution matches the deployment distribution.

Splitting the data: training, validation, and test

A single pool of data is not enough, because a model that has seen an example can do well on it without having learned anything general. To detect that, teams split their data into three roles that work together.

Training data is what the model actually learns from: it predicts, receives feedback from the training objective, and updates its parameters. For an image classifier that means many labeled images; for a language model it means predicting missing or next text across huge collections of documents. Validation data is held aside during development to make choices, comparing model versions, tuning settings, deciding when to stop, because a model can keep improving on its training data while getting worse at handling anything new, a problem called overfitting. Test data is locked away until the very end and used once to estimate honest performance: how well does this model do on examples it never trained on and was never tuned against? The discipline here is integrity, if you peek at the test set repeatedly, it quietly turns into another tuning set and stops telling you the truth. For high-stakes systems, evaluation goes further still, adding stress tests, human review, security checks, and fairness analysis.

Example The student who memorized the flashcards

Think of a student preparing for an exam with one fixed set of flashcards. After enough repetitions they answer every card perfectly, yet on exam day a slightly reworded question throws them, because they memorized the cards rather than the concepts. Validation data plays the role of that reworded exam: it reveals whether the model truly learned the pattern or merely its training examples.

Advanced The bias-variance trade-off behind overfitting

Overfitting is one side of a deeper trade-off captured by error ≈ bias² + variance + noise, where bias² measures how far a too-simple model is systematically off, variance how much its predictions swing with the particular training sample, and noise the irreducible randomness no model can remove. A model that is too simple suffers from high bias: it underfits, missing real structure and erring in systematic ways. A model that is too flexible suffers from high variance: it overfits, chasing quirks specific to the training sample so that small changes in the data produce large swings in what it learns. The art of training is minimizing that total by balancing the two terms, and the three-way split is the instrument that locates the sweet spot, validation performance reveals when added complexity stops improving generalization and starts memorizing, while the locked-away test set guards against the subtler leakage of fitting the model to the validation set itself.

The main families of learning

With data and evaluation in place, the remaining choice is how the model should learn, and there is no single method. The right family depends on what kind of data and feedback you have.

Supervised learning uses labeled examples, where each input comes with the correct answer, "spam" or "not spam," "healthy leaf" or "unhealthy leaf." It is the workhorse behind most classification and prediction, and it works well when clear labels exist. Its weakness is the labels themselves: they can be expensive to produce, inconsistent between people, or biased, and poor labels mean poor learning.

Unsupervised learning drops the labels and looks for structure on its own, grouping similar examples or simplifying complex data. It might cluster articles by topic without ever being told the topic names. That makes it valuable for exploration, though the patterns it surfaces still need human interpretation to be meaningful.

Self-supervised learning is a clever middle path that generates its own learning signal from unlabeled data, for example by hiding part of the input and asking the model to predict it. This is how modern language models learn so much: predicting text from surrounding context teaches grammar, facts, style, and reasoning patterns, all without hand-labeling, which is what makes training on internet-scale text feasible.

Reinforcement learning trains an agent through rewards and penalties as it acts in an environment and discovers which actions lead to better outcomes over time. It suits games, robotics, and planning, and it also appears in late-stage tuning of AI assistants to shape helpful behavior. The hard part is designing the reward well; a careless reward invites the system to "game" it instead of solving the real problem.

Ensemble learning combines several models rather than betting on one, blending their predictions by averaging or voting. Because different models tend to make different mistakes, the combination is often more reliable, at the cost of being heavier to run and harder to explain. The diagram below ties the whole loop together.

stateDiagram-v2
  [*] --> DefineGoal
  DefineGoal --> CollectData
  CollectData --> Train: split into train / validation / test
  Train --> Evaluate
  Evaluate --> Train: underperforms, adjust and retrain
  Evaluate --> Deploy: good enough on held-out test data
  Deploy --> Monitor
  Monitor --> CollectData: data drifts or needs change
  Monitor --> [*]: retire the model
Advanced Adapting a model without training from scratch

In practice, most teams never train a large model from zero, that is enormously expensive. Instead they take an existing pretrained model and adapt it, and it helps to see the three main levers as a spectrum from light to heavy. Prompting changes only the instructions and context you give the model at use time; it is fast, cheap, and reversible. Retrieval-augmented generation adds relevant external documents to the context so the model answers from grounded, current sources without changing the model itself. Fine-tuning goes deepest: it nudges the existing weights θ with a small update step θ ← θ - η · ∇L, where L is the loss on your selected examples, ∇L points toward higher error, and the learning rate η keeps each step tiny so the model adapts to a new style or domain without discarding what it already knows. The rule of thumb is to reach for the lightest tool that works, prompt first, add retrieval when the model needs facts it does not have, and fine-tune only when you need consistent behavior that prompting and retrieval cannot deliver.

This spectrum also clarifies how today's assistants are built. A large model is first pretrained with self-supervised learning on vast text, which teaches broad language ability but not how to follow instructions. It is then instruction-tuned on examples of good responses, and often refined with reinforcement learning from human feedback (RLHF), where human preferences shape a reward signal that nudges the model toward helpful, honest, harmless behavior. Recognizing these stages demystifies a lot of model behavior, including why two models built on similar architectures can feel so different in tone and reliability, and it directly connects the training concepts here to the safety and alignment topics in the next chapter.

Key Takeaways

  • AI projects start with goals, data, and evaluation, and run as a repeating loop, not a single build.
  • Dataset quality sets the ceiling on model quality; representativeness matters more than sheer size.
  • Splitting data into training, validation, and test catches overfitting and gives an honest performance estimate.
  • Supervised, unsupervised, self-supervised, reinforcement, and ensemble methods each fit different problems.
  • Deployment is the start of monitoring, not the end of the work.
?

Knowledge Check

Question 1 of 3

Why do AI projects separate data into training, validation, and test sets?

A model scores almost perfectly on its training data but poorly on new examples. What is this called, and what likely caused it?

Which learning style lets modern language models learn from huge amounts of text without humans labeling each example?

Further Reading

Foundations of AI / Chapter 9
27 min

AI Safety and Ethics

Everything in this handbook so far points to one conclusion: AI is powerful, flexible, and fallible all at once. That combination is precisely why safety and ethics are not an optional add-on for specialists, they are part of basic competence with these tools. A system that can draft, decide, and generate at scale can also mislead, expose, and harm at scale.

It helps to separate two questions that are easy to blur. Safety asks how to reduce harm and make systems more reliable, a largely practical, technical concern. Ethics asks how AI should be used, fairly, honestly, and accountably, a question about values and responsibility. Both matter in ordinary study and work, because people already use AI to research, write, code, generate images, and make real decisions that affect other people.

Example

A student asks an AI assistant for sources for a history essay. The reply looks authoritative, with several neatly formatted citations. Most are real. One does not exist, the assistant invented it, title, author, and all. If the essay is submitted without checking, that fabricated source becomes the student's mistake, not the model's.

This small scenario contains the whole chapter in miniature. The AI was genuinely helpful and genuinely unreliable in the same breath, and the responsibility for the final result stayed with the human. AI can support learning and work, but it cannot take over judgment.

Concept

Powerful generative systems can help and harm in the same gesture, because the very fluency that makes them useful also lets mistakes, unfairness, and deception pass as authoritative. Safety is the work of reducing that harm and making behavior more reliable; ethics is the question of how such systems should be used, honestly, fairly, and accountably. They matter because these tools now shape real decisions about people, which means the human using them carries responsibility that no amount of automation removes. The whole craft reduces to one principle: pair a powerful capability with care proportional to what is at stake.

Hallucinations: wrong, but convincing

We met hallucinations as a property of how LLMs work; here the concern is what they mean for responsible use. A hallucination is a confident output that is incorrect, unsupported, or invented, and it becomes most dangerous exactly where stakes are highest: invented sources, fabricated numbers, mistaken legal or medical claims, plausible-sounding technical details.

The real hazard is not simply that AI can be wrong, all tools can be wrong, but that it is wrong in fluent, self-assured language that feels trustworthy. The defense is a habit, not a setting: verify factual claims, ask for sources and check them, compare against reliable references, and raise your guard whenever an answer touches grades, health, money, safety, or other people's lives.

Example The Chatbot's Invented Refund Policy

An airline's customer-service chatbot confidently described a bereavement refund policy that did not actually exist, and a grieving passenger booked flights relying on it. When the airline later refused to pay, a tribunal ruled that the company was still responsible for what its own chatbot had said. The lesson cuts both ways: fluent answers can be flatly wrong, and "the AI said so" does not move responsibility anywhere else.

Advanced Why fluency and truth come apart

A language model is trained to predict text that looks plausible given everything before it, not to check that the claim is true against the world, so confidence and correctness are produced by two different processes that happen to usually agree. When the model has thin or conflicting evidence in its learned patterns, it still generates the most likely-sounding continuation, which is why a fabricated citation can be perfectly formatted, the format is a statistical regularity it has mastered, even when the content behind it is empty. Researchers sometimes call this confabulation, and one partial remedy is grounding: forcing the model to draw from retrieved, verifiable documents so its answers are tethered to a source you can actually inspect rather than to the smooth surface of probable language.

Bias: unfairness learned from data and design

If hallucinations are about being wrong, bias is about being unfair. An AI system shows bias when it treats people, groups, languages, cultures, or viewpoints inequitably, and that bias can enter from many directions: skewed training data, inconsistent labels, design decisions, deployment context, or even how people use the system.

The examples are concrete. A model trained mostly on one style of writing may unfairly judge other styles as worse. A face recognition system built on unbalanced image data may work less well for some groups than others. What makes bias tricky is that it rarely shows up in a single output; it emerges as a pattern across many cases, which is why detecting it takes deliberate, systematic evaluation rather than a glance at one answer.

Advanced Where bias enters and why "fair" has no single definition

It helps to distinguish historical bias, where the data faithfully records a world that is already unequal, from representation bias, where some groups are simply underrepresented in the sample, and from measurement bias, where the labels or features we chose are themselves skewed. A subtle trap is proxy discrimination: even after removing a sensitive attribute like ethnicity, a model can reconstruct it from correlated features such as postal code, so deleting the column does not delete the bias. Mathematically uncomfortable but important, several reasonable notions of fairness, equal error rates across groups versus equal positive rates versus calibrated scores, provably cannot all hold at once except in trivial cases, which means fairness is partly a value choice about which error to equalize, not a purely technical fix.

Privacy: controlling where information goes

Bias concerns the outputs; privacy concerns the inputs. Privacy is about controlling personal and sensitive information, and prompts are a surprisingly easy place to leak it, names, addresses, ID numbers, passwords, private messages, unpublished work, images, confidential documents.

Example Source Code That Left the Building

Engineers at a major electronics company pasted confidential source code and internal meeting notes into a public chatbot while trying to debug and summarize work faster. The material left the company's control the moment it was submitted, and the firm responded by restricting such tools altogether. Nothing about typing into a chat box feels like publishing, which is exactly why this kind of leak is so easy to commit.

The discipline mirrors the data-flow thinking from the chapter on running AI: before using a tool, ask what information you are about to share and whether the tool stores, reviews, or trains on it, and keep sensitive information out unless the rules are clear and you have permission. Privacy also extends to what AI produces, because tools that generate or analyze faces, voices, and personal profiles raise their own consent questions, and the more realistic the output, the more carefully those questions must be asked.

Advanced Memorization, leakage, and privacy by design

There is a deeper reason caution matters: large models can memorize fragments of their training data, and under the right prompt they may regurgitate a verbatim string, so a secret submitted to a system that trains on its inputs is not merely stored, it can potentially resurface in someone else's answer. The field's principled response is to build privacy into the mechanism rather than bolt it on afterward. Differential privacy adds carefully calibrated mathematical noise so that the presence or absence of any single person's data barely changes the model's behavior, giving a provable, tunable bound on how much can be inferred about any individual, while approaches like federated learning keep raw data on the device and share only aggregated updates. The everyday version of the same idea is data minimization: the safest sensitive datum is the one you never transmit in the first place.

Deepfakes and synthetic media

That realism leads directly to deepfakes: AI-generated or AI-altered media that can make people appear to say or do things they never did. Synthetic media is not inherently bad, it powers legitimate creativity and accessibility, but the same capability can deceive, embarrass, defraud, and manipulate.

Example A Video Call Full of Fakes

A finance employee at a multinational firm joined a video call with what appeared to be the company's senior executives and, following their instructions, transferred a large sum of money to fraudsters. Every other participant on that call was a deepfake. The case is a sober reminder that "I saw them say it on video" is no longer proof of anything on its own.

The defensive skill is healthy skepticism toward media that is surprising, emotionally charged, or politically convenient, look for original context, corroboration from trusted reporting, and signs of manipulation before believing or sharing. The ethical test for creating such media is just as simple to state: would the person depicted understand and consent to this use? If the honest answer is no, that is a clear signal to stop.

Advanced The generation-detection arms race and provenance

Most convincing fakes are produced by generative models trained to make outputs that a discriminator cannot distinguish from real, which means any detector we build becomes the very signal the next generation of forgers trains against, an arms race the detectors tend to lose over time. Because chasing fakes after the fact is a losing game, the more durable strategy shifts to provenance: instead of proving a clip is false, we cryptographically attest that authentic media is real. Watermarking embeds a hard-to-remove statistical signature into AI-generated content, while content-authenticity standards attach signed, tamper-evident metadata recording where a file came from and how it was edited. Neither is foolproof, watermarks can be degraded and signatures stripped, but together they shift the question from the unwinnable "can you detect the fake?" to the more tractable "can you verify the genuine?"

Generative AI also unsettles questions of ownership. When a tool produces text, images, music, or code, it raises genuine uncertainty about copyright, the status of training data, who owns the output, how to attribute it, and what counts as fair use.

Two practical principles cut through most everyday situations. First, follow the relevant policy, school, employer, or platform, and be transparent about how AI was used, rather than presenting AI-shaped work as wholly your own independent effort. Second, do not assume generated content is automatically free to use anywhere; copyright rules vary by country and context, and "the AI made it" is not a reliable legal shield.

Advanced Two unsettled questions: the input and the output

The legal uncertainty splits into two distinct problems that are easy to merge. On the input side, training a model means copying vast quantities of existing work, and whether that copying counts as permissible transformative use or as infringement requiring a license is being actively contested in courts and is likely to vary by jurisdiction. On the output side sits a separate question of authorship: many legal traditions grant copyright only to works with meaningful human creative input, so a result produced by typing a short prompt may fall partly or wholly into a zone with weak or no protection. Both questions remain genuinely open, which is exactly why "follow the applicable policy and be transparent" is sounder advice than any confident claim about who owns what.

Human oversight: keeping people accountable

Running through every topic above is a single safeguard: human oversight. People must remain responsible for decisions, especially consequential ones. AI can recommend, summarize, detect patterns, and draft, but a human should review any output that affects real people, and that review has to be real.

Genuine oversight is not rubber-stamping an "approve" button. It requires enough understanding to notice when something is off, ask sharper questions, and push back on a confident but flawed result. In education this protects the point of the exercise: if AI does all the thinking, you may obtain an answer while losing the chance to build the skill the work was meant to develop.

Advanced Automation bias and keeping a human meaningfully in the loop

Oversight has a well-documented failure mode called automation bias: people tend to over-trust a confident machine, accepting its output and even overriding their own correct judgment, especially when they are busy, tired, or the system is usually right. This is why the popular distinction between a human in the loop, who must approve each action, and a human merely on the loop, who monitors and can intervene, matters less than whether the reviewer retains the context, time, and authority to actually dissent. Genuine oversight therefore depends on meaningful contestability, the human can understand why the system produced its result and has a real path to challenge it, which is also why opaque models that cannot explain themselves make accountability structurally harder, not just inconvenient.

Building responsible habits

None of this requires fearing AI; it requires a small set of durable habits. Check important facts. Protect private information. Avoid misleading others. Disclose when AI meaningfully contributed. Respect copyright and the rules you operate under. Keep a human accountable for outcomes.

The mindset that ties them together is a shift in the question being asked. Not just "Can AI do this?" but "Should AI do this, and under what conditions?" The diagram below maps the main risks against the safeguards that answer them.

mindmap
  root((Responsible AI))
    Risks
      Hallucinations
        Fake facts and citations
      Bias
        Unfair to groups or styles
      Privacy loss
        Sensitive data exposed
      Deepfakes
        Misleading synthetic media
      Copyright
        Unclear ownership
    Safeguards
      Verify facts
        Check reliable sources
      Protect data
        Share only what is safe
      Be transparent
        Disclose how AI was used
      Human oversight
        People stay accountable
      Alignment
        Match human values
Advanced Alignment and the rules taking shape around AI

Underneath these practical habits sits a hard technical problem called alignment: getting an AI system to reliably pursue what people actually want, including values they did not spell out. Part of the difficulty is the specification problem, we are bad at writing down our full intentions, so a system optimized for a crude proxy may satisfy the letter of the instruction while violating its spirit, the same trap as a poorly designed reinforcement-learning reward. Techniques like reinforcement learning from human feedback push models toward helpful, honest, and harmless behavior, but they encode the preferences of particular people at a particular time, which raises an unavoidable question: whose values, and who decides? For everyday users, alignment is visible as helpfulness, honesty, and the refusal of harmful requests; for powerful future systems, it becomes one of the central open problems in the field.

Governance is the social counterpart to this technical work, and it is moving quickly. Frameworks such as the EU AI Act introduce risk-based rules and obligations, the US NIST AI Risk Management Framework offers voluntary practices for managing AI risk, and UNESCO has issued a global ethics recommendation. You do not need to memorize the statutes, but knowing they exist reframes responsible AI: it is becoming not only good personal practice but, increasingly, a matter of law and professional standards, especially in high-stakes domains like hiring, lending, healthcare, and education.

Key Takeaways

  • Safety reduces harm; ethics asks how AI should be used. Both are everyday skills.
  • Hallucinations are dangerous because they are wrong in trustworthy-sounding language; verify claims.
  • Bias is usually a pattern across many outputs, so it takes systematic evaluation to catch.
  • Privacy depends on data flow: know what you share and whether it is stored or used for training.
  • Deepfakes and copyright raise consent and ownership questions; disclosure and policy matter.
  • Human oversight means staying genuinely accountable, not just clicking approve.
?

Knowledge Check

Question 1 of 3

What should you do before relying on an AI-generated factual claim?

A hiring screening model rejects very few candidates from one background but many from another, even with similar qualifications. Which issue does this best illustrate, and why is it hard to spot?

What does meaningful human oversight of an AI system actually require?

Further Reading

Foundations of AI / Chapter 10
25 min

Future of AI

No one can tell you exactly what AI will look like in ten years, and anyone who claims certainty is selling something. But uncertainty is not the same as helplessness. You can prepare by understanding the direction the technology is moving, more capable tools, more automation, deeper human-AI collaboration, and harder questions about trust and responsibility, even when the destination stays blurry.

So this final foundations chapter has a deliberately modest goal. Rather than predict specifics, it aims to build durable judgment: the ability to tell what AI can already do from what remains speculative, and the habit of updating your view as the tools change. That skill will outlast every model name and product in this book.

Example

Today you might use AI to summarize your notes before a test. A few years from now, the same person might hand a system a broader goal, "prepare me for this exam," and watch it pull together your materials, draft a study plan, generate practice questions, schedule review sessions, and check in on your progress, coordinating several tools along the way.

The leap is not really about a smarter chatbot. It is about moving from single answers toward coordinated work. And notice what does not change: the valuable human skill is not memorizing one app's buttons but knowing how to set good goals, evaluate the output, and decide what to trust, which is exactly what stays useful as the tools evolve.

Concept

The clearest way to read where AI is heading is to sort every claim by its distance from today's reality. Some ideas, like systems that pursue a goal across several steps, are already taking shape in tools people use now; others, like machines that match or surpass humans across nearly everything, remain genuine unknowns with no agreed definition. What matters most is the discipline of separating demonstrated capability from speculation, because that judgment stays useful no matter how the technology evolves.

From answers to action: agentic AI

The nearest and clearest trend extends a thread from Chapter 2: agentic AI, systems that pursue a goal across multiple steps rather than answering a single prompt. An agent can plan, use tools, check its own progress, revise its approach, and keep going until it judges the task done.

In practice that might mean researching a topic, gathering notes, drafting an outline, assembling a slide deck, and pausing for your approval before finalizing. The system still needs clear boundaries and oversight, but the interaction starts to feel less like asking a question and more like delegating a task. This is why agentic AI is the pivot point of the near-term future: it is where "AI that answers" becomes "AI that coordinates work."

Example Coding Agents Fixing Bugs

Software development offers the clearest preview of this shift. Modern coding agents can take a bug report, search the codebase, draft a fix, run the tests, and revise their own work when something fails, looping through steps a developer would otherwise walk through by hand. Your role moves up a level: instead of writing every line, you describe the goal, set the boundaries, and review the result, exactly the delegation pattern described above.

Advanced The agent loop: perception, planning, and feedback

Underneath the friendly framing, most agents run a repeating cycle often described as sense, plan, act, observe: the system reads the current state, decides on a next step, takes an action through some tool, then feeds the result back in to inform the following step. This closed feedback loop is what separates an agent from a single prompt, and it borrows directly from older ideas in control theory and reinforcement learning, where behaviour is steered by continuously comparing outcomes against a goal. The trade-off is that small errors can compound across a long chain of steps, which is why effective agents lean on explicit checkpoints, tool calls that ground them in real data, and human approval at the moments where mistakes would be costly.

Digital workers and AI-native organizations

Extend agents into the workplace and you get the idea of digital workers: AI systems designed to carry out workplace tasks across tools and processes, handling routine support requests, summarizing meetings, updating records, preparing reports, or monitoring workflows. This does not mean whole jobs simply vanish. More often, specific tasks inside many jobs shift, with people spending less time on repetitive production and more on judgment, communication, review, and coordination.

Example AI Arrives in Office Suites

You can already watch this shift inside the everyday office suite, where AI features now sit directly in documents, email, and meeting tools: drafting a first version, summarizing a long thread, turning a discussion into action items. Nobody's job disappeared the day those buttons appeared, but the mix of work quietly changed, with less time spent producing routine text and more spent reviewing, correcting, and deciding what is good enough to send.

Push that further and some organizations are built around AI from the start rather than bolting it on, AI-native organizations, where workflows, roles, tools, and data are arranged so people and AI systems collaborate by default. In such places employees may use AI to draft, analyze, test, design, translate, and code every day, which quietly changes what skills are most valuable: clear thinking, domain expertise, ethics, communication, and the ability to direct AI systems well. You can prepare now by practicing exactly those: describing tasks precisely, evaluating outputs critically, and working with automated systems responsibly.

Advanced Task decomposition and the economics of automation

A useful lens here is task decomposition: economists who study automation rarely treat a job as a single indivisible thing, but instead break it into a bundle of distinct tasks, some routine and codifiable, others requiring tacit knowledge, social skill, or accountability. Technology tends to automate the routine, codifiable slice first, which is why a role can be reshaped without being eliminated, and why digital workers usually absorb tasks rather than whole occupations. This redistribution also shifts where the value sits: as the cost of producing a draft, a report, or a line of code falls toward zero, the scarce and therefore more valuable activities become specifying the right goal, judging quality, and taking responsibility for the result, which is exactly what an AI-native organization is designed around.

The uncertain horizon: AGI and ASI

Beyond these visible trends lie the genuinely uncertain ideas, and it is worth holding them at the right distance. Artificial General Intelligence, AGI, usually means AI that can perform a wide range of intellectual tasks at or above human level. There is no agreed definition and no consensus on when, or whether, it arrives. Today's narrow systems can be dazzling in many tasks while still failing in surprising, basic ways, which is precisely the gap AGI would close. Treat AGI as a serious topic where most concrete claims are predictions, not facts.

Artificial Superintelligence, ASI, goes further: AI that would greatly exceed human ability across nearly all important areas. It is more speculative still, yet it recurs in long-term safety discussions because it raises hard questions about control, alignment, governance, economics, and human values. Its main practical use today is as a lens, a way to understand why some researchers and policymakers take long-term AI risk seriously even while current systems remain firmly narrow. The timeline below arranges these ideas by how close they are to today's reality.

timeline
  title From today's tools toward an uncertain future
  section Here today
    Assistants : Chatbots, image, and coding tools in daily use
    Early agents : Multi-step tasks with tools and self-checks
  section Emerging
    Digital workers : AI handling routine tasks across many tools
    AI-native orgs : Workflows designed around AI from the start
  section Debated and uncertain
    AGI : Human-level breadth, no agreed definition or timeline
    ASI : Beyond human ability, highly speculative
Advanced Why generality is hard to define and measure

Part of what makes AGI so contested is that generality itself resists a clean definition. Today's systems are strikingly capable within the distribution of data they were trained on, yet they can fail on tasks a child would handle, a pattern sometimes linked to brittleness out of distribution, when a problem differs from anything in the training data. Proposed yardsticks range from passing broad batteries of human exams to the older idea of behaviour indistinguishable from a person's, but each captures only a slice of what "general" might mean, and impressive scores on one benchmark rarely guarantee robust performance elsewhere. This measurement problem is precisely why claims about AGI's arrival are so slippery: without agreement on what we are measuring, a timeline is less a forecast than a definition in disguise.

The realistic near future: collaboration

Step back from the speculation and the most likely near-term picture is neither "humans alone" nor "AI alone" but the two working together. People supply goals, context, taste, ethics, and accountability; AI supplies speed, drafts, pattern recognition, and alternatives. Good collaboration is knowing when to trust, when to question, when to edit, and when to put the tool down entirely.

The people who will be best prepared are not those who use AI the most, but those who learn to think with it without surrendering their own judgment. That balance, leaning on AI's strengths while staying responsible for the result, is the practical center of gravity for the foreseeable future.

Advanced Complementarity and keeping a human in the loop

The case for collaboration is not just optimism; it rests on complementarity, the observation that humans and current AI systems are strong in different and largely non-overlapping ways. Models excel at fast recall, generating many options, and spotting statistical patterns across vast data, while people supply context, intent, ethical weight, and accountability that the model has no reliable access to. Designing for this gap is what the phrase human in the loop really means: arranging the workflow so the system handles breadth and speed while a person retains the decisions where judgment, values, or responsibility are at stake. The risk to watch for is automation bias, the well-documented tendency to over-trust a confident machine, which is exactly why the skill of knowing when to question the output matters as much as the output itself.

Reading predictions without being fooled

Because the future of AI is narrated mostly through bold predictions, a specific skill deserves naming: reading those predictions critically. Ask what evidence supports a claim, whether it describes a system that exists today or one that might exist someday, and what incentives shape the person making it.

Three questions cut through most hype. What would prove this wrong? Who benefits if people believe it? And is this a research result, a shipping product, a polished demo, or marketing? A real mark of AI literacy is comfort with a careful middle position, being able to say, "This is possible, but not yet proven," instead of swinging between blind faith and blanket dismissal.

Example Robot Demos versus Warehouse Reality

Robotics shows the gap vividly. Videos of humanoid robots dancing or leaping have impressed audiences for years, yet the robots actually deployed at scale are far humbler: wheeled machines shuttling shelves and totes around warehouses, doing one constrained job reliably all day. Both are real, but they answer different questions, one shows what is possible in a controlled showcase, the other what is dependable enough to build a business on.

Advanced Scenario thinking and evaluating forecasts

Because pinpoint prediction is unreliable, professionals plan with scenario thinking instead. Rather than betting on one future, you sketch several plausible ones, steady incremental improvement, rapid automation, tighter regulation, a surge in capable local AI, an unexpected breakthrough, and then ask which skills, safeguards, and habits would serve you well across most of them. The aim is robustness, not prophecy: choices that pay off whether progress is fast or slow are far safer bets than choices that only work if one specific forecast comes true.

A complementary discipline is evaluating the forecasts themselves more rigorously. Look for base rates (technologies usually take longer to deploy widely than early excitement suggests), separate a capability that has been demonstrated once from one that is reliable and affordable at scale, and weigh the incentives and track record of the source. None of this is cynicism; it is the same evidence-checking habit applied to claims about the future. Combined with the durable skills above, it lets you engage seriously with where AI is heading while keeping both naive hype and reflexive dismissal at arm's length.

The skills that last

Tools will change, interfaces will be redesigned, and today's famous model names will date quickly, so it is worth ending on what does not expire. Durable skills carry across every version of the technology: asking clear questions, breaking problems into steps, checking evidence, explaining your decisions, protecting privacy, and weighing ethical consequences.

These are the same habits this handbook has been building chapter by chapter, and they are valuable for a reason worth stating plainly: they make AI more useful by making the human in the loop stronger. Keep practicing them, and you will be ready not for one predicted future but for whichever one actually arrives.

Advanced Transferable skills and metacognition

What makes these skills durable can be named more precisely: they are transferable and largely metacognitive, meaning they operate at the level of how you approach a problem rather than the specifics of any one tool. Asking clear questions, decomposing a problem, checking evidence, and explaining a decision are general-purpose reasoning moves that remain valid whether you are working with a person, a spreadsheet, or a model that does not yet exist, which is why they survive each turnover of interfaces and brand names. Crucially, the same metacognitive habits are what let you supervise an AI well, because directing a system you do not fully understand depends on your ability to frame the task, judge the result, and recognise when something is off, so investing in human reasoning is not a hedge against AI but the very thing that makes working with it effective.

Key Takeaways

  • AI's future is uncertain; prepare by understanding its direction, not by predicting details.
  • Agentic AI, digital workers, and AI-native organizations are near-term trends already underway.
  • AGI and ASI are important but genuinely uncertain; most concrete claims are predictions, not facts.
  • The realistic near future is human-AI collaboration, with judgment staying human.
  • Read predictions critically, and invest in durable skills that outlast any tool.
?

Knowledge Check

Question 1 of 3

What is the most useful mindset for dealing with future AI changes?

A demo video shows an AI flawlessly running a complex job end to end. Before concluding the technology is ready, what is the smartest question to ask?

As digital workers and AI-native organizations spread, which human skills are likely to become MORE valuable?

Further Reading

Practical Workshop
60-90 min

Research and Build a Study Guide with AI

This workshop turns the ideas from the foundations chapters into a concrete skill: using an AI assistant to research a topic, check what it tells you, and produce a clear one-page study guide you could actually hand to classmates. Along the way you will practice the habits the handbook keeps returning to, giving good context, verifying claims, and keeping a human in charge of the result.

Work through it with any mainstream assistant (ChatGPT, Claude, Gemini, or similar). The point is not the tool, it is the process, because the process is what transfers to the next tool and the next task.

Example

Imagine you have three days to learn a topic you have never studied, photosynthesis, the French Revolution, how interest rates work, and then teach it to a study group. Asking an AI assistant to "explain it" gets you a fluent overview in seconds, but you have no idea which parts are solid and which are quietly wrong.

This is exactly the situation the foundations chapters prepared you for. An LLM generates plausible language, not verified truth; its answer is a strong first draft and a weak final authority. This workshop gives you a repeatable loop for turning that draft into something you can trust and learn from.

Concept

Research with AI is fundamentally an iterative, verification-driven loop rather than a single exchange, because the assistant produces fluent language that is a strong starting draft but never a final authority. Each pass narrows the gap between what sounds right and what is actually true: you supply context, surface the claims that carry the most risk, test them against independent sources, and feed corrections back in. It works this way precisely because the model has no reliable sense of its own accuracy, so the trustworthiness of the result comes from the structure of your process, not from the confidence of any one answer. Done well, the loop converges on material that is both more accurate and more genuinely understood, because you have wrestled with it rather than merely received it.

flowchart TD
  PICK[Pick a topic and define your goal] --> ASK[Ask the AI for an overview, with context]
  ASK --> CLAIMS[Pull out the key claims to check]
  CLAIMS --> VERIFY{Do reliable sources agree?}
  VERIFY -->|No or unclear| REFINE[Refine the prompt or add real sources]
  REFINE --> ASK
  VERIFY -->|Yes| GUIDE[Write the one-page study guide]
  GUIDE --> REFLECT[Reflect on limits and risks]

Scenario

You need to learn a new topic quickly and prepare a clear, accurate one-page study guide for classmates. You will use an AI assistant as a research partner, but you, not the assistant, are responsible for what ends up on the page.

Your goals

By the end you should be able to do five things well, each tied to a concept from the handbook:

  • Ask useful, well-scoped questions (good prompting).
  • Give the assistant relevant context so it works from the right material (context windows).
  • Identify which claims need verification and check them (hallucinations).
  • Improve the output through follow-up prompts (iteration).
  • Reflect honestly on where the AI helped and where human judgment was essential (oversight).

Step 1 - Choose a topic and set the goal

Pick a topic narrow enough to cover on one page. "World War II" is too broad; "the main causes of World War II" is workable. Write your goal in one sentence before you prompt, for example:

I want a one-page guide explaining the three main causes of X for beginners.

A clear goal makes every later step easier to judge.

Step 2 - Ask for an overview, with context

Resist the urge to type two words. Give the assistant the context it needs to aim well: the audience, the length, the format, and the level. A stronger first prompt looks like:

You are helping me make a study guide. Audience: high school beginners. Explain the three main causes of [topic] in about 250 words, with a short example for each. Use plain language.

Notice how much of that prompt is context rather than the question itself. As Chapter 6 showed, the model can only use what is in its context window, so what you put in front of it largely determines what you get back.

Advanced Engineer the context, not just the question

A useful way to think about this step is role, task, and constraints: you assign the assistant a role (a tutor building a study guide), state the task in one clear sentence, then pin down constraints like audience, length, and reading level so the output has little room to drift. Because the model predicts text conditioned on everything in its context window, every detail you add shifts the probability mass toward the kind of answer you actually want, which is why a richly framed prompt tends to outperform a clever but bare one. When a task is unusually specific, it often helps to show rather than tell, giving one short example of the format you expect, a lightweight form of what practitioners call few-shot prompting.

Step 3 - Pull out the claims that need checking

Read the response and underline every factual claim a careful reader might dispute: dates, numbers, names, cause-and-effect statements, and especially any citations. Pick at least three to verify. These are precisely the places where a hallucination would do the most damage, so treat confident, specific claims with more suspicion, not less.

A useful follow-up prompt here is:

List the specific factual claims in your previous answer that I should verify, and note how confident you are in each.

Use the assistant's self-assessment as a hint, not a verdict, the model can be confidently wrong about its own confidence.

Advanced Triage claims by risk before you verify

You rarely have time to check everything, so verification works best when you triage by risk rather than checking claims in the order they appear. A quick way to prioritize is to weigh how load-bearing a claim is, meaning how much your guide collapses if it turns out to be false, against how checkable it is, meaning how specific and falsifiable it is. Precise, specific assertions like exact dates, named figures, and quoted statistics are both the easiest to confirm and the most damaging if wrong, so they belong at the top of your list, while broad framing statements that no single source settles can usually be softened or attributed rather than verified outright.

Step 4 - Verify against reliable sources

Now leave the chat and check those claims against trustworthy references: textbooks, encyclopedias, official or educational sites, or primary sources. If a claim checks out, keep it. If sources disagree or you cannot confirm it, treat it as unverified and either cut it or rewrite it cautiously.

If the assistant offered citations, verify that each source actually exists and actually says what was claimed. Fabricated or misattributed citations are a classic AI failure, and catching one here is the whole skill in action.

Advanced Read laterally to judge a source

Fact-checkers rely on a technique called lateral reading: instead of staying on a single page and judging it by how authoritative it looks, you open new tabs and ask what other independent sources say about that page and the claim it makes. This matters because a polished, confident-looking site can be just as unreliable as a fluent AI answer, and surface cues like professional design tell you almost nothing about accuracy. A practical discipline here is to confirm each important claim with at least two sources that do not derive from each other, favoring primary documents and recognized reference works, so that agreement reflects genuine consensus rather than the same error copied from place to place.

Step 5 - Refine and iterate

Feed what you learned back into the conversation. If you found an error, correct it and ask for a revision. If a section was too shallow or too advanced, say so. Good iteration prompts are specific:

The second cause was inaccurate, [correct fact] is what really happened. Rewrite that section and keep it to three sentences.

Make the example for the first cause more concrete and beginner-friendly.

Loop back through verification as needed. Two or three focused passes usually beat one giant prompt.

Step 6 - Build the one-page study guide

Assemble the verified material into a clean one-page guide: a short intro, the key points with examples, and a few review questions. You can ask the assistant to draft the layout, but you own the final accuracy. A reasonable closing prompt:

Using only the verified points above, format a one-page study guide with a 2-sentence intro, three sections with one example each, and three review questions.

Step 7 - Reflect

Finish by writing a short reflection (a few sentences is enough): Where did the AI genuinely save time or improve clarity? Where did it mislead you or need correction? What would you do differently next time? This reflection is not busywork, it is how the practical skill compounds from one task to the next.

Advanced Make verification systematic

Once the basic loop feels natural, tighten it into a small system you reuse for any topic. Keep a running claims table with four columns, claim, source checked, verdict (confirmed / refuted / unverified), and a note, so verification becomes a visible artifact rather than a vague intention. Then deliberately seek disconfirming evidence: instead of asking only "is this true?", ask "what would show this is wrong?" and look specifically for sources that disagree. This guards against the trap of accepting the first source that happens to match the AI's answer.

You can also enlist the assistant against its own weaknesses, while remembering it has no built-in truth meter. Ask it to argue the opposite case, to flag where it is extrapolating beyond well-established facts, or to distinguish consensus from contested interpretation. If your tool supports it, point it at specific documents so it answers from real sources you control, a hands-on version of the retrieval-augmented generation idea from Chapter 6. The goal is not to trust the AI more, but to structure the work so that errors are likely to surface before they reach your final guide.

Key Takeaways

  • Treat AI research as a loop: ask with context, verify, refine, then synthesize.
  • Strong prompts are mostly context: audience, length, format, and level.
  • Confident, specific claims, especially citations, are exactly what to verify.
  • Iteration with specific feedback beats one oversized prompt.
  • You remain accountable for the final guide; the AI is a partner, not the author of record.
?

Knowledge Check

Question 1 of 2

Why does this workshop insist on verifying the AI's claims against outside sources?

Which opening prompt is most likely to produce a useful first draft for this task?

Further Reading

Reference

Topic Index

Use this index to jump from a topic to the chapters and workshops where it appears.

agentic AI

AGI

AI basics

ASI

attention

bias

cloud AI

CNN

context windows

datasets

deep learning

deepfakes

diffusion

digital workers

edge AI

everyday AI

FNN

future work

GPUs

hallucinations

inference

LLMs

local AI

machine learning

models

narrow AI

neural networks

parameters

predictions

privacy

prompting

reinforcement learning

responsible AI

RNN

summarization

supervised learning

testing

tokens

training

transformer

transformers

validation

verification