Foundations

What the role is, how the models work, and the vocabulary everything else assumes.

Sign in to track your progress across sections.

Courses in this topic

47 articles

What is an AI Engineer?

Listed inWhat is an AI Engineer?Foundationson

A single support-reply feature, taken through the failures it hits in production: supplying a refund policy, grounding replies in help-center articles, structuring output for a ticket tool, and handling prompt injection in customer email. The role is the engineering around the model call.

Guide
Beginner5 min
#career

Inference

Listed inInferenceFoundationson

What happens between your request and the answer: time to first token against total response time, why output length drives latency, where token costs accumulate, and the inference failures to handle in code.

Guide
Beginner5 min
#concepts

Impact on Product Development

Listed inImpact on Product DevelopmentFoundationson

Because the same input can produce different output, testing, cost, latency and failure handling all change shape. A feature also inherits its model's published retirement date, which makes migration scheduled work rather than a surprise.

Guide
Beginner8 min
#product

Training

Listed inTrainingFoundationson

Pre-training, post-training, and RLHF — the parts you rarely do but always need to reason about.

Guide
Intermediate7 minDraft
#concepts

Large Language Models (LLMs)

Listed inLarge Language Models (LLMs)Foundationson

What goes into a request, what the model holds while answering, and what comes back. The context window is a shared budget for input and output, and some model limits can be fixed while others have to be designed around.

Guide
Beginner4 min
#concepts

AI vs AGI

Listed inAI vs AGIFoundationson

Today's models have no memory between requests, a window that degrades well before its limit, a knowledge cutoff, and no way to check their own output. Your architecture is largely a response to those four, and blurring the line produces promises you cannot keep.

Guide
Beginner4 min
#concepts

Stop estimating tokens

Listed inTokensFoundationson

Character and word counts disagree with real token counts, which is a problem because every limit you hit is counted in tokens. How byte pair encoding splits text, and how to budget a request so a response is not cut off mid-sentence.

Guide
Beginner6 min
#fundamentals
#cost

Prompt caching

Listed inPrompt CachingFoundationson

How cache breakpoints work, what invalidates a prefix, and the latency and cost numbers to expect.

External
Anthropic · platform.claude.com
#cost
#latency

Tokens

Listed inTokensFoundationson

The unit models actually read and bill for, and why character counts mislead you.

Guide
Beginner5 minDraft
#fundamentals
#cost

Fine-tuning

Listed inFine-tuningFoundationson

The documented benefits are about behavior and format rather than knowledge. Fine-tuning shapes how a model responds; retrieval is what gives it facts it did not train on.

Guide
Advanced4 min
#llm-internals

Pre-trained Models

Listed inPre-trained ModelsFoundationson

There are two cutoff dates, not one, and the gap between them is where a model is most confidently wrong. Plus which symptom each stage explains.

Guide
Beginner7 min
#fundamentals

Top-K

Listed inTop-KFoundationson

A fixed count applied to a distribution whose shape keeps changing. OpenAI never exposed it and Anthropic now returns a 400 for it.

Guide
Intermediate5 min
#sampling

Temperature

Listed inTemperatureFoundationson

The randomness dial: what it does to the distribution, and sane defaults per task.

Guide
Beginner4 minDraft
#sampling

Context Window

Listed inContext WindowFoundationson

Input and output come out of one budget, so a request that fits can still fail partway through writing. Cached tokens change what you pay, not how much room they take.

Guide
Beginner4 min
#fundamentals
#context

Prompt Caching

Listed inPrompt CachingFoundationson

A cache read costs a tenth of base input on most Claude models, and a date in the system prompt switches the whole thing off. Below the per-model minimum, caching is skipped and no error is returned.

Guide
Intermediate4 min
#cost
#latency

Types of Models

Listed inTypes of ModelsFoundationson

Base, instruction-tuned, reasoning, embedding and multimodal models answer different shapes of question, and reaching for the wrong kind costs more than picking the wrong member of the right one. Ask what shape the output is before asking which model is best.

Guide
Beginner4 min
#fundamentals

Repetition Penalties

Listed inRepetition PenaltiesFoundationson

`frequency_penalty` scales with how often a token has appeared and `presence_penalty` does not, so they answer different complaints. Both usually treat a symptom whose cause is an ambiguous prompt, a degrading context, or an agent with no stopping condition.

Guide
Intermediate4 min
#sampling

How LLMs Work

Listed inHow LLMs WorkFoundationson

Next-token prediction, attention, and the path from raw text to a streamed response.

Guide
Intermediate9 minDraft
#fundamentals

Top-P

Listed inTop-PFoundationson

Nucleus sampling — trimming the tail by probability mass instead of by rank.

Guide
Intermediate4 minDraft
#sampling

Google Gemini

Listed inGoogle GeminiFoundationson

Images, audio and video travel in the request and are billed as input tokens, at different per-second rates for audio and video. The same models are reachable through the Gemini Developer API and through Google Cloud, which differ in the platform around them rather than in capability.

Reference
Beginner4 min
#providers
#multimodal

Self-Hosted Models

Listed inSelf-Hosted ModelsFoundationson

Sizing a GPU for a self-hosted model means budgeting for more than the weights. The KV cache grows with concurrency, and exhausting it preempts in-flight requests that are then recomputed from the start.

Reference
Advanced5 min
#infrastructure
#cost

Qwen

Listed inQwenFoundationson

Apache 2.0, over 100 languages, dense and mixture-of-experts across a wide size range. Why tokenizer coverage shows up in your bill.

Reference
Intermediate3 min
#providers
#open-weights

Choosing the Right Model

Listed inChoosing the Right ModelFoundationson

Compare models on capability, latency, cost per request, context window, maximum output, and where they can run. Price per million tokens is not cost per request, and twenty saved examples from your own application settle the choice faster than a leaderboard.

Reference
Beginner7 min
#selection

Cohere

Listed inCohereFoundationson

Reranking scores the query and document together instead of comparing two vectors, which is why it goes second and not first.

Reference
Intermediate6 min
#providers

OpenRouter

Listed inOpenRouterFoundationson

One endpoint makes changing your mind cheap. The training opt-out governs the providers, not the router, and retention is not routed on at all.

Reference
Intermediate5 min
#routing

Meta Llama

Listed inMeta LlamaFoundationson

Downloadable weights come under a custom licence rather than Apache or MIT. It requires a "Built with Llama" notice, a model name beginning with Llama, and a separate agreement above 700 million monthly active users.

Reference
Intermediate3 min
#open-weights

Ollama

Listed inOllamaFoundationson

One command pulls a packaged build and serves it, which means a quantization was chosen for you. Compatible client surfaces let existing code point at it, and a single-user local runner is no evidence about serving traffic.

Reference
Beginner3 min
#local

Transformers.js

Listed inTransformers.jsFoundationson

Models run in the browser with no backend and no request leaving the page, which settles the privacy question outright. The cost nobody accounts for is the first load, where model size is page weight and quantization stops being optional.

Reference
Advanced4 min
#ecosystem
#browser

Anthropic Claude

Listed inAnthropic ClaudeFoundationson

Every model ID is a pinned snapshot, so nothing changes under a working system and improvements are an upgrade you perform. Extended thinking is not accepted on current models, and the tokenizer change at Opus 4.7 makes older capacity estimates wrong by about a quarter.

Reference
Beginner4 min
#providers

Gemma

Listed inGemmaFoundationson

Google's open weights, taking text, audio and image input on hardware you own, which removes both the per-image token bill and the media leaving your network. Three variants do different jobs, and treating Gemma as one model misses most of it.

Reference
Intermediate4 min
#open-weights

Hugging Face Tasks

Listed inHugging Face TasksFoundationson

A task describes the shape of a model's API rather than its subject, so two models sharing one are interchangeable at the call site. That makes it the first filter and never the last, since the label says nothing about quality.

Reference
Beginner4 min
#ecosystem

Closed vs Open Source Models

Listed inClosed vs Open Source ModelsFoundationson

Open weights is not open source, and the licence rules out more cases than the benchmark does. Data residency and a frozen model are the arguments that hold, while cost favours running it yourself only above a utilization line most workloads sit below.

Reference
Beginner4 min
#selection

DeepSeek

Listed inDeepSeekFoundationson

Prices halve outside peak hours, and cache hits land at $0.003 per million input tokens, two orders of magnitude below the miss rate. The naming inverts the usual intuition: the cheaper model is the one that reasons.

Reference
Intermediate4 min
#open-weights

Hugging Face Hub

Listed inHugging Face HubFoundationson

Every repository is git, which means you can pin a revision and most code does not. Loading a model by name gets whatever the main branch holds today, and the symptom is output drifting with no diff in your own repository.

Reference
Beginner4 min
#ecosystem

Mistral

Listed inMistralFoundationson

Apache 2.0 open weights from 3B to large, which is the difference that decides it for teams whose legal review stalled on Llama's conditions. Read the licence per model though: the catalogue mixes Apache, modified MIT, commercial and one that prohibits commercial use.

Reference
Intermediate4 min
#open-weights

LM Studio

Listed inLM StudioFoundationson

What Ollama does from a terminal, in a desktop application, which is a different adoption curve for anyone comparing five models before committing. On Apple Silicon the MLX backend is the reason it comes up so often.

Reference
Beginner4 min
#local