To understand ChatGPT completely, the architecture is split into two foundational pillars: Phase 1: Model Training (how the model learns weights from billions of tokens) and Phase 2: Inference (how fixed weights process prompts and stream answers).
During Training, backpropagation calculates gradients and continuously modifies billions of parameters ($W_E, W_Q, W_K, W_V, W_O, W_{FFN}$). Once aligned and quantized, these weights are serialized into static tensors (e.g. GGUF / SafeTensors). During Inference, weights are frozen, and the engine runs pure forward passes with dynamic KV-caching.
"Charan" → [4125]"pla" + "nted" → "planted")| Dimension | 🏛️ Model Training (Phase 1) | ⚡ Model Inference (Phase 2) |
|---|---|---|
| Primary Goal | Learn language patterns, facts, world models, and alignment | Process user prompt and generate an accurate response |
| Model Weights ($\Theta$) | Mutable — continuously updated via gradient descent | Frozen / Static — fixed parameters, read-only memory |
| Computation Direction | Forward + Backward Pass (Backpropagation) | Forward Pass Only (No gradients stored) |
| Optimization Objective | Calculates Cross-Entropy Loss ($\mathcal{L}$) vs ground-truth targets | Calculates Next-Token Probability distribution over $|V|$ |
| Algorithmic Engine | Optimizers (AdamW, Adafactor) + Learning Rate Schedulers | Decoding strategies (Greedy, Temperature, Top-K, Top-P) |
| Hardware & Scaling | Clusters of thousands of GPUs (H100/A100) running weeks/months | Single GPU / Server nodes running real-time streaming in milliseconds |
| Memory Management | Activation checkpointing, optimizer states, gradient buffers | KV-Cache (PagedAttention) storing past Keys and Values |
| Execution Timing | During model development (offline, before user interaction) | During live user query (online, interactive real-time) |
| Primary Output | Trained checkpoint tensor file (`model.safetensors`) | Generated text answer, code snippet, or tool call |
| Shared Component | ✦ Tokenization (BPE) is shared across both phases. The model learns its weights during training and reuses the exact same vocabulary table during inference. | |
OOP, generators, decorators, typing, PyTorch tensors & CUDA basics.
Multivariable calculus, partial derivatives, chain rule & gradient descent.
Matrix multiplications, dot products, eigenvalues, distributions, Bayes rule.
Supervised vs unsupervised learning, loss functions, overfitting, regularization.
Multi-layer perceptrons, activation functions (ReLU, GELU, SwiGLU), PyTorch autograd.
N-grams, TF-IDF, Word2Vec, RNNs, LSTMs, and sequence-to-sequence bottlenecks.
BPE, WordPiece, vocabularies, embedding tables, cosine vector geometry.
Attention is All You Need, encoder-decoder vs decoder-only, residual stream.
Scaled dot-product, causal masking, Multi-Head (MHA), Multi-Query (MQA), GQA.
GPT-2/3/4, LLaMA topology, RMSNorm, SwiGLU, RoPE rotary positional embeddings.
Next-token loss, Cross-Entropy, AdamW, distributed 3D parallelism (Megatron-LM).
Instruction tuning, chat templates, LoRA / QLoRA parameter-efficient tuning.
Reward models, PPO reinforcement learning, Direct Preference Optimization.
Logits, temperature, top-k, top-p, beam search, KV-cache acceleration.
Embedding models, chunking, Pinecone / Milvus / Qdrant, reranking, hybrid search.
Benchmarks (MMLU, GSM8K), red-teaming, guardrails, jailbreak prevention.
FP16 $\to$ INT8/INT4, AWQ, GPTQ, GGUF, FlashAttention, speculative decoding.
vLLM, TensorRT-LLM, TGI, SGLang, continuous batching, production API gateways.
public/ai-journey/roadmap/ Structureroadmap/ submodules
All authoritative technical content lives in public/ai-journey/roadmap/ across 30+ dedicated topical modules. Here is the direct alignment showing how the 14 Training Stages, 11 Inference Stages, and 18-Step Curriculum map to the real files inside roadmap/: