AI Explainedby Milad Fahmy

AI for software engineers

Big AI ideas,
explained in two minutes.

Short, clear explainers on how modern AI works, written by a software engineer for software engineers. Every topic comes with a 2-minute video and a page you can read, save and share.

Latest videoKnowledge cutoff: why AI models don't know what happened yesterday
  • 99explainers
  • 16/90MCP episodes
  • 4new videos a day
LatestKnowledge cutoff: why AI models don't know what happened yesterday

All topics

AI Explained

Knowledge cutoff: why AI models don't know what happened yesterday

What an LLM's knowledge cutoff is, why the real cutoff often differs from the reported one, and how developers give a model the present.

Nov 19, 20262 min read
MCP A to Z · Ep 16

MCP errors: protocol errors vs tool errors (isError)

In the 2026-07-28 MCP spec, a tool call can fail in two ways. Here's the difference between protocol errors and tool execution errors, and which one the model should see.

Nov 19, 20262 min read
AI Explained

Retries and idempotency for agent tool calls

How to let an AI agent retry a failed tool call without booking, charging or emailing twice, using idempotent operations and idempotency keys.

Nov 19, 20262 min read
AI Explained

Self-consistency: ask an LLM many times, then take the vote

How self-consistency sampling works, why voting over several reasoning paths makes a model more accurate, what it costs, and how to use it in your own app.

Nov 19, 20262 min read
AI Explained

Continuous batching: how LLM servers keep the GPU full

Why static batching wastes GPU time on LLM inference, how iteration-level scheduling fixes it, and how chunked prefill and memory management fit in.

Nov 18, 20262 min read
MCP A to Z · Ep 15

MCP capabilities: how both sides say what they support

In the 2026-07-28 MCP spec, clients declare capabilities on every request and servers declare theirs in server/discover. Here are the fields, the rules and the new extensions map.

Nov 18, 20262 min read
AI Explained

Sycophancy in LLMs: when AI tells you what you want to hear

Why AI assistants agree with users even when they're wrong, what the research and OpenAI's GPT-4o rollback showed, and how to test your own app for it.

Nov 18, 20262 min read
AI Explained

FlashAttention: faster attention, same answer

Why attention is limited by memory traffic on GPUs, how FlashAttention's tiling keeps the work in fast on-chip memory, and what FlashAttention-2 and -3 added.

Nov 17, 20262 min read
MCP A to Z · Ep 14

MCP server/discover: learning what a server can do

In the 2026-07-28 MCP spec, server/discover returns a server's supported versions, capabilities and identity in one request. Here's what it returns and when to call it.

Nov 17, 20262 min read
AI Explained

Query rewriting and HyDE: better questions, better retrieval

Why user questions often miss the right documents in RAG, how Rewrite-Retrieve-Read and step-back prompting reshape the query, and how HyDE searches with a fake answer.

Nov 17, 20262 min read
AI Explained

Retrieval metrics: recall@k, MRR and nDCG for RAG

How to measure whether your RAG retrieval finds the right documents, with precision and recall at k, mean reciprocal rank and nDCG, plus a worked example.

Nov 17, 20262 min read
AI Explained

Logprobs: how sure was your LLM about that answer?

What token log probabilities are, how to turn them into percentages, how to request them, and four practical ways developers use them.

Nov 16, 20262 min read
AI Explained

Matryoshka embeddings: one vector, many sizes

How Matryoshka Representation Learning trains embeddings you can cut short, what OpenAI and Hugging Face measured, and how to truncate them safely.

Nov 16, 20262 min read
MCP A to Z · Ep 13

MCP _meta: what every MCP request carries in 2026-07-28

In stateless MCP, every request carries its protocol version, client capabilities and client info in _meta. Here are the keys, the errors and the rules.

Nov 16, 20262 min read
AI Explained

Positional encoding (RoPE): how Transformers know word order

Why Transformers need positional encoding, how the original sine waves worked, how RoPE rotates queries and keys, and how models stretch past their trained length.

Nov 16, 20262 min read
AI Explained

Rate limits and token budgets: why your LLM app gets a 429

How LLM API rate limits work (requests, input and output tokens, token buckets, spend caps) and how to stay under them with retries, backoff and budgets.

Nov 15, 20262 min read
AI Explained

Slopsquatting: when AI invents a package and attackers claim it

How attackers register the package names AI coding tools hallucinate, what the research found, and the checks that keep you safe.

Nov 15, 20262 min read
MCP A to Z · Ep 12

Stateless MCP: what changed in the 2026-07-28 spec

