Ai-concepts-index
AI Engineering Concepts

Plain-English answers to the questions every AI engineer keeps getting asked.

A growing reference library for the patterns that actually show up in production LLM systems: tokens and cost math, prompting as code, RAG and retrieval, agents and tool use, evaluation, and the production layer (latency, caching, routing, security, observability). Use it alongside the roadmap, or as a quick lookup before an interview.

70Topics
7Sections
70Live now
70 of 70 topics

Foundations: working with LLMs

11 topics
#1 Live

Tokens and the context window: the unit and the budget

Models do not see characters or words. They see tokens, and the context window is the budget you have to spend on them.

#2 Live

The model is not the chat product

ChatGPT and Claude.ai do a lot of work the raw model does not. Knowing the difference saves you from reinventing it badly.

#3 Live

System, user, assistant: the three roles in every chat call

Every API call is a list of role-tagged messages. The roles are not decoration; the model treats each one differently.

#4 Live

Temperature, top-p, top-k: three knobs people keep confusing

Three sampling parameters with overlapping effects. Only two of them earn their place in production.

#5 Live

Streaming vs blocking: the UX trick that changes nothing about cost

Streaming makes your AI feature feel twice as fast without changing the work the model does.

#6 Live

Token cost math: estimating the bill before you ship

Input tokens and output tokens cost different amounts. Five minutes with a calculator avoids most cost surprises.

#7 Live

TTFT vs total latency: two numbers, two different problems

Total latency is what the bill cares about. Time-to-first-token is what the user feels.

#8 Live

Embeddings and cosine similarity: turning text into a number you can compare

An embedding is a vector. Cosine similarity asks 'do these two vectors point the same way?' That is the whole story behind half of modern AI search.

#9 Live

Picking a model: the honest map of the big four

Claude, GPT, Gemini, Llama. Each one is strong somewhere and weak somewhere else. There is no universally right pick.

#10 Live

Rate limits, retries, and backoff: the boring layer that keeps you online

Every provider has limits. The difference between a flaky feature and a reliable one is a hundred lines of retry logic.

#11 Live

Playground vs production: why the prompt that worked breaks in code

Provider playgrounds quietly do five things your code does not. Knowing which ones saves a day of debugging.

Prompting as engineering

12 topics
#12 Live

System prompts that earn their tokens

A good system prompt costs 200 tokens and changes the whole feature. A bad one costs 3000 tokens and still does not work.

#13 Live

Few-shot examples: when 3 beats 0 and when 0 beats 3

Showing the model 3 to 5 examples can lift quality more than a bigger model. Sometimes it does nothing and costs you tokens.

#14 Live

Chain of thought: when reasoning out loud helps and when it just doubles the cost

Asking the model to think step by step can lift accuracy on hard tasks. It can also double your bill on easy ones.

#15 Live

Structured outputs: stop parsing model text yourself

Asking for JSON in the prompt is the old way. JSON mode and structured outputs make the model produce valid shapes by construction.

#16 Live

Schemas and validation: shapes that protect both sides

A good schema is more than 'object with three fields'. It is the contract that tells the model and your code what is allowed.

#17 Live

Multi-turn conversation: keeping state without going broke

Every turn ships the whole history. By turn 50, you are sending 30k tokens of context. Three patterns keep it sane.

#18 Live

Prompt versioning: prompts are code

If your prompt lives in a Google Doc, the next change will break a feature and no one will know which one.

#19 Live

Hallucination: what it really is and how to fight it

The model is not lying. It is doing exactly what it was trained to do: predict the next plausible token. Knowing why helps you stop it.

#20 Live

Refusal and over-refusal: when the model says 'I cannot help with that'

Models refuse for two reasons: real safety policy and an overcautious guess. The second one breaks features more often than the first.

#21 Live

Truncated and malformed JSON: when the brace never closes

Even with structured outputs, JSON can fail. Token limits, network drops, edge cases. Three patterns make it survivable.

#22 Live

Off-topic drift: when the model answers the wrong question

