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. [1] Deep Dive into LLMs like ChatGPT · https://www.youtube.com/watch?v=7xTGNNLPyMI · fetched 2026-09-11
  2. [2] [1hr Talk] Intro to Large Language Models · https://www.youtube.com/watch?v=zjkBMFhNj_g · fetched 2026-09-11
  3. [3] Let's Build the GPT Tokenizer · https://youtu.be/zduSFxRajkE · fetched 2026-09-11
  4. [4] Let's build GPT: from scratch, in code, spelled out. · https://www.youtube.com/watch?v=kCc8FmEb1nY · fetched 2026-09-11
  5. [5] Building makemore Part 5: Building a WaveNet · https://youtu.be/t3YJ5hKiMQ0 · fetched 2026-09-11
  6. [6] Building makemore Part 4: Becoming a Backprop Ninja · https://youtu.be/q8SA3rM6ckI · fetched 2026-09-11
  7. [7] Building makemore Part 3: Activations & Gradients, BatchNorm · https://youtu.be/P6sfmUTpUmc · fetched 2026-09-11
  8. [8] Building makemore Part 2: MLP · https://youtu.be/TCH_1BHY58I · fetched 2026-09-11
  9. [9] The spelled-out intro to language modeling: building makemore · https://youtu.be/PaCmpygFfXo · fetched 2026-09-11
  10. [10] The spelled-out intro to neural networks and backpropagation: building micrograd · https://youtu.be/VMj-3S1tku0 · fetched 2026-09-11
  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. [12] How might LLMs store facts | Deep Learning Chapter 7 · https://www.youtube.com/watch?v=9-Jl0dxWQs8 · fetched 2026-09-11
  13. [13] Attention in transformers, step-by-step | Deep Learning Chapter 6 · https://www.youtube.com/watch?v=eMlx5fFNoYc · fetched 2026-09-11
  14. [14] Transformers, the tech behind LLMs | Deep Learning Chapter 5 · https://www.youtube.com/watch?v=wjZofJX0v4M · fetched 2026-09-11
  15. [15] Large Language Models explained briefly - YouTube · https://www.youtube.com/watch?v=LPZh9BOjkQs · fetched 2026-09-11
  16. [16] Backpropagation calculus | Deep Learning Chapter 4 - YouTube · https://www.youtube.com/watch?v=tIeHLnjs5U8 · fetched 2026-09-11
  17. [17] Backpropagation, Intuitively | Deep Learning Chapter 3 - YouTube · https://www.youtube.com/watch?v=Ilg3gGewQ5U · fetched 2026-09-11
  18. [18] Gradient Descent, How Neural Networks Learn | Deep Learning Chapter 2 · https://www.youtube.com/watch?v=IHZwWFHWa-w · fetched 2026-09-11
  19. [19] But what is a neural network? | Deep learning chapter 1 · https://www.youtube.com/watch?v=aircAruvnKk · fetched 2026-09-11
LinkList — grounded sources for agents

Curated source libraries, served to your agent over MCP.

Product

MCP