The 2026-07-28 MCP revision makes every request self-contained. Here's what went away (sessions, callbacks, resumability) and what replaced it.

Nov 15, 20262 min read
AI Explained

Tool search for large tool sets: give agents thousands of tools

Why loading every tool definition hurts agents, and how tool search with defer_loading lets a model discover only the tools a task needs.

Nov 15, 20262 min read
AI Explained

Agentic browsers: when your browser clicks and buys for you

How AI browsers with agent modes work, why indirect prompt injection makes them risky, and how users and builders can limit the damage.

Nov 14, 20262 min read
AI Explained

Fill-in-the-middle: how code autocomplete sees both sides

How fill-in-the-middle (FIM) training lets code models use the code above and below your cursor, from the 2022 paper to Code Llama, StarCoder2 and Ollama's suffix.

Nov 14, 20262 min read
MCP A to Z · Ep 11

MCP's old initialize handshake, and why it was retired

How legacy MCP connections opened with initialize, negotiated a version and capabilities, and what the stateless 2026-07-28 revision does instead.

Nov 14, 20262 min read
AI Explained

Prompt versioning: ship prompts like code

Track every prompt change as a version, ship it by moving a production label, roll back in seconds, and compare versions in traces and evals.

Nov 14, 20262 min read
AI Explained

LLM API gateways: one door to every model

What an LLM gateway between your apps and model providers gives you: one endpoint, virtual keys and budgets, cost tracking, retries, fallbacks and caching.

Nov 13, 20262 min read
MCP A to Z · Ep 10

MCP Inspector: watch your MCP server's protocol live

How to run the MCP Inspector against a local or remote server, call tools from a form, read the JSON-RPC transcript, and switch between legacy and modern protocol eras.

Nov 13, 20262 min read
AI Explained

PII redaction for LLM apps: mask it in, restore it out

Keep names, emails and card numbers out of your prompts. Detect personal data, swap it for placeholders, keep the mapping, and restore the real values in the answer.

Nov 13, 20262 min read
AI Explained

SWE-bench explained: how coding agents get graded

What a SWE-bench score really measures, why SWE-bench Verified exists, and why contamination led to SWE-Bench Pro. How to read a coding benchmark score.

Nov 13, 20262 min read
MCP A to Z · Ep 09

Add your first MCP server to Claude, Claude Code, Cursor or VS Code

The one config shape every MCP client shares, and exactly where it goes in Claude Desktop, Claude Code, Cursor and VS Code, with the one key name that differs.

Nov 12, 20262 min read
AI Explained

Long context vs RAG: paste it all, or retrieve it?

Million-token context windows can hold thousands of pages. When to paste everything into the prompt, when to retrieve only what matches, and how to combine both.

Nov 12, 20262 min read
AI Explained

Text-to-SQL: ask your database in plain English

Text-to-SQL lets an LLM turn a plain-English question into a SQL query. How it works, what the BIRD and Spider benchmarks show, and how to run it safely.

Nov 12, 20262 min read
AI Explained

Top-p vs top-k sampling: what the knobs actually cut

Top-k, top-p (nucleus) and min-p sampling all cut the long tail of unlikely tokens. How each one decides where to cut, and why a fixed k fits badly.

Nov 12, 20262 min read
AI Explained

AI code review: a model on your pull requests

AI code review tools read your diff and comment on the changed lines. What they catch, how Copilot and Claude fit in, what Google measured, and why a person still decides.

Nov 11, 20262 min read
AI Explained

Hybrid search: BM25 plus vectors, merged with RRF

Vector search understands meaning but misses exact strings; BM25 does the opposite. Hybrid search runs both and merges them with Reciprocal Rank Fusion.

Nov 11, 20262 min read
AI Explained

Synthetic data: training AI on data a model wrote

Synthetic data is training and test data generated by a model. How Self-Instruct, Alpaca and phi-1 used it, and why model collapse means you still need real data.

Nov 11, 20262 min read
MCP A to Z · Ep 08

Who runs MCP? Governance, SEPs and the deprecation policy

MCP lives at the Agentic AI Foundation. How its maintainers decide, how a SEP moves from draft to final, and how long deprecated features stay in the spec.

Nov 11, 20262 min read
AI Explained

Batch APIs: cut your LLM bill in half by waiting

Batch APIs run LLM requests in the background at 50% of the normal price. How they work, their limits, and which jobs to move to a batch.

Nov 10, 20262 min read
AI Explained

Diffusion models: how AI turns static into a picture

Diffusion models learn to remove noise, then generate images by starting from pure static and denoising step by step. How training, sampling and guidance work.

Nov 10, 20262 min read
AI Explained

Semantic caching: same meaning, same answer

Users ask the same question a hundred ways. Semantic caching matches questions by meaning, returns the saved answer, and skips the LLM call. How to tune it safely.

Nov 10, 20262 min read
MCP A to Z · Ep 07

stdio vs Streamable HTTP: the two MCP transports

MCP messages travel over stdio for local servers or Streamable HTTP for remote ones. How each works in the 2026-07-28 spec, and the rules to get right.

Nov 10, 20262 min read
MCP A to Z · Ep 06

How MCP is versioned

MCP versions aren't 1.0 or 2.0, they're dates. What each version from 2024-11-05 to 2026-07-28 changed, and how clients and servers agree on one. Episode 6.

Nov 9, 20261 min read
AI Explained

RLHF: reinforcement learning from human feedback

A small model beat one a hundred times bigger, thanks to human feedback. How RLHF works step by step, why it can cause sycophancy, and newer methods like DPO.

Nov 9, 20262 min read
AI Explained

Speculative decoding: faster LLMs, same output

A small model can make a big one faster with exactly the same output. How speculative decoding drafts tokens and verifies them in one pass, and when it helps.

Nov 9, 20262 min read
AI Explained

The KV cache: why the first token is slow

Why is the first token slow but the rest stream out fast? The KV cache. How prefill and decode work, how much memory the cache uses, and how PagedAttention helps.

Nov 9, 20262 min read
MCP A to Z · Ep 05

JSON-RPC 2.0 in MCP

Every MCP message is plain JSON-RPC 2.0. Requests, responses and notifications, ids, error codes and resultType, explained. Episode 5 of MCP from A to Z.

Nov 8, 20261 min read
AI Explained

RAG chunking strategies

Your RAG app has the answer but keeps retrieving the wrong paragraph. Often the problem is chunking. Fixed-size, recursive, semantic and contextual chunking compared.

Nov 8, 20262 min read
AI Explained

Rerankers: put the best result first

Your search found the right document but ranked it ninth. Rerankers read the query and each document together to reorder results. Bi-encoders vs cross-encoders explained.

Nov 8, 20262 min read
AI Explained

Voice agents: AI you talk to

Two seconds of silence and a voice bot already feels broken. How voice agents work: chained vs speech-to-speech, turn detection, barge-in and latency.

Nov 8, 20262 min read
AI Explained

Agent sandboxing and permissions

Your coding agent ran a command you never read. What stopped it from wiping your home folder? Permissions decide what it may do; a sandbox limits what it can do.

Nov 7, 20262 min read
AI Explained

Background coding agents

Assign a ticket before lunch, and a pull request is waiting when you're back. How background coding agents work in cloud sandboxes, and how to use them well.

Nov 7, 20262 min read
AI Explained

C2PA and AI watermarks

Is this photo real, or did AI make it? Content credentials record where a file came from; watermarks hide a signal inside it. How C2PA and SynthID work, and their limits.

Nov 7, 20262 min read
MCP A to Z · Ep 04

From tool calls to MCP: what the protocol adds

Your LLM can already call functions. So why does MCP exist? What MCP adds on top of plain tool calls: discovery, schemas, change notifications and auth. Episode 4.

Nov 7, 20262 min read
MCP A to Z · Ep 03

MCP tools vs resources vs prompts

Every MCP server offers the same three primitives: tools, resources and prompts. What matters is who decides to use each one. Episode 3 of MCP from A to Z.

Nov 6, 20262 min read
AI Explained

Spec-driven development with AI agents

You ask an agent for a feature and it builds something else. Spec-driven development writes the spec first, then lets agents turn it into code. Spec Kit and Kiro explained.

Nov 6, 20262 min read
AI Explained

Streaming LLM responses

Your AI app goes silent for 20 seconds, then dumps a wall of text. Streaming sends the answer piece by piece. How server-sent events work, and the gotchas.

Nov 6, 20262 min read
AI Explained

Vibe coding vs agentic engineering

Two developers ship the same app with AI. One can explain every line, the other can't. The difference between vibe coding and agentic engineering, and when to use each.

Nov 6, 20262 min read
AI Explained

GraphRAG: RAG with a knowledge graph

Ask a normal RAG app for the main themes in your data and it misses the big picture. GraphRAG builds a knowledge graph and community summaries first. How it works.

Nov 5, 20262 min read
MCP A to Z · Ep 02

MCP host vs client vs server

Everyone says MCP client and server, but there's a third role in charge: the host. Who does what in MCP, and why servers can't see your whole conversation. Episode 2.

Nov 5, 20262 min read
AI Explained

Model routing: the right model for each request

Your app sends every question to the biggest, priciest model, even "what's 2+2?". Model routing sends easy requests to small models and hard ones to strong models.

Nov 5, 20262 min read
AI Explained

Vector databases: search by meaning, fast

A million documents, one question. Vector databases find the nearest embeddings fast with approximate search like HNSW and IVF. How they work, and when you need one.

Nov 5, 20262 min read
AI Explained

Open-weight vs open-source AI models

Lots of AI models are called open, but most aren't open source. What open weights give you, what the OSI's Open Source AI Definition requires, and how to check.

Nov 4, 20262 min read
AI Explained

Prompt caching: pay less for repeated prompts

Your agent resends the same long prompt every turn, and you pay for it every time. Prompt caching reuses the identical start of the prompt at a fraction of the price.

Nov 4, 20262 min read
AI Explained

Structured outputs: guaranteed JSON from LLMs

You asked for JSON and got JSON plus a friendly sentence that broke your parser. Structured outputs use constrained decoding so the answer always matches your schema.

Nov 4, 20262 min read
MCP A to Z · Ep 01

What problem does MCP solve? The N×M problem

Three AI apps and four tools need twelve custom integrations. MCP turns N×M connectors into N+M. Episode 1 of MCP from A to Z.

Nov 4, 20262 min read
AI Explained

MCP vs UTCP: two ways to give agents tools

MCP wraps your tool in a server. UTCP describes your existing API in a JSON manual so agents call it directly. The differences, and when to pick each.

Nov 3, 20262 min read
AI Explained

Multimodal models: AI that sees and hears

Send an AI a photo of your fridge and it suggests dinner. How multimodal models turn images and audio into tokens, from ViT and CLIP to LLaVA.

Nov 3, 20262 min read
AI Explained

Small language models (SLMs)

Bigger isn't always better. Small language models with a few billion parameters are catching up, and they're cheaper, faster and can run on your phone.

Nov 3, 20262 min read
AI Explained

Distillation: big teacher, small student

How do you fit a big model's smarts into your phone? Distillation trains a small student model to copy a big teacher. How it works, and its limits.

Nov 2, 20262 min read
AI Explained

Fine-tuning vs RAG: which one do you need?

Your AI doesn't know your company's docs. Fine-tune it, or use RAG? Short answer: RAG for knowledge, fine-tuning for behavior. Here's what the research says.

Nov 2, 20262 min read
AI Explained

LoRA: cheap fine-tuning for big models

Fine-tuning a giant model sounds expensive. LoRA freezes the original weights and trains two small matrices instead. How it works, and why adapters are so handy.

Nov 2, 20262 min read
AI Explained

Quantization: running big models on small hardware

A 70B model needs about 140 GB of memory. Quantization stores each weight in fewer bits so it fits on one GPU or a laptop, usually with little quality loss.

Nov 2, 20262 min read
AI Explained

Agent tracing: see every step your agent takes

Your agent gave a wrong answer. Which step went wrong? Tracing records every model call and tool call as spans in a tree, so you can debug speed, cost and mistakes.

Nov 1, 20262 min read
AI Explained

Mixture of Experts (MoE)

DeepSeek V3 has 671 billion parameters, but each token uses only 37 billion. How Mixture of Experts models route tokens to a few experts, and the trade-offs.

Nov 1, 20262 min read
AI Explained

Temperature, top-p and top-k

Same prompt, same model, different answer every time. Why? Temperature. How sampling works, what top-p and top-k do, and why Claude's newest API dropped them.

Nov 1, 20262 min read
AI Explained

Transformers and attention, explained

ChatGPT, Claude and Gemini all share one idea from 2017: the transformer. How attention works, what queries, keys and values do, and why long prompts cost more.

Nov 1, 20262 min read
AI Explained

AGENTS.md and CLAUDE.md

Your coding agent keeps running the wrong test command because nobody told it the right one. AGENTS.md is a README for agents. Here's what to put in it.

Oct 31, 20261 min read
AI Explained

LLM evals: tests for AI apps

You changed one line in your prompt. Is your AI app better or worse? Without evals you're guessing. How to build tasks, trials and graders that tell you.

Oct 31, 20262 min read
AI Explained

LLM guardrails: checks around your AI app

Your support bot promised a customer a full refund. Who let it? Guardrails are checks on input, output and tool calls that catch problems before they cause damage.

