Engineering Notes

In-depth technical writing on AI architecture, large language models and deep learning systems, organised as a learning path.

Orientation · Module 01 · The Big Picture

See how LLMs, the infrastructure they run on and the security around them work end to end; the deep-dive modules then open up each part of this map.

  1. An LLM, End to End — tokens, transformer, training, inference, and why it makes things upEvery part of an LLM in one read, from tokens and attention to training, inference and why models make things up.16 min read
  2. AI Infrastructure, End to End — From Silicon to Supercomputers, The Physical Lifecycle of a TensorFrom silicon microarchitecture to a 16,384-GPU supercomputer: SMs, memory walls, 4D parallelism, failures, and the 20-Megawatt data center bill in one panoramic read.25 min read
  3. AI Security, End to End — Beyond Filters: Deterministic Boundaries and Provable Defense ArchitectureFollow one hidden instruction inside a customer ticket through an AI assistant and see why filters break, how deterministic boundaries stop harm, and how safety is proven before release.58 min read

Foundations · Module 02 · Building Blocks of Neural Networks

The five pieces that make a neural network trainable: activations, losses, backpropagation, optimizers and normalization.

  1. Activation Functions — the geometry of non-linearity, vanishing gradients, and the SwiGLU revolutionWhy layers collapse into a single matrix without non-linearity, and the road from ReLU to SwiGLU.18 min read
  2. Loss Functions — the geometry of error, Log-Sum-Exp stability, and the Cross-Entropy simplificationWhy MSE fails for classification, how the Cross-Entropy gradient simplifies to p − y, and the Log-Sum-Exp trick that keeps it stable.20 min read
  3. Backpropagation and Autodiff — computational graphs, activation memory, and chain rule anatomyHow the chain rule runs over a computation graph, and why backpropagation fills memory with activations.20 min read
  4. Optimization Algorithms — SGD oscillations, the AdamW paradox, and the Muon revolutionWhy SGD oscillates in narrow ravines, why AdamW decouples weight decay and what Muon changes, worked out step by step.22 min read
  5. Weight Initialization and Normalization — Xavier, Kaiming, LayerNorm, and RMSNorm mathematicsHow Xavier and Kaiming initialization, LayerNorm and RMSNorm keep the signal alive through a deep network, shown with the variance arithmetic.20 min read

Architecture · Module 03 · A Prompt's Journey

Follow a prompt step by step, from the tokenizer through the transformer block to the final output layer.

  1. Tokenization — from text to integers, BPE mechanics, and fertilityHow text becomes integers before it reaches the model, how BPE builds its vocabulary, and why some languages spend more tokens.12 min read
  2. The Embedding Layer — from token IDs to continuous vectors, lookup tables, and RoPEThe lookup table that turns token IDs into vectors, the weights it shares with lm_head, and where RoPE comes in.16 min read
  3. Semantic Embeddings — the coordinates of meaning, cosine distance, and HNSW search spaceHow a sentence becomes a single point in meaning space, what cosine similarity really tells you, and how HNSW finds neighbours fast.11 min read
  4. Inside Self-Attention — Q, K, V mechanics, step-by-step matrix arithmetic, and context vectorsWhy Q, K and V are kept separate, computed by hand on a three-word example without skipping a step.18 min read
  5. Inside Causal Attention — The Arrow of Time, Lower Triangular Matrices, and the Math of the VoidHow the mask matrix lets each token look only at the past, and why training depends on it.22 min read
  6. Inside Multi-Head Attention — subspaces, symmetry breaking, and head pruningHow heads split the model dimension into subspaces to track different relationships in parallel, and which of them can be pruned.18 min read
  7. The Transformer Block — the gradient highway, the convex hull, and FFN associative memoryHow residual connections, normalization and the FFN work together inside a single transformer block.22 min read
  8. The Output Layer (LM Head) — Logits, the Memory Wall, Megatron-LM, and Speculative DecodingHow the hidden vector from the final transformer block becomes a word on the screen, smashing the memory wall and accelerating inference.24 min read
  9. Inside the Context Window — From the 2K Wall to FlashAttention, RoPE/YaRN, and 2026 Hybrid Mamba ArchitecturesFollow the context window from the 2K wall through FlashAttention, RoPE/YaRN, and into 2026 hybrid Mamba topologies and hardware memory walls.26 min read

Systems · Module 04 · LLM Systems in Production

What it takes to keep an LLM fast and affordable in production, from cost and latency down to the vLLM engine.

  1. Cost & Latency Anatomy — TTFT, TPOT, prompt caching, and model routingHow to bring down the bill and the latency of LLM calls with TTFT and TPOT metrics, prompt caching and model routing.18 min read
  2. Inside the vLLM Engine — continuous batching, prefix caching, and KV memory managementHow vLLM pages KV memory into blocks, and how continuous batching and the prefix cache work, traced from inside the engine.14 min read

Systems · Module 05 · From Prompting to Autonomous Agents

From prompting techniques to an agent's system prompt and its long-term memory.

  1. Reasoning & Prompting — Chain-of-Thought, ReAct, and the era of reasoning modelsWhere techniques such as Chain-of-Thought and ReAct still earn their place now that models reason on their own.6 min read
  2. Anatomy of an Agent Prompt — system contracts, tool boundaries, and 8 building blocksBuilding an agent's system prompt as a contract of eight blocks, from its role to its tool boundaries.11 min read
  3. Agent Memory — write and read paths, supersession, dreaming, and multi-agent scopeThe system around a stateless model that decides what to remember, what to update and what to forget.35 min read

Systems · Module 06 · RAG & Retrieval Architecture

The retrieval layer, from inside the vector database to RAG patterns that survive production.

  1. Vector Database Architecture — from ANN indexing to metadata filtering and live dataWhat a vector database builds around its ANN index to handle deletes, metadata filtering and live data.11 min read
  2. Production RAG Patterns — diagnosing 4 root failures, HyDE, hybrid search, and rerankingRAG failures fall into four families; this guide picks the fix by symptom, from HyDE to hybrid search and reranking.8 min read

Systems · Module 07 · AI Infrastructure

From GPU silicon to clusters, reading workloads, HBM, interconnects, storage, power, and physical placement as one hardware system.

  1. How Does a GPU Work? — From One SM to 16,384 GPUsFrom single SM silicon to 16,384-GPU clusters, NVLink chassis fabrics to SuperPOD InfiniBand backbones: The physical anatomy of an AI supercomputer.35 min read
  2. How Does an LLM Use a GPU? — Training, Prefill, and DecodeWhy the same GPU reaches different bottlenecks in training, prefill, and decode, explained through KV cache, batching, and production traffic.35 min read
  3. How Do GPUs Work Together? — NVLink, InfiniBand, and ParallelismFollowing data paths from one H100 to a SuperPOD and mapping TP, PP, DP/FSDP, CP, and EP onto the physical topology.35 min read
  4. Why Does an AI Cluster Slow Down? — Storage, Failures, and MFUEvidence-based diagnosis from checkpoint paths and failure recovery to MFU decomposition and observability.35 min read
  5. How Do You Design AI Hardware? — GPUs, Network, Storage, and PowerCombining GPUs, HBM, NVLink, scale-out networking, storage, power, and failure domains into balanced hardware designs for training, fine-tuning, and inference.35 min read
  6. How to Read a GPU Datasheet — Home or Datacenter? The DGX Station (GB300) TeardownHome user or datacenter monster? From the 20 PFLOPS sparsity illusion to the 18x memory cliff and 1,600W wall limits: The DGX Station GB300 teardown.28 min read

Systems · Module 08 · Secure AI by Design

Building one AI assistant layer by layer, from threat model to data, supply chain, guardrails, agents, serving, evaluation and audit evidence.

  1. AI Security Starts at Design — Assets, Principles and OwnersBefore any filter: decide what an AI system protects, which four principles guide its design and who owns each risk.24 min read
  2. Threat Modeling and Trust Boundaries in AI SystemsDrawing the data flow of an AI assistant, marking where untrusted text meets action authority and turning every threat into a tested control.24 min read
  3. Secure AI Data, from Source to DeletionFollowing one complaint through nine copies, finding personal data with checksums and NER, and making deletion actually complete.23 min read
  4. From Model to Dependency — Securing the AI Supply ChainProving that the model, tokenizer, packages and MCP tools you run are exactly the ones you approved, and that loading them cannot run code.22 min read
  5. Prompt Injection — the Trust Boundary Between Data and InstructionsWhy a 99% injection detector still loses to a persistent attacker, and how trust propagation keeps untrusted text from choosing actions.23 min read
  6. Layered Guardrails — Rules, NLP, Classifiers and Small ModelsSeparating findings from decisions, choosing between regex, NER, classifiers, safety SLMs and LLM judges, and setting thresholds from real base rates.21 min read
  7. RAG and Memory Security — Authorized Access to the Right KnowledgeKeeping a RAG index from becoming a side door: permissions inside the vector query, trust-separated collections and a memory write path with quarantine.26 min read
  8. Least Privilege and Safe Tool Use for AI AgentsPutting least privilege where agents act: an executor that holds the credentials, delegated permissions as intersections, and approvals bound to exact parameters.24 min read
  9. Secure AI Serving — from API Gateway to Model ServerMaking the gateway the only path to the model: closed vLLM endpoints, guarded fallbacks, streaming holdback and acceptance tests for every bypass.21 min read
  10. Measuring AI Security — Red Teaming and Turkish EvaluationTurning '98% of attacks blocked' into evidence: paired test cases, native Turkish sets, clean data splits, confidence intervals and a judge measured against humans.19 min read
  11. Observability and Incident Response for AI OperationsRecording every AI decision with its versions, keeping telemetry from becoming a second leak, and preparing the levers that contain an incident in minutes.17 min read
  12. From Standards to Evidence — Making AI Security AuditableReplacing 'we are compliant and secure' with an evidence chain from requirement to residual risk, and a go-live decision someone can sign.18 min read

Loading articles…