# Ai Foundations
All Ai Foundations notes →1. The Evolution of Artificial Intelligence
Traces the arc from symbolic AI and expert systems through statistical ML, deep learning, and the scaling-law-driven emergence of foundation models, framing why agentic AI is the current inflection point rather than a fresh discipline.
2. Machine Learning Fundamentals
Covers supervised vs. unsupervised vs. reinforcement learning, the bias-variance tradeoff, loss functions, and gradient descent as the fundamentals that still govern how modern LLMs are trained and fine-tuned.
3. Deep Learning Essentials
Covers neural network building blocks — layers, activation functions, backpropagation, regularization, and optimizers — as the substrate transformers are built on, explained from first principles for a staff-level interview bar.
4. Transformer Architecture
Breaks down the encoder-decoder transformer — self-attention, multi-head attention, positional encoding, and feed-forward blocks — and why this architecture displaced RNNs and LSTMs as the default for sequence modeling at scale.
5. Tokens, Embeddings & Attention
Explains how raw text becomes tokens, how tokens become dense embedding vectors, and how the attention mechanism computes contextual relevance between them — the three concepts most commonly conflated in interview answers.
6. Context Windows & Tokenization
Covers tokenizer algorithms (BPE, WordPiece, SentencePiece), context window sizing and its quadratic attention-cost tradeoff, and practical strategies — chunking, sliding windows, summarization — for working within a fixed context budget.
7. Foundation Models
Defines what makes a model foundational — pretraining scale, transfer learning, and emergent capabilities — and surveys major foundation model families and the positioning tradeoffs between them.
8. Large Language Models
Covers the LLM training pipeline end to end — pretraining, supervised fine-tuning, and RLHF/DPO alignment — and the resulting capability, cost, and latency tradeoffs an architect weighs when picking a model for production.
9. Reasoning Models
Covers chain-of-thought and inference-time compute scaling in reasoning models, how they differ architecturally and operationally from standard next-token LLMs, and when the added latency and cost is actually justified.
10. The AI Ecosystem
Maps the current AI ecosystem — model providers, orchestration frameworks, vector databases, evaluation tooling, and inference infrastructure — as the landscape an agentic system architect has to navigate.
1. Prompt Engineering Fundamentals
Covers the core levers of prompt construction — instruction clarity, few-shot exemplars, system vs. user role separation, and sampling controls — as the baseline skill every downstream agentic technique builds on.
2. Prompt Design Patterns
Catalogs reusable prompt patterns — chain-of-thought, ReAct, self-consistency, and role/persona framing — with guidance on when each pattern earns its added token cost over a plain instruction.
3. Structured Outputs
Covers forcing an LLM into a validated schema — JSON mode, function-calling-style schemas, and grammar-constrained decoding — and the failure modes, like schema drift and hallucinated fields, that break naive implementations.
4. Function Calling
Covers how models select and populate function signatures from natural language, the request/response contract between model and application, and common pitfalls like parameter hallucination and ambiguous selection.
5. Tool Calling
Extends function calling into multi-tool agent design — tool registries, tool-choice strategies, parallel vs. sequential invocation — and how tool descriptions themselves become part of the prompt-engineering surface.
6. Streaming Responses
Covers server-sent events and token-streaming architectures for LLM responses, the UX and backpressure tradeoffs versus batch responses, and how streaming interacts with structured-output and function-calling validation.
7. Model Selection & Routing
Covers building a model router that picks among providers and tiers by task complexity, latency SLA, and cost — the pattern that replaces always calling the biggest model once traffic reaches production scale.
8. Hallucination Management
Covers the mechanisms behind LLM hallucination — parametric knowledge gaps, exposure bias, overconfident sampling — and mitigation strategies like grounding via RAG, citation requirements, and confidence-calibrated refusal.
9. AI Failure Modes
Surveys production failure modes beyond hallucination — prompt injection, context poisoning, tool-call loops, silent schema violations, and cascading errors in multi-agent chains — as the taxonomy a staff engineer defends against.
10. Building Reliable LLM Applications
Covers the engineering practices that turn a probabilistic model call into a reliable system component — retries with validation, evals as CI gates, circuit breakers, and observability for non-deterministic outputs.
11. Probability, Sampling & Decoding
The math intuition underneath every model call — how a raw logit vector becomes a probability distribution, why temperature and top-p reshape that distribution differently, why beam search lost to sampling for chat and agent models, and how entropy and KL divergence turn 'the model is uncertain' and 'alignment training' into something you can actually reason about.
12. Vector Geometry & Similarity
The geometric intuition behind embeddings -- cosine similarity as angle versus Euclidean distance as magnitude, why unnormalized dot products silently bias search, and why high-dimensional spaces make naive nearest-neighbor search break down.
AI & LLM Foundations
A book-shaped table of contents for AI & LLM Foundations: the pre-agentic substrate — symbolic AI through transformers, tokens, embeddings, attention, foundation models, and turning a raw LLM API into a dependable application component. Book 1 of the AI Systems Engineering series.