interactive explainer · genai fundamentals

The words for the machine.

You cannot use, trust, or secure a thing you cannot name. This is a plain-language map of the whole GenAI vocabulary, built in the order the ideas actually depend on each other: from the smallest unit a model reads, up through memory and retrieval, to agents that act, and finally to the three jobs of the people who build with them. No term is skipped, and each one arrives only when you need it.

Part I · the mind · chapters 01 to 06

How a model is made

01 · why words first

Name it, then you can handle it

You type a question into a chatbot and a fluent answer appears. Before reading on, try to say, in one sentence each, what a "token" is, what "context" means, and what makes something an "agent." If any of those is fuzzy, you are in the right place.

Every field hides behind its vocabulary, and this one moves fast enough that the words arrive faster than the understanding. The fix is not to memorize a glossary. It is to meet each term exactly when the idea before it makes it necessary, so the words hang on a structure instead of floating loose.

That structure is the plan of this guide. First the model itself, and how it is born. Then the memory we bolt on so it can know things. Then the loop that lets it act, and the ways many of them work together. And finally the three distinct jobs of building with all of it. Every term you have half-heard, embedding, RAG, agent, MCP, harness, lands in its place along the way.

The jargon is not a wall. It is a set of handles, and this guide hands them to you one at a time.
02 · the smallest unit

A model reads in tokens, not words

A model cannot see letters or words the way you do. The first thing that happens to your text is that it gets chopped into tokens: chunks that are often a word, sometimes a piece of one, and each token is turned into a number the machine can work with. Hover the pieces to see how your sentence really looks to the model.

"unbelievably tricky" → tokens → numbers · hover a token
hover a token to see its id
Figure 1Hover each token. "Unbelievably" splits into pieces; each token becomes an id number. Everything the model does, it does to these numbers.
picture it Think of how a child sounds out a long word by breaking it into chunks: "un-be-liev-ably." The model does the same thing to everything, not because it is slow, but because chunks are a tidy, reusable alphabet. Tokens are that alphabet, and the model's entire world is a stream of them, which is also why length limits and costs are always counted in tokens, never in words.

Those billions of numbers the model learned, the settings that turn an input token stream into a sensible output, have a name too: parameters, also called weights. When you hear a model is "70 billion parameters," that is the count of those dials. More dials can mean more capability, and always mean more cost to run.

03 · the architecture

The transformer, and its one big idea: attention

Nearly every modern model is a transformer, and its breakthrough is a mechanism called attention. Instead of reading left to right one word at a time, it looks at every word at once and, for each one, weighs how much every other word matters to it. Scroll to watch attention resolve a word whose meaning depends on its neighbors.

the sentence, all at once
step 0 · a tricky word

"She sat by the bank and watched the river." Does "bank" mean money or riverside? The word alone cannot tell you.

step 1 · look at every other word

To understand "bank," the model looks at all the other words at the same time, not just the ones nearby, and asks how relevant each is.

step 2 · weigh them

"river" lights up strongly; "watched" and "sat" a little; "she" barely at all. Those weights are the attention. The thicker the line, the more that word shapes the meaning of "bank."

step 3 · meaning resolved

Pulled toward "river," the model settles on riverside, not finance. It did this for every word at once, in parallel, which is why transformers are fast and good at long-range context.

Figure 2Scroll-driven. Attention is every word weighing every other word's relevance, all at the same time. That parallel weighing is the whole transformer idea.
picture it At a loud dinner party you do not process the room left to right. You hear your name from across the table and everything else fades; the words that matter to you get louder in your head. Attention is that cocktail-party focus, computed for every word at once: each word decides which others to listen to, and tunes the rest down.

04 · the schooling

Pretraining reads the world; the result is a foundation model

Where does the skill come from? From pretraining: a single, staggeringly expensive pass where the model reads an enormous slice of the internet and books and code, learning only to predict the next token. Do that at scale and it absorbs grammar, facts, styles, and reasoning patterns as a side effect. The result is a foundation model: big, general, and adaptable to countless tasks.

Straight out of pretraining, it is a base model. A base model is a magnificent autocomplete: give it "The capital of France is" and it says "Paris," but ask it a question and it might just continue with more questions, because it learned to continue text, not to help you. It knows a great deal and takes no instruction.

picture it A base model is a brilliant new graduate who has read the entire library and can finish any sentence you start, but has never held a job and does not yet know that when someone asks a question, they want an answer. All that knowledge, none of the manners. The next chapter is where it learns the job.

05 · the manners

RLHF turns a base model into an assistant

To make the knowledgeable graduate genuinely helpful, it goes through RLHF, reinforcement learning from human feedback. People compare the model's answers and prefer the helpful, honest, harmless ones, and the model is nudged to produce more of those. The output is an instruct model or chat model: the same knowledge, now shaped to follow instructions and hold a conversation.

This is the thing you actually talk to. When people say LLM (large language model) they usually mean one of these chat models, and GPT (generative pre-trained transformer) is one famous family whose name became shorthand for the whole category. Base underneath, manners on top.

same question, base vs chat · click one
Figure 3Click each. Same knowledge inside; only the base model was never taught that a question wants an answer. RLHF is the difference.
06 · using it

One call is an inference, and it forgets instantly

Actually using a trained model is called inference: text goes in, text comes out, once. The single most surprising fact for newcomers hides here. That call is stateless. The model remembers nothing between calls. Every message you send, it reads fresh, with no memory of the last one unless you resend it. The "conversation" you feel is an illusion the app maintains by resending the whole history each time.

Models also come in sizes, and the biggest, newest, most capable ones are called frontier models. Frontier is a moving line: whatever sits at the edge of capability today. Bigger is not automatically better to deploy, though, because of a trade-off worth naming.

picture it A frontier model is a top surgeon: astonishing range, and you do not call one to remove a splinter. More power also means more that can go wrong, cost more, and needs closer supervision. A smaller model is a smaller blast radius, a term borrowed from safety: less it can do means less that can break, leak, or be abused. Match the size to the job, not to the hype.

This stateless fact is the seam the whole next part is built on. A mind that forgets everything the instant it answers is powerful but useless for real work, so we spend Part II giving it memory it was never born with.
Part II · the memory · chapters 07 to 09

Giving it knowledge

07 · the desk

The context window is everything it can see right now

Since the model forgets between calls, the only thing it knows in the moment is whatever you put in front of it: your question, the conversation so far, any documents you paste. That whole in-the-moment view has a name and a size limit, the context window. It is the model's short-term memory, its working desk, and it is finite. Fill it up and the oldest things fall off the edge.

picture it Imagine a brilliant consultant with perfect knowledge but total amnesia, who can only ever see what is currently on the desk in front of them. Everything you want them to use, you must lay on that desk right now, because the instant you take it away, it is gone from their mind. The context window is that desk, and its size is how much you can lay out at once. All of Part II is techniques for putting the right things on the desk.

Which raises the real question of memory. You cannot paste your whole company handbook onto the desk every time, and it would not fit. So how do you give the model the right knowledge, at the right moment, from a library far too big for the desk? The answer starts with turning meaning into numbers.

08 · meaning as coordinates

Embeddings put similar meanings near each other

Here is the trick that makes searchable memory possible. Any piece of text can be turned into a list of numbers, an embedding, positioned so that things which mean similar things land near each other. "dog" and "puppy" get nearby numbers; "dog" and "invoice" get distant ones. Meaning becomes a location. Hover the coordinates of one word.

the word "refund" as an embedding · hover a number
an embedding is a list of numbers that encodes meaning; hover one
Figure 4Hover each cell. A few numbers place "refund" at one spot in meaning-space. Real embeddings use hundreds of numbers; a handful is enough to see the idea.

Store millions of these embeddings in a special database that can instantly find the nearest ones to any query, and you have a vector database. Ask it "anything about returns?" and it hands back the passages whose meaning sits closest, even if they never used the word "returns." It is a search that works by meaning, not by matching keywords.

picture it A normal search is a card catalogue: it finds books with the exact word you typed. A vector database is a librarian who understands what you mean, and walks you to the right shelf even when your words and the book's words are different. Embeddings are the map coordinates of meaning, and the vector database is the librarian who reads that map.

09 · fetching knowledge

RAG: look it up, then answer

Now assemble it. When you ask a question, the system finds the relevant passages and lays them on the desk before the model answers. That is RAG, retrieval-augmented generation, and it is how most real AI products know about your private, current, or specific data. Scroll the pipeline.

retrieval-augmented generation
step 1 · the question

"What is our refund window for damaged items?" The model has never seen your policy; it was trained on the public internet, not your documents.

step 2 · turn it into an embedding

The question becomes a meaning-vector, the same kind of coordinates your documents were stored as. Now they can be compared.

step 3 · search the vector database

The database returns the few passages whose meaning sits nearest the question. Your actual refund policy lights up, even if it never says "window."

step 4 · put them on the desk

Those passages are pasted into the context window alongside the question. The model now has the facts in front of it, for this one answer.

step 5 · answer, grounded

The model replies using the retrieved text, not its memory. The answer is current, specific, and traceable to your real document.

Figure 5Scroll-driven, pinned on the right. Question in, meaning-search, retrieve, place on the desk, answer. That loop is RAG, and it is everywhere.

There is a cheaper cousin worth naming. If your knowledge is small and stable, you can skip the per-question search and just preload the whole thing into the context window once, then ask many questions against it. That is CAG, cache-augmented generation. RAG fetches the right pages on demand; CAG hands over the whole short book up front. Big or changing knowledge wants RAG; small and fixed wants CAG.

Hallucination earns its definition here. When a model lacks a fact, it does not stay silent; it produces a fluent, confident, invented answer. RAG is the main defense: give the model the real passage and it has less need to make one up. It reduces hallucination; it does not abolish it.
Part III · the agent · chapters 10 to 12

Making it act

10 · from answering to acting

Wrap the model in a loop and it becomes an agent

So far the model only answers. To make it do things, you wrap that stateless inference in a repeating loop. A model in such a loop is an agent, and the loop itself, often called ReAct, cycles through perceive, reason, act, observe. Scroll one turn of the wheel.

the agentic loop · goal: "book a table for friday"
perceive

The agent reads the current state: the goal, what it has done so far, whatever came back from its last action. This is its input for this turn.

reason

The model thinks about what to do next. "I need an open table Friday; I should check the booking system." A single inference produces this decision.

act

It takes an action in the world: calls a tool, searches, sends a request. This is the step that makes it an agent rather than a chatbot; it can reach outside itself.

observe

It reads the result of the action. "The 8pm slot is free." That observation becomes part of what it perceives next turn.

loop, until done

Perceive, reason, act, observe, again and again, each turn a fresh stateless inference fed the growing history, until the goal is met. The loop is what turns a forgetful answer-machine into something that pursues a goal.

Figure 6Scroll-driven. Perceive, reason, act, observe, repeat. The model is still stateless; the loop, run by ordinary code, is what supplies persistence and agency.
picture it A single inference is a person answering one question and forgetting it. An agent is that same person handed a checklist, a phone, and a notepad, told "keep going until the table is booked." They look at the notepad, decide, make a call, write down what they heard, and look at the notepad again. The genius is not a smarter person; it is the loop and the notepad wrapped around them.

11 · the notepad, in detail

The kinds of memory an agent needs

That notepad is not one thing. A capable agent juggles several kinds of memory, borrowed by name from how psychologists describe human memory. Hover each to see what it holds and where it lives.

an agent's memory · hover a type
hover a memory type
Figure 7Hover each. Only working memory is the model's own context window; the rest are stores the harness manages around it, because the model itself still remembers nothing.

The important thing is that only one of these, working memory, is the context window inside the model. Sensory, long-term, and collective memory all live outside the model, in databases and files that the surrounding code loads onto the desk when needed. The model stays amnesiac; the system around it remembers.

12 · reaching out and teaming up

Tools, a universal plug, and agents that talk

The "act" step needs things to act with. Those are tools: functions an agent can call to search, run code, query a database, send a message. The model does not run them; it asks, and the surrounding code runs them and hands back the result. Then come the standards that stop every tool and every agent from being a custom wiring job. Hover each to see what it is.

tools, protocols, and teams · hover a tile
tools + protocols teams of agents
hover a tile to learn the term
Figure 8Hover each. MCP is a universal plug for tools; A2A lets agents talk to agents; a supervisor coordinates a team. All exist so agents can plug into the world and into each other without bespoke wiring.
picture it Before USB, every device had its own incompatible cable drawer. MCP is USB-C for AI tools: one standard socket, so any agent can plug into any tool that speaks it. A2A is the same idea for agents talking to other agents. Standards are boring and they are why an ecosystem can exist instead of a thousand one-off adapters.

Part IV · the craft · chapters 13 to 14

The three jobs

13 · the decomposition

Agent = Model + Harness

Here is the idea that ties the whole guide together. Everything in Part III, the loop, the tools, the memory stores, the permission checks, the code that assembles the prompt and runs the actions, is called the harness. And the fundamental equation of building with AI is simple: an agent is a model plus a harness.

This decomposition explains something that confuses everyone. Two products can use the exact same underlying model and behave completely differently, one careful and capable, one clumsy, because the harness around the model is different. The model supplies raw intelligence. The harness supplies memory, tools, guardrails, and the loop. Most of what makes an AI product good or bad, safe or dangerous, lives in the harness, not the model.

