20 AI Concepts Explained in 40 Minutes

Diagram deck for the article, following the explainer by Gaurav Sen (GKCS).

Gaurav Sen 6 diagrams Flowchart, sequence, and landscape views
Press Next step to walk through

1. From Text to Next Token: How an LLM Reads

Illustrates Sections 1-4: LLMs, Tokenization, Vectors, Attention
inputInput text: "All that glitters is not gold" The model only ever completes a sequence - it never "understands" in the human sense.
tokenizationTokenization splits text into discrete tokens word: "all" space character shared suffix "-s" suffix "-ing" carries meaning Splitting into stems and meaningful suffixes lets the model generalize to unseen words.
vectorsEach token maps to a vector in n-dimensional space A word becomes a coordinate; the mapping is called vectorization.
geometryMeaning becomes a coordinate, and similar words sit close Synonyms cluster together; opposite words land far apart.
problemA single word stays ambiguous: "apple" Spelling is fixed but meaning is not - the word alone cannot disambiguate.
attentionAttention reads the words around the ambiguous token Contextual vectors of neighbors adjust the token's vector - the same mechanism humans use.
context "revenue" "Apple" gets pushed toward the company cluster GoogleMetaMicrosoft
context "tasty" "Apple" gets pushed toward the fruit cluster bananachikuguava
resultThe context-aware vector is now precise
predictionThe model predicts the most plausible next token
outputOutput grows one token at a time The proverb "All that glitters is not gold" returns to the user - completion, not poetry.

2. Self-Supervised Learning: Training Without Labels

Illustrates Section 5: Self-Supervised Learning
dataCollect text that already exists on the web
key ideaNo human labels required The structure of the input itself makes clear what the model should predict.
maskingBlank out a piece of each input countdown with a hidden number face with covered eyes
puzzlesFrom one sentence, "Et tu, Brute", three puzzles run in parallel predict the token after "Et" predict the token after "Et tu" predict the token after "Et tu, Brute"
guessThe model writes its best guess for each blank
checkIs the guess correct?
yes - right answer Weights stay unchanged Guessing "tu" after "Et" needs no update.
no - loss rises Weights update to lower the loss Guessing "Caesar" instead of "Brute" gets penalized.
scaleThe same weights improve across endless puzzles The trick scales to images (blanked patches) and video (predicting motion) - it is what makes LLMs genuinely scalable.

3. The Transformer Stack: The Engine Inside the LLM

Illustrates Section 6: Transformers
inputInput tokens enter the stack A transformer is one algorithm for next-token prediction - not the same thing as an LLM.
THE TRANSFORMER - THE ENGINE
Attention layer 1: pull context from nearby words the first layer disambiguates terms
Feedforward layer 1: refine each vector
Attention layer 2 deeper layers find sarcasm, implications, relationships
Feedforward layer 2
Many layers stacked on top of one another twelve layers, sometimes hundreds
detailEach depth does a different job early: "crane" becomes the bird, not the machine deep: the crab is fearful, the crane is hungry
outputMeaning is manipulated again and again until the model is confident enough to emit the next token
analogyThe LLM is the car; the transformer is its engine The engine is replaceable - a diffusion model could build text instead, and the product (the LLM) stays the same.

4. RAG: Retrieving Context Before Generating

Illustrates Sections 9-10: Retrieval-Augmented Generation and Vector Databases
queryCustomer query: "Where is my parcel?"
serverYour server receives the query Examples teach the format; documents supply company-specific context; the query carries intent.
embeddingThe query is embedded into a vector
searchSimilarity search runs over the vector database vector DBHNSW graphs
semantic"Upset" sits close to "low rating" documents - meaning, not keywords Policy text may never contain the word "upset", but its vector still sits near refund-related documents.
retrieveClosest documents are fetched: policies and terms
augmentThe prompt is assembled: query + few-shot examples + documents user queryexample responsesretrieved documents
generateThe LLM converts the documents into vectors and writes a grounded answer The RAG pattern survives the "RAG is dead" hype - it remains central to grounded applications.
responseHigh-quality answer returns to the customer

5. MCP: From User Query to Completed Booking

Illustrates Section 11: Model Context Protocol
Usersend callAsk to book a flight
Server / MCP clientsend callForward the user query to the LLM
LLMreturn returnDecides it needs external tools or databases
Server / MCP clientsend callConnects to external MCP servers - wrappers around other companies' data
MCP serversend callFetch real-time flight details from its airline
Airline APIreturn returnFlight data comes back
MCP serverreturn returnLive context from the outside world arrives at the client
Server / MCP clientsend callLLM now sees: user query + internal context from the vector DB + live external data
LLMreturn returnDecision: book flight IndiGo 1020
Server / MCP clientsend callBooking API call through the MCP server
MCP serversend callReserve the flight with the airline
Airline APIreturn returnBooking confirmed
MCP serverreturn returnConfirmation returned to the MCP client
Server / MCP clientreturn returnFinal response travels back to the user - a happy customer
What changed: the user no longer executes the recipe themselves. The MCP client runs the entire recipe on their behalf - which is why MCP gained popularity so quickly.

6. RLHF: Rewarding the Better Path

Illustrates Section 14: Reinforcement Learning and RLHF
queryA user query arrives
generateThe model drafts two responses - each response is a path through vector space Each token is a step; the full response is a path.
feedbackA human picks the better response
chosen response Plus one "I found a nice path - I always want to follow it."
other response Minus one Its path wandered into a region to avoid.
creditEvery step on the good path gains positive credit; every step on the bad path is penalized Real implementations may discount rewards along the way - the intuition stands.
landscapeRepeated over many rounds, the vector space is reshaped positive regionsneutral regionsnegative regions
generationSteering becomes hill-climbing toward the positive regions like Pavlov's dog
limitRLHF: human feedback reinforces good outputs - but RL cannot build mental models Watch a fair coin come up heads repeatedly: RL keeps predicting heads, while a human who knows the coin is fair still says 50/50.
Legend: flow / call positive outcome penalty decision or limit alternative outcome Hover dotted text for notes.