A user asks about taxes. Three turns later the assistant is recommending stretching exercises. Drift has a cause and a fix.

#23 Live

Cost-aware prompt design: writing prompts that do not blow the budget

Prompt design is half quality, half cost. Most teams optimize for quality and ignore cost until the bill arrives.

RAG and retrieval

10 topics
#24 Live

Picking an embedding model: the choice that shapes the whole RAG

Three numbers matter: quality on your domain, dimensions, and cost. Get this wrong and every other RAG fix is fighting the wrong battle.

#25 Live

Chunking text: the size and shape problem

How you cut up a document decides what your model gets to read. There is no universal right size, but there are wrong ones.

#26 Live

Sliding window chunking: small chunks with neighbour context

Search at fine resolution, answer with surrounding context. The sliding window pattern gets you both.

#27 Live

Hierarchical chunking: match the child, send the parent

Embed small pieces, but feed the model the bigger sections they belong to. Often the cleanest pattern for structured documents.

#28 Live

Picking a vector database: the five real options

Pinecone, Weaviate, Qdrant, pgvector, FAISS. Each fits a different shape of project. Most teams pick wrong.

#29 Live

pgvector: when 'we already have Postgres' is the right answer

For most non-enterprise RAG, pgvector is the boring answer that works. Here is how to set it up and where the limits show up.

#30 Live

Hybrid search: vectors plus keywords

Vector search loses on exact terms. Keyword search loses on meaning. Hybrid wins both ways.

#31 Live

Reciprocal rank fusion: combining lists without tuning

A tiny formula that combines ranked lists from different sources without worrying about score scales. The senior default for hybrid retrieval.

#32 Live

Reranking with cross-encoders: the second pass that fixes retrieval

Retrieve 20 candidates fast. Rerank to top 4 with a smarter model. The cheapest large quality lift in RAG.

#33 Live

Top-K and recall: how to pick K and measure if you got it right

Top-5 vs top-10 looks like a small choice. It shapes cost, latency, quality, and what your model can see.

Agents and tool use

5 topics

Evaluation

8 topics

Production AI systems

14 topics
#47 Live

Streaming UX: perceived latency, partial rendering, when to start the stream

Streaming UX: perceived latency, partial rendering, when to start the stream

#48 Live

Provider-side prefix caching: free wins on long system prompts

Provider-side prefix caching: free wins on long system prompts

#49 Live

Semantic caching: embed the query, look up similar past answers

Semantic caching: embed the query, look up similar past answers

#50 Live

Model routing: cheap-and-fast vs smart-and-expensive with a classifier

Model routing: cheap-and-fast vs smart-and-expensive with a classifier

#51 Live

Output length caps and token trimming: keeping bills bounded

Output length caps and token trimming: keeping bills bounded

#52 Live

Open vs closed models: when self-hosting actually pays off

Open vs closed models: when self-hosting actually pays off

#53 Live

Self-hosted LLM serving: vLLM, TGI, Ollama, the honest comparison

Self-hosted LLM serving: vLLM, TGI, Ollama, the honest comparison

#54 Live

Prompt injection defences: layered, never trust user input

Prompt injection defences: layered, never trust user input

#55 Live

Output validation before side effects: the 'never let the model delete' rule

Output validation before side effects: the 'never let the model delete' rule

#56 Live

PII redaction and data residency: keeping the LLM out of the audit log

PII redaction and data residency: keeping the LLM out of the audit log

#57 Live

LLM tracing and observability: end-to-end spans across model calls

LLM tracing and observability: end-to-end spans across model calls

#58 Live

Failover and circuit breakers: routing around a down provider

Failover and circuit breakers: routing around a down provider

#59 Live

Fine-tuning, only when needed: LoRA, QLoRA, the synthetic-data trap

Fine-tuning, only when needed: LoRA, QLoRA, the synthetic-data trap

#60 Live

Cost attribution per request, per user, per feature

Cost attribution per request, per user, per feature

Interview craft

10 topics