The model is the engine. The harness is the rest of the car. You have driven plenty of good engines wrapped in bad cars.
14 · the knob · the three jobs

Prompt, context, agentic: three nested scopes

All the vocabulary finally resolves into the three distinct jobs of people who build with AI, and they nest inside each other like rings. Drag the scope from the smallest job to the largest, and watch what you are responsible for, and what the same model can do, grow with it.

the three engineering scopes · drag the ring
Figure 9Drag the ring (or slider) through the three scopes. Each contains the one before it: context engineering includes prompting, agentic engineering includes both. The unit of work grows from a string, to a whole context window, to an entire system.

That progression is the shape of the whole field. Prompt engineering is crafting one good instruction; your unit of work is a string. Context engineering is curating everything the model sees, the retrieved documents, the memory, the history; your unit is the whole context window. Agentic engineering is designing the harness itself, the loop, the tools, the protocols, the permissions; your unit is the entire system. Every term in this guide belongs to one of these rings.

Write a better sentence. Curate a better desk. Build a better world around the model. Three jobs, one nested inside the next.

A model reads tokens and weighs them with attention.
It learns by reading, then learns manners, then answers once and forgets.
We give it memory with embeddings and retrieval, and agency with a loop and tools.
Wrap a model in a harness and you have an agent. Name each piece, and none of it is magic.

the assembly lab

Build a capable worker, piece by piece

Assemble everything you just named. Start with a bare model and add the parts, retrieval for knowledge, a loop for action, tools, memory, and watch what it can do, and what you now have to manage, both grow. The presets rebuild three real systems.

assemble the system · illustrative
what it can do
harness you must build + secure
Figure 10Turn parts on and watch both bars rise together. Every capability you add is also harness you now own, and must secure. Power and responsibility grow as one.
into the weeds

For the readers who scrolled this far

Seven rabbit holes the main path stepped around. Each stands alone.

Temperature: the model's dice
At inference, a model does not always pick its single most likely next token; it samples, and how loosely it samples is called temperature. Low temperature makes it repeatable and focused; high temperature makes it varied and creative. It is why the same prompt can give different answers, and a dial worth knowing exists even though the chat apps usually hide it.
Fine-tuning versus RAG versus prompting
Three ways to make a model fit your needs, from heavy to light. Fine-tuning retrains the weights on your data, changing the model itself; powerful, costly, and it bakes knowledge in. RAG leaves the model alone and fetches knowledge at question time; flexible and current. Prompting just words the request well. A rule of thumb: prompt first, add RAG for knowledge, fine-tune only when you need a new skill or style that prompting and retrieval cannot give.
Why "Agent = Model + Harness" matters for security
This guide comes from a security lens, and the equation is why. You cannot secure the model's weights, but you own the entire harness: which tools exist, what they may touch, what runs without a human, how untrusted input is handled. Nearly every AI security question, prompt injection, over-broad permissions, data leaks, is a harness question. Naming the harness is the first step to defending it.
RAG versus CAG, the real trade-off
RAG searches a big store at every question, so it scales to huge, changing knowledge but adds a retrieval step that can fetch the wrong passage. CAG preloads a fixed body of text into the context once, so it is simpler and has no retrieval errors, but it is capped by the context window size and wastes tokens re-reading everything. Small, stable, and hot: CAG. Large, changing, or occasional: RAG.
The memory types, and where they actually live
Sensory memory is the raw incoming buffer, gone in an instant. Working memory is the context window, the only memory inside the model. Long-term memory splits into episodic (what happened, past interactions), semantic (facts and knowledge), and procedural (how to do things, saved routines), all stored outside the model. Collective memory is shared across many agents or sessions. The model is amnesiac; every one of these except working memory is the harness remembering on its behalf.
Multi-agent systems and the supervisor
One agent with many tools can become a confused generalist. An alternative is several specialized agents, each with its own loop and narrow job, coordinated by a supervisor agent that breaks the goal into parts and hands them out. It mirrors an org chart: a manager and specialists. It is more powerful and more complex, and, from a security view, a larger surface with more places for things to go wrong.
The source, and going deeper
This explainer builds on the vocabulary-first approach of the GenAI Security "GenAI Fundamentals" series, which orders these terms by dependency for exactly the reason stated at the start: you cannot threat-model what you cannot name. The three-scope framing, prompt then context then agentic engineering, and the "Agent = Model + Harness" decomposition come from that lens, where the harness is where security is won or lost.