Machine Learning Engineering Foundations
curated by arun · 19 sources · public
Guide
Compiled from 19 sources on 2026-09-11
Machine Learning Engineering Foundations
Large language models and neural networks rely on foundational concepts spanning data preprocessing, tokenization, architecture design, and training mechanics. Understanding these engineering principles clarifies how modern artificial intelligence systems process information and learn from massive datasets.
Data Preprocessing and Tokenization
Production-grade language models begin with extensive data collection and curation, such as processing internet text down to 44 terabytes of disk space for datasets like FineWeb [1]. Raw documents undergo URL filtering to remove malware and spam, HTML tag extraction, language classification filtering, and the removal of personally identifiable information such as Social Security numbers and addresses [1].
Before neural networks can process text, tokenization converts raw strings into integer sequences [1][3]. Byte Pair Encoding (BPE) handles this by iteratively merging the most common consecutive pairs of bytes or symbols to build a fixed-size vocabulary [1][3]. For example, the GPT-2 tokenizer uses a vocabulary of 50,257 tokens and a context window of 1,024 tokens, while GPT-4 uses a vocabulary of 100,277 symbols [1][3]. Inefficient tokenization—such as how Python code or non-English scripts are handled—can needlessly inflate sequence lengths and exhaust a transformer's context window [3]. Alternatively, simpler models like character-level tokenizers map unique characters (such as the 65 characters in the tiny Shakespeare dataset) directly to integers [4].
Neural Network Architecture and Transformers
Neural networks process inputs through layers of interconnected neurons, parameterized by weights and biases [18][19]. For instance, a basic network for handwritten digit recognition processes 784 input pixels across hidden layers using approximately 13,000 parameters to output 10 digit classes [18][19]. Modern language models scale this massively: GPT-3 contains 175 billion parameters organized into just under 28,000 distinct matrices [14]. Across its 96 distinct multi-layer perceptron (MLP) blocks, GPT-3 devotes roughly 116 billion parameters to feed-forward blocks, with up-projection matrices containing nearly 50,000 rows and 12,288 dimensions [12].
Transformers, introduced in 2017 by Google for translation tasks, process text in parallel using attention operations rather than word-by-word sequences [14][15]. The attention mechanism utilizes query and key matrices to compute dot products that measure the relevance between different words, dividing by the square root of the key-query dimension [13]. Masking sets future token relevance scores to negative infinity before applying softmax to prevent later words from influencing earlier ones during training [13]. A value matrix is then multiplied by token embeddings to generate value vectors, which are combined via attention weights to update contextual meanings [13]. Facts within large language models appear to reside primarily inside these MLP blocks, where matrix multiplications and activation functions like ReLU or GELU mimic logical gates to store associations [12]. Furthermore, hierarchical architectures can draw inspiration from DeepMind's WaveNet, utilizing modular building blocks like custom containers, embeddings, and flattening operations [5].
Training, Loss, and Backpropagation
Model training functions as a lossy compression of large data chunks, where the fundamental driving task is predicting the next word or token in a sequence [1][2]. A cost function calculates the average error or lousiness of a network across training examples, and gradient descent finds the minimum of this function by computing gradient vectors and stepping in the downhill direction [17][18]. To compute these updates efficiently, training data is divided into mini-batches of 100 examples to approximate true gradient descent via stochastic gradient descent [17].
Backpropagation evaluates derivatives of the loss function with respect to internal nodes and weights by recursively applying the chain rule [10][16]. Unscaled weights and biases can cause extreme pre-activations, pushing activation functions like tanh to saturation where local gradients become zero and backpropagation stalls [7]. Batch Normalization serves as a modern solution to stabilize training by mitigating vanishing gradients and high initial loss [6][7]. While modern deep learning relies on automatic differentiation libraries like PyTorch, manual backpropagation through custom compute graphs can be implemented using tensors in NumPy or Python to verify gradients and debug optimization issues [6][10]. Fine-tuning subsequently transforms pre-trained document generators into interactive assistants using specially curated datasets [2].
What is not covered
Hardware infrastructure details such as specific GPU cluster configurations, tensor parallelism deployment strategies across distributed nodes, and commercial API pricing structures are not addressed.
- [1] Deep Dive into LLMs like ChatGPT · https://www.youtube.com/watch?v=7xTGNNLPyMI · fetched 2026-09-11
- [2] [1hr Talk] Intro to Large Language Models · https://www.youtube.com/watch?v=zjkBMFhNj_g · fetched 2026-09-11
- [3] Let's Build the GPT Tokenizer · https://youtu.be/zduSFxRajkE · fetched 2026-09-11
- [4] Let's build GPT: from scratch, in code, spelled out. · https://www.youtube.com/watch?v=kCc8FmEb1nY · fetched 2026-09-11
- [5] Building makemore Part 5: Building a WaveNet · https://youtu.be/t3YJ5hKiMQ0 · fetched 2026-09-11
- [6] Building makemore Part 4: Becoming a Backprop Ninja · https://youtu.be/q8SA3rM6ckI · fetched 2026-09-11
- [7] Building makemore Part 3: Activations & Gradients, BatchNorm · https://youtu.be/P6sfmUTpUmc · fetched 2026-09-11
- [8] Building makemore Part 2: MLP · https://youtu.be/TCH_1BHY58I · fetched 2026-09-11
- [9] The spelled-out intro to language modeling: building makemore · https://youtu.be/PaCmpygFfXo · fetched 2026-09-11
- [10] The spelled-out intro to neural networks and backpropagation: building micrograd · https://youtu.be/VMj-3S1tku0 · fetched 2026-09-11
- [11] But how do AI images and videos actually work? | Guest video by Welch Labs · https://www.youtube.com/watch?v=iv-5mZ_9CPY · fetched 2026-09-11
- [12] How might LLMs store facts | Deep Learning Chapter 7 · https://www.youtube.com/watch?v=9-Jl0dxWQs8 · fetched 2026-09-11
- [13] Attention in transformers, step-by-step | Deep Learning Chapter 6 · https://www.youtube.com/watch?v=eMlx5fFNoYc · fetched 2026-09-11
- [14] Transformers, the tech behind LLMs | Deep Learning Chapter 5 · https://www.youtube.com/watch?v=wjZofJX0v4M · fetched 2026-09-11
- [15] Large Language Models explained briefly - YouTube · https://www.youtube.com/watch?v=LPZh9BOjkQs · fetched 2026-09-11
- [16] Backpropagation calculus | Deep Learning Chapter 4 - YouTube · https://www.youtube.com/watch?v=tIeHLnjs5U8 · fetched 2026-09-11
- [17] Backpropagation, Intuitively | Deep Learning Chapter 3 - YouTube · https://www.youtube.com/watch?v=Ilg3gGewQ5U · fetched 2026-09-11
- [18] Gradient Descent, How Neural Networks Learn | Deep Learning Chapter 2 · https://www.youtube.com/watch?v=IHZwWFHWa-w · fetched 2026-09-11
- [19] But what is a neural network? | Deep learning chapter 1 · https://www.youtube.com/watch?v=aircAruvnKk · fetched 2026-09-11
-
Deep Dive into LLMs like ChatGPT
https://www.youtube.com/watch?v=7xTGNNLPyMI · fetched 2026-09-11 · link_id 2829
This video provides a comprehensive overview of Large Language Model (LLM) AI technology, focusing on the systems that power ChatGPT and similar products. It covers the entire training stack, from data preparation to model development, and offers insights into understanding the 'psychology' of these models and how to use them effectively. The presenter, Andrej Karpathy, a founding member of OpenAI and former Sr. Director of AI at Tesla, aims to increase understanding of state-of-the-art AI and empower users to leverage these tools. The video details pretraining data, tokenization, neural network architecture and internals, inference processes, and the evolution from base models to fine-tuned versions using techniques like supervised fine-tuning and reinforcement learning. It also touches upon challenges such as hallucinations, the role of tokens in model thinking, and the concept of 'jagged intelligence'. The content is made freely available for educational and non-commercial training purposes.
-
[1hr Talk] Intro to Large Language Models
https://www.youtube.com/watch?v=zjkBMFhNj_g · fetched 2026-09-11 · link_id 2828
This video provides a comprehensive, 1-hour introduction to Large Language Models (LLMs), the technology behind systems like ChatGPT. It covers: * **What LLMs are:** Explaining their core concepts, inference, and training processes. * **How they work:** Including fine-tuning into assistants, and the concept of "LLM dreams" (hallucinations). * **Future directions:** Discussing scaling laws, tool use (browsers, calculators, etc.), multimodality, and the potential for LLMs to act as operating systems. * **Security challenges:** Addressing jailbreaks, prompt injection, and data poisoning. The presenter notes that LLMs should not be fully trusted, especially when relying solely on memory, but can be more reliable when using tools like browsing or retrieval. The content is based on a talk given at the AI Security Summit and is available for educational and non-commercial use.
-
Let's Build the GPT Tokenizer
https://youtu.be/zduSFxRajkE · fetched 2026-09-11 · link_id 2827
- The video explains the concept and implementation of a GPT tokenizer, a crucial component in Large Language Models (LLMs) that converts text into tokens and vice-versa. - It covers the Byte Pair Encoding (BPE) algorithm, the training process, and the functions of encoding (string to tokens) and decoding (tokens to string). - The content delves into string manipulation in Python, Unicode, and various byte encodings (ASCII, UTF-8, etc.). - It discusses issues and quirks in LLMs that can be traced back to tokenization and explores potential future directions, including the idea of eliminating tokenization. - Practical implementation is demonstrated using Python, with references to libraries like `tiktoken` and `sentencepiece`. - The video includes exercises and links to code repositories (minBPE) and supplementary resources for hands-on learning.
-
Let's build GPT: from scratch, in code, spelled out.
https://www.youtube.com/watch?v=kCc8FmEb1nY · fetched 2026-09-11 · link_id 2826
This video provides a comprehensive, code-driven explanation of how to build a Generative Pretrained Transformer (GPT), inspired by the "Attention is All You Need" paper and OpenAI's GPT models. It covers the entire process from data loading and tokenization to implementing self-attention mechanisms, multi-headed attention, feedforward layers, residual connections, and layer normalization. The tutorial uses PyTorch and demonstrates building a nanoGPT model, with links to a Google Colab notebook and GitHub repository for the code. It also touches upon the relationship to ChatGPT, pretraining vs. finetuning, and Reinforcement Learning from Human Feedback (RLHF). Suggested exercises are provided for viewers to deepen their understanding and experiment with the concepts.
-
Building makemore Part 5: Building a WaveNet
https://youtu.be/t3YJ5hKiMQ0 · fetched 2026-09-11 · link_id 2825
- This video, part 5 of the 'makemore' series, focuses on building a WaveNet architecture, a convolutional neural network inspired by DeepMind's 2016 paper. - The process involves deepening a 2-layer MLP with a tree-like structure and introduces concepts of `torch.nn` and the typical deep learning development workflow. - Key steps include fixing a learning rate plot, refactoring code into PyTorch layers, implementing the WaveNet architecture, and debugging issues like a `BatchNorm1d` bug. - The video also touches upon causal dilated convolutions, a more efficient implementation of the WaveNet architecture, and discusses the general development process for deep neural networks.
-
Building makemore Part 4: Becoming a Backprop Ninja
https://youtu.be/q8SA3rM6ckI · fetched 2026-09-11 · link_id 2824
This video, part of the 'makemore' series by Andrej Karpathy, focuses on manually backpropagating through a 2-layer MLP with BatchNorm, without relying on PyTorch's autograd. The goal is to build an intuitive understanding of how gradients flow through a compute graph at the tensor level. The video covers backpropagation through the cross-entropy loss, linear layers, tanh activation, and BatchNorm. It is structured as an exercise, encouraging viewers to work through the problems alongside the video. Supplementary materials, including code and related papers, are provided. The video is approximately 2 hours long and has garnered significant views and engagement.
-
Building makemore Part 3: Activations & Gradients, BatchNorm
https://youtu.be/P6sfmUTpUmc · fetched 2026-09-11 · link_id 2823
This video delves into the internal workings of multi-layer perceptrons (MLPs), focusing on the statistics of forward pass activations and backward pass gradients. It highlights common pitfalls related to improper scaling and introduces diagnostic tools for assessing the health of deep neural networks. The video explains the fragility of training deep neural nets and introduces Batch Normalization as a key innovation for stabilizing this process. It also touches upon residual connections and the Adam optimizer as topics for future discussion. The content includes links to the 'makemore' GitHub repository, a Jupyter notebook, a Colab notebook, the instructor's website and Twitter, and a Discord channel. Several research papers related to initialization techniques (Kaiming init), Batch Normalization, and MLP language models are also referenced. The video concludes with exercises for viewers to practice concepts like zero initialization and folding batch normalization parameters into linear layers.
-
Building makemore Part 2: MLP
https://youtu.be/TCH_1BHY58I · fetched 2026-09-11 · link_id 2822
This video implements a multilayer perceptron (MLP) character-level language model and introduces fundamental machine learning concepts. Key topics covered include model training, learning rate tuning, hyperparameter optimization, evaluation, data splitting (train/dev/test), and understanding underfitting and overfitting. The video also provides links to the project's GitHub repository, a Jupyter notebook, a Colab notebook, and the original MLP language model paper by Bengio et al. (2003). Exercises are included for viewers to practice hyperparameter tuning, initialization strategies, and implementing ideas from the referenced paper.
-
The spelled-out intro to language modeling: building makemore
https://youtu.be/PaCmpygFfXo · fetched 2026-09-11 · link_id 2821
This video introduces language modeling by building a "makemore" character-level language model. It covers the fundamentals of `torch.Tensor` and its efficient use in neural networks. The tutorial details the framework of language modeling, including training, sampling, and evaluating loss, specifically the negative log likelihood for classification. The content progresses from a simple bigram model to a neural network approach, explaining concepts like one-hot encodings, softmax, and vectorized loss, with practical exercises provided for viewers to implement.
-
The spelled-out intro to neural networks and backpropagation: building micrograd
https://youtu.be/VMj-3S1tku0 · fetched 2026-09-11 · link_id 2820
This video provides a detailed, step-by-step explanation of neural networks and backpropagation, assuming only basic Python knowledge and high school calculus. It covers the core concepts of backpropagation, the implementation of a micrograd library, and the training of a neural network from scratch. The content is structured with chapters detailing the process from a simple function derivative to building a multi-layer perceptron and performing gradient descent optimization. It also includes a comparison with PyTorch and a walkthrough of the micrograd code on GitHub.
-
But how do AI images and videos actually work? | Guest video by Welch Labs
https://www.youtube.com/watch?v=iv-5mZ_9CPY · fetched 2026-09-11 · link_id 2819
- This video explains the underlying mechanisms of AI image and video generation, focusing on Diffusion Models and CLIP. - It breaks down the process into key concepts: CLIP for understanding text prompts, the concept of a shared embedding space, and Diffusion Models (DDPM and DDIM) for generating images from noise. - The video also touches upon techniques like conditioning, guidance, and negative prompts, which allow for more control over the generated output. - It references specific AI models and papers, including Dall-E 2, Stable Diffusion, Midjourney, and Veo, providing links to further resources and code implementations.
-
How might LLMs store facts | Deep Learning Chapter 7
https://www.youtube.com/watch?v=9-Jl0dxWQs8 · fetched 2026-09-11 · link_id 2818
This video explores how Large Language Models (LLMs) might store factual information, focusing on the role of multilayer perceptrons (MLPs) within transformer architectures. It delves into the concept of 'superposition,' where multiple pieces of information can be encoded within the same set of parameters, akin to fitting many perpendicular vectors in high-dimensional spaces. The video suggests this mechanism could be crucial for LLMs' ability to recall and utilize facts. It also touches upon the computational aspects, such as counting parameters, and references external resources for further learning in mechanistic interpretability and AI alignment.
-
Attention in transformers, step-by-step | Deep Learning Chapter 6
https://www.youtube.com/watch?v=eMlx5fFNoYc · fetched 2026-09-11 · link_id 2817
This video provides a step-by-step explanation of the attention mechanism in transformers and Large Language Models (LLMs). It covers the concepts of self-attention, multiple heads, and cross-attention. The video is part of a deep learning series and is funded by viewer support. It also provides links to additional resources for further learning, including building a GPT from scratch, understanding language models, and interpreting transformer circuits. Timestamps are provided for easy navigation through the content, which includes recaps on embeddings, motivating examples, the attention pattern, masking, context size, values, parameter counting, cross-attention, multiple heads, and the output matrix.
-
Transformers, the tech behind LLMs | Deep Learning Chapter 5
https://www.youtube.com/watch?v=wjZofJX0v4M · fetched 2026-09-11 · link_id 2816
This video explains the technology behind Large Language Models (LLMs), focusing on Transformers. It breaks down how LLMs work and visualizes the data flow within them. The content is funded by viewer support. The video covers topics such as prediction and sampling, the internal workings of a transformer, the premise of deep learning, word embeddings, embeddings beyond words, unembedding, and softmax with temperature. It also provides links to external resources for further learning, including building a GPT from scratch, conceptual understanding of language models, interpreting large networks, and the history of language models. Timestamps are provided for easy navigation within the video.
-
Large Language Models explained briefly - YouTube
https://www.youtube.com/watch?v=LPZh9BOjkQs · fetched 2026-09-11 · link_id 2815
This YouTube video provides a brief explanation of Large Language Models (LLMs), chatbots, pretraining, and transformers. It was created for an exhibit at the Computer History Museum and is funded by viewer support. The video's animations are made using a custom Python library called manim. The creator, Grant Sanderson (3Blue1Brown), also has other related videos on neural networks and transformers.
-
Backpropagation calculus | Deep Learning Chapter 4 - YouTube
https://www.youtube.com/watch?v=tIeHLnjs5U8 · fetched 2026-09-11 · link_id 2814
This YouTube video, part of the "Deep Learning" series by 3Blue1Brown, delves into the calculus behind backpropagation. It aims to provide a more formal representation of the intuition presented in previous episodes, bridging the gap between conceptual understanding and practical implementation in code and other texts. The video covers the chain rule in neural networks, the computation of relevant derivatives, the meaning of these derivatives, and their sensitivity to weights and biases. It also addresses scenarios with layers containing additional neurons. The content is presented with mathematical notation and visual explanations to clarify the complex concepts of backpropagation.
-
Backpropagation, Intuitively | Deep Learning Chapter 3 - YouTube
https://www.youtube.com/watch?v=Ilg3gGewQ5U · fetched 2026-09-11 · link_id 2813
This YouTube video, part of the "Deep Learning" series by 3Blue1Brown, provides an intuitive explanation of backpropagation, a core algorithm in neural network learning. It aims to demystify what happens within a neural network as it learns, focusing on the conceptual understanding rather than just the mathematical formulas. The video includes an introduction, a recap of previous concepts, an intuitive walkthrough with an example, a discussion on stochastic gradient descent, and concluding remarks. It also highlights the connection to partial derivatives and suggests further resources for a deeper dive into the mathematical representation of backpropagation.
-
Gradient Descent, How Neural Networks Learn | Deep Learning Chapter 2
https://www.youtube.com/watch?v=IHZwWFHWa-w · fetched 2026-09-11 · link_id 2812
This video explains the concept of gradient descent and how neural networks learn. It covers cost functions, training data, and the process of gradient descent, including analyzing the network and learning more. The video also features an interview with Lisha Li. It is part of a larger series on deep learning and is recommended for those interested in animating math and understanding neural networks.
-
But what is a neural network? | Deep learning chapter 1
https://www.youtube.com/watch?v=aircAruvnKk · fetched 2026-09-11 · link_id 2811
This video, the first chapter of a deep learning series, explains the fundamental concepts of neural networks. It covers: * **Neurons:** The basic building blocks of neural networks. * **Layers:** How neurons are organized into layers (input, hidden, output). * **The Math:** The underlying mathematical principles, including weights and biases. * **Why Layers?** The advantages of using layered structures for processing information. * **Example:** An illustration using edge detection to demonstrate how neural networks work. The video emphasizes active learning and recommends resources like Michael Nielsen's free book on neural networks and Chris Olah's blog for further study. It also mentions the use of the 'manim' Python library for animations and provides links to related videos and playlists.