Oct 31, 20262 min read
AI Explained

LLM-as-a-judge

Your chatbot wrote 10,000 answers today. Who grades them? Another model. How LLM-as-a-judge works, its biases, and how to check the grader.

Oct 31, 20262 min read
AI Explained

Agent memory: how AI agents remember

You told your agent your name yesterday, and today it asks again. How short-term and long-term agent memory work, and how to build memory safely.

Oct 30, 20262 min read
AI Explained

Agent-ready websites with llms.txt

Can AI agents actually understand your website? llms.txt is one markdown file that tells them what's worth reading. Here's the format and how to add it.

Oct 30, 20261 min read
AI Explained

Computer-use agents: AI that uses your screen

What if AI could use a computer like you do? Computer-use agents look at the screen, then click and type. How they work, where they fail, and how to run them safely.

Oct 30, 20262 min read
AI Explained

Context engineering for AI agents

Your agent got worse the longer it worked? It's usually the context, not the model. How to choose what goes into the window on every step.

Oct 30, 20262 min read
AI Explained

Prompt injection: how AI agents get hijacked

Your AI agent reads a web page and gets hijacked. What prompt injection is, why models fall for it, and the defenses that limit the damage.

Oct 30, 20262 min read
AI Explained

AI hallucinations: why models make things up

Why does AI sometimes state false things with total confidence? What hallucinations are, why training rewards guessing, and practical ways to cut them down.

Oct 29, 20262 min read
AI Explained

Embeddings: meaning you can measure

How does AI know "dog" and "puppy" mean almost the same thing? Embeddings turn text into vectors, so similar meanings land close together.

Oct 29, 20262 min read
AI Explained

Reasoning models: AI that thinks before it answers

Some AI models stop and think before answering. How reasoning models work, what thinking tokens cost, how to set the effort, and when to use them.

Oct 29, 20262 min read
AI Explained

Context window: the model's working memory

Why does a long AI chat forget the beginning? Meet the context window: everything a model can see at once, measured in tokens, and why bigger isn't always better.

Oct 28, 20262 min read
AI Explained

Don't store JWTs in localStorage

Any script on your page can read localStorage, so one XSS bug can steal your users' tokens. Store auth tokens in HttpOnly, Secure, SameSite cookies instead.

Oct 28, 20262 min read
AI Explained

Human-in-the-loop for AI agents

Would you let an AI agent refund customers on its own? Human-in-the-loop pauses the agent before risky actions so a person can approve, edit or reject.

Oct 28, 20262 min read
AI Explained

Tokens: how AI actually reads text

AI models don't read words, they read tokens. What a token is, why 100 tokens is about 75 words, and how tokens set both your bill and your limits.

Oct 28, 20262 min read
AI Explained

Function calling: how AI uses tools

Language models only write text. Function calling lets them ask your code to run a tool, like a weather API, and answer with real data.

Oct 27, 20261 min read
AI Explained

Multi-agent systems

When one AI agent gets overloaded, give it a team. How a lead agent splits work across specialist subagents, and what it costs in tokens.

Oct 27, 20262 min read
AI Explained

AI agent vs chatbot

A chatbot answers. An agent acts: it plans, uses tools and checks each result until the job is done. Here's the difference, and when you need each.

Oct 26, 20262 min read
AI Explained

Local AI: run a model on your own laptop

Your laptop can run its own AI model, fully offline. How local AI works, why 4-bit quantization makes it fit, and where cloud models still win.

Oct 26, 20262 min read
AI Explained

A2A: the Agent2Agent protocol

MCP connects an agent to tools. A2A connects agents to each other, so agents built by different teams and vendors can find each other and share work.

Oct 25, 20262 min read
AI Explained

Agent Skills and SKILL.md

Agent Skills are folders of instructions, scripts and resources that an AI agent loads only when a task needs them. Here's how SKILL.md and progressive loading work.

Oct 25, 20262 min read
AI Explained

AX: agent experience

We design for user experience and developer experience. AX, agent experience, is designing products that AI agents can use well. Here's what that means in practice.

Oct 25, 20262 min read
AI Explained

MCP: the Model Context Protocol

MCP is an open standard that connects AI apps to tools and data. Build a connector once, and any MCP-compatible AI app can use it. Here's how it works.

Oct 25, 20262 min read
AI Explained

RAG: retrieval-augmented generation

Models only know what they were trained on. RAG looks up the right facts from your own documents first, then has the model answer from them.

Oct 25, 20262 min read