Notes

129 notes, all linked to each other. Search by title, summary, or tag.

129 notes

AI & ML

Activation Functions

Activation functions introduce nonlinearity after the linear transformation in each neuron.

3 links · 9 backlinks

Actor-Critic Methods

Actor-critic combines a policy (actor) with a value function (critic) for stable, low-variance policy gradient learning.

4 links · 7 backlinks

Advantage Function

The advantage function measures how much better an action is compared to the average action in that state:

4 links · 8 backlinks

Autoregressive Generation

Autoregressive generation produces output one token at a time, feeding each generated token back as input for the next step.

4 links · 7 backlinks

Backpropagation

Backpropagation computes the gradient of the loss with respect to every parameter in the network by applying the Chain Rule (Multivariable) on the computation graph.

9 links · 14 backlinks

Batch Normalization

Batch normalization normalizes activations within each mini-batch to stabilize and accelerate training.

5 links · 7 backlinks

Bellman Equations

The Bellman equations express the recursive relationship in Value Functions: the value of a state equals the immediate reward plus the discounted value of the next state.

3 links · 5 backlinks

Bias-Variance Tradeoff

The expected test error of a model decomposes into three terms:

4 links · 12 backlinks

Causal Masking

Causal masking restricts Self-Attention so that each position can only attend to itself and earlier positions — never future tokens.

3 links · 4 backlinks

Chain-of-Thought Prompting

Chain-of-thought (CoT) prompting improves LLM reasoning by eliciting intermediate steps before the final answer.

4 links · 5 backlinks

Classical Machine Learning

Classical machine learning studies how models generalize from data without relying on large neural networks. The useful mental model is: choose a hypothesis class, define a loss…

15 links · 1 backlink

Convolutional Neural Networks

CNNs exploit spatial structure through three key ideas: local connectivity, parameter sharing, and translation equivariance.

3 links · 2 backlinks

Cross-Validation

Cross-validation provides honest estimates of model performance on unseen data.

2 links · 7 backlinks

Curse of Dimensionality

As dimensionality increases, data becomes exponentially sparse. This breaks intuitions from low-dimensional spaces and has deep consequences for ML.

5 links · 2 backlinks

Deep Q-Network

DQN extends Q-Learning to high-dimensional state spaces by approximating with a neural network.

3 links · 2 backlinks

Direct Preference Optimization

DPO (Rafailov et al., 2023) trains directly on preference pairs without a separate reward model or RL loop.

3 links · 7 backlinks

Dropout

Dropout randomly sets each neuron's output to zero with probability during training:

4 links · 2 backlinks

Dynamic Programming in RL

Dynamic programming solves MDPs exactly when the model ( , ) is known. Foundation for understanding all RL algorithms.

4 links · 5 backlinks

Embeddings

An embedding maps discrete objects (words, tokens, users, items) into a continuous vector space where geometric relationships encode semantic relationships.

4 links · 6 backlinks

Evaluation Metrics

Classification metrics:

2 links · 10 backlinks

Inductive Bias

An inductive bias is an assumption baked into a model's architecture that constrains what functions it can learn. It encodes prior knowledge about the problem structure.

6 links · 2 backlinks

K-Nearest Neighbors

KNN is a non-parametric algorithm: it stores all training data and classifies new points by majority vote among the nearest neighbors.

4 links · 3 backlinks

KL Penalty

The KL penalty in RLHF constrains the trained policy from drifting too far from the reference (SFT) model.

3 links · 5 backlinks

Layer Normalization

Layer normalization normalizes across the feature dimension for each individual sample:

3 links · 1 backlink

Linear Regression

Linear regression models the relationship (or with bias absorbed).

6 links · 6 backlinks

LLMs as RL Agents

The framing of LLM generation as a reinforcement learning problem reveals deep connections between language modeling and sequential decision-making.

8 links · 4 backlinks

Logistic Regression

Logistic regression is a linear classifier that models the probability of class membership:

6 links · 4 backlinks

LoRA

LoRA (Low-Rank Adaptation) makes fine-tuning large models practical by training only small low-rank matrices.

3 links · 5 backlinks

Loss Functions

The loss function measures how wrong the model's predictions are. Training minimizes it via Backpropagation.

5 links · 8 backlinks

LSTM and GRU

LSTMs and GRUs solve the vanishing gradient problem of Recurrent Neural Networks through gating mechanisms.

2 links · 2 backlinks

Markov Decision Process

An MDP is the formal framework for sequential decision-making under uncertainty.

3 links · 4 backlinks

Monte Carlo Methods in RL

Monte Carlo (MC) methods learn value functions from complete episodes of experience — no model needed.

2 links · 4 backlinks

Multi-Head Attention

Multi-head attention runs Self-Attention multiple times in parallel, each head learning different relationships.

3 links · 5 backlinks

Multimodality

Multimodal models extend a language model to consume (and sometimes produce) images, audio, or video by mapping each modality into the same embedding space the LLM already…

4 links · 0 backlinks

Neural Networks

Neural networks learn composed functions from data. The useful mental model is: layers apply differentiable transformations, nonlinearities make the composition expressive, and…

16 links · 2 backlinks

Policy Gradient Theorem

The policy gradient theorem gives the gradient of the expected return with respect to policy parameters — enabling direct optimization of the policy.

4 links · 5 backlinks

Positional Encoding

Transformers have no built-in notion of order — Self-Attention is permutation-equivariant. Positional encodings inject position information.

2 links · 5 backlinks

Pretraining

Pretraining teaches an LLM to predict the next token on massive text corpora — the foundational stage of the LLM pipeline.

8 links · 7 backlinks

Proximal Policy Optimization (PPO)

PPO is the default policy gradient algorithm for practical RL, including RLHF.

5 links · 6 backlinks

Q-Learning

Q-learning is an off-policy TD control algorithm that directly learns the optimal action-value function .

2 links · 8 backlinks

Random Forest

Random forest is an ensemble of decision trees that reduces variance through bagging and feature randomization.

3 links · 2 backlinks

ReAct

ReAct (Yao et al., 2023) interleaves reasoning and acting, enabling LLMs to use external tools.

3 links · 3 backlinks

Recurrent Neural Networks

RNNs process sequences by maintaining a hidden state that is updated at each time step:

3 links · 3 backlinks

Regularization

Regularization adds a penalty to the loss function to prevent overfitting by constraining model complexity.

4 links · 12 backlinks

REINFORCE

REINFORCE is the simplest policy gradient algorithm. It uses complete episode returns to estimate the gradient.

4 links · 4 backlinks

Reinforcement Learning

Reinforcement learning studies agents that learn by acting in an environment and receiving reward. The useful mental model is: an MDP defines the interaction, value functions…

18 links · 1 backlink

Residual Connections

A residual (skip) connection adds the input of a layer to its output:

3 links · 7 backlinks

RLHF Pipeline

RLHF (Reinforcement Learning from Human Feedback) aligns LLMs with human preferences by training against a learned reward model.

4 links · 8 backlinks

Sampling and Decoding Strategies

At each step, an autoregressive language model outputs logits over the vocabulary. The decoding strategy determines how to pick the next token from this distribution.

3 links · 3 backlinks

SARSA

SARSA is an on-policy TD control algorithm. The name comes from the tuple .

2 links · 3 backlinks

Scaling Laws

Scaling laws describe how LLM performance (loss) improves predictably as you increase model size, data, and compute.

2 links · 4 backlinks

Self-Attention

Self-attention is the core mechanism of the transformer. It computes relationships between all pairs of positions in a sequence.

3 links · 14 backlinks

Self-Improvement in LLMs

Self-improvement methods allow LLMs to improve their own capabilities by generating and learning from their own outputs.

3 links · 3 backlinks

Softmax

Softmax converts a vector of raw scores (logits) into a probability distribution:

4 links · 3 backlinks

Supervised Fine-Tuning

SFT fine-tunes a pretrained LLM on instruction-response pairs, teaching it to be a helpful assistant instead of a text completer.

4 links · 7 backlinks

Temporal Difference Learning

TD learning combines the model-free nature of Monte Carlo with the bootstrapping of dynamic programming.

6 links · 1 backlink

Test-Time Compute

Test-time compute refers to strategies that spend more computation at inference to improve output quality, rather than scaling the model itself.

3 links · 6 backlinks

The Artificial Neuron

The fundamental unit of a neural network:

4 links · 4 backlinks

Tokenization

Tokenization converts raw text into the integer sequences that transformers process.

2 links · 4 backlinks

Transformers and LLMs

Transformers and LLMs model token sequences by repeatedly mixing contextual information across positions. The useful mental model is: tokenization creates discrete symbols…

23 links · 3 backlinks

Value Functions

Value functions estimate how good it is to be in a state (or to take an action in a state) under a given policy’

4 links · 6 backlinks

Weight Initialization

Wrong initialization causes vanishing or exploding gradients before training even begins.

4 links · 5 backlinks

Mathematics

Adam Optimizer

Adam (Adaptive Moment Estimation) combines Momentum with per-parameter adaptive learning rates:

4 links · 6 backlinks

Bayes' Theorem

Components: - — posterior: updated belief about after observing - — likelihood: probability of evidence given - — prior: belief about before seeing evidence - — marginal…

4 links · 5 backlinks

Bayesian vs Frequentist Inference

Bayesian and frequentist inference differ in how they interpret probability and unknown parameters.

4 links · 1 backlink

Bootstrap and Resampling

The bootstrap estimates uncertainty by resampling from the observed data.

3 links · 2 backlinks

Calculus and Optimization

Calculus studies local change; optimization uses local change to choose better parameters. The useful mental model is: derivatives describe sensitivity, Taylor expansions…

13 links · 2 backlinks

Central Limit Theorem

The Central Limit Theorem says that sums and averages of many independent random variables become approximately normal under broad conditions.

3 links · 4 backlinks

Chain Rule (Multivariable)

If , the chain rule gives:

4 links · 5 backlinks

Closure

A set is closed under an operation if applying the operation to elements of always produces an element of :

2 links · 0 backlinks

Computation Graphs

A computation graph is a directed acyclic graph (DAG) where nodes are operations and edges carry values. It makes the Chain Rule (Multivariable) systematic.

3 links · 4 backlinks

Confidence Intervals

A confidence interval is a procedure that produces a range of plausible parameter values from data.

3 links · 5 backlinks

Convexity

A function is convex if a line segment between any two points on its graph lies above the graph:

4 links · 7 backlinks

Correlation and Covariance

Covariance measures how two variables vary together.

3 links · 1 backlink

Cross Product

The cross product is defined only in and and produces a vector (unlike the Dot Product which produces a scalar):

2 links · 0 backlinks

Determinant and Inverse

The determinant of a square matrix is a scalar that captures how the transformation scales volume:

5 links · 1 backlink

Dot Product

The dot product (inner product) of two vectors can be understood through two equivalent views:

3 links · 5 backlinks

Eigendecomposition

An eigenvector of matrix is a nonzero vector whose direction is unchanged by the transformation: , where is the eigenvalue.

4 links · 9 backlinks

Entropy and Cross-Entropy

Entropy measures the average surprise (information content) of a distribution:

4 links · 2 backlinks

Estimators

An estimator is a rule for using data to estimate an unknown population parameter.

5 links · 2 backlinks

Expectation and Variance

Expectation (mean): the average value of a random variable. - Discrete: - Continuous: - Linearity: (always, even if dependent)

4 links · 5 backlinks

Experimental Design

Experimental design is about collecting data so comparisons support valid causal or statistical conclusions.

3 links · 2 backlinks

Gaussian Elimination

Gaussian elimination transforms a matrix into row echelon form (REF) using elementary row operations to solve linear systems .

2 links · 4 backlinks

Gradient

The gradient of a scalar function is the vector of all partial derivatives:

4 links · 7 backlinks

Hessian Matrix

The Hessian of a scalar function is the matrix of second partial derivatives:

6 links · 6 backlinks

Hypothesis Testing

A hypothesis test asks whether observed data is surprising under a null hypothesis.

3 links · 4 backlinks

Jacobian Matrix

The Jacobian of a vector-valued function is the matrix of all partial derivatives:

4 links · 4 backlinks

Key Probability Distributions

Discrete:

6 links · 5 backlinks

KL Divergence

KL divergence measures how one probability distribution diverges from a reference distribution :

4 links · 5 backlinks

Law of Large Numbers

The Law of Large Numbers says that the sample average converges to the expected value as sample size grows.

3 links · 1 backlink

Learning Rate Schedules

The learning rate controls step size in gradient descent. Too large → divergence; too small → slow convergence. Schedules vary during training.

2 links · 4 backlinks

Linear Algebra

Linear algebra studies vector spaces and linear maps between them. The useful mental model is: vectors live in spaces, bases give coordinates, matrices represent transformations…

13 links · 2 backlinks

Linear Transformations

A linear transformation satisfies . Every linear transformation can be represented as multiplication by a matrix , and every matrix defines one.

6 links · 2 backlinks

Matrix Multiplication

Matrix multiplication can be understood through three equivalent views:

3 links · 5 backlinks

Maximum A Posteriori Estimation

MAP estimation adds a prior to Maximum Likelihood Estimation :

4 links · 8 backlinks

Maximum Likelihood Estimation

MLE finds the parameters that maximize the probability of the observed data:

4 links · 13 backlinks

Momentum

Momentum accelerates Stochastic Gradient Descent by accumulating a velocity vector in directions of persistent gradient:

2 links · 3 backlinks

Norms and Distance Metrics

A norm measures the "size" of a vector. Norms underlie nearly every loss function, regularizer, and similarity measure in ML.

5 links · 4 backlinks

Orthogonality and Projections

Two vectors are orthogonal if . An orthonormal set has all vectors mutually orthogonal with unit length.

4 links · 2 backlinks

Population vs Sample

A population is the full data-generating group you care about. A sample is the observed subset used to infer properties of that population.

3 links · 2 backlinks

Positive Definite Matrices

A symmetric matrix is positive definite (PD) if for all nonzero . Positive semi-definite (PSD) allows .

4 links · 8 backlinks

Power Iteration

Power iteration is a simple algorithm to find the dominant eigenvalue (largest in absolute value) and its eigenvector.

2 links · 1 backlink

Principal Component Analysis (PCA)

PCA finds the directions of maximum variance in data and projects onto them for dimensionality reduction.

3 links · 9 backlinks

Probability

Probability studies uncertainty before observing data. The useful mental model is: random variables turn outcomes into quantities, distributions assign mass or density…

9 links · 3 backlinks

Random Variables

A random variable is a function from outcomes to numbers, equipped with a probability distribution describing the likelihood of each value.

3 links · 4 backlinks

Rank and Null Space

For a matrix ( ):

3 links · 7 backlinks

Sampling Distributions

A sampling distribution is the distribution of a statistic across repeated samples from the same population.

3 links · 6 backlinks

Singular Value Decomposition (SVD)

Every matrix (any shape) can be decomposed as :

4 links · 8 backlinks

Statistical Power

Statistical power is the probability that a test correctly detects a real effect.

3 links · 3 backlinks

Statistical Significance vs Practical Significance

Statistical significance asks whether an observed effect is unlikely under a null hypothesis.

3 links · 2 backlinks

Statistics Fundamentals

Statistics studies inference from finite data. The useful mental model is: probability goes from model to possible data; statistics goes from observed data back to uncertain…

16 links · 2 backlinks

Stochastic Gradient Descent

SGD and its variants are the workhorses of neural network training.

6 links · 12 backlinks

Taylor Expansion

Taylor expansion approximates a function near a point using its derivatives:

5 links · 4 backlinks

Vector Spaces and Basis

A vector space over is a set of vectors closed under addition and scalar multiplication. is the canonical example.

6 links · 4 backlinks

Computer Science

Approximate Nearest Neighbor Search

Exact nearest neighbor search in high dimensions is per query (brute-force scan). For millions of vectors, this is too slow. Approximate methods trade a small accuracy loss for…

5 links · 2 backlinks

Big-O and Complexity Analysis

Big-O notation describes how an algorithm's time or space scales with input size , ignoring constants and lower-order terms.

3 links · 7 backlinks

Computational Complexity of Attention

Standard Self-Attention has time and memory in sequence length . This is the fundamental bottleneck of transformers.

4 links · 5 backlinks

Computer Science Foundations

Computer science foundations study the cost and structure of computation. The useful mental model is: algorithms transform inputs into outputs, data structures control access…

10 links · 1 backlink

Distributed Training Strategies

When a model or dataset is too large for a single GPU, training must be distributed across multiple devices.

3 links · 2 backlinks

Dynamic Programming

Dynamic programming (DP) solves problems with optimal substructure (optimal solution built from optimal sub-solutions) and overlapping subproblems (same subproblems recur) by…

4 links · 2 backlinks

Floating Point and Quantization

Numbers in hardware have finite precision. Choosing the right format trades off range, precision, memory, and speed.

3 links · 3 backlinks

GPU Architecture and CUDA

GPUs achieve massive parallelism through thousands of simple cores executing the same instruction on different data (SIMT — Single Instruction, Multiple Threads).

3 links · 4 backlinks

Graphs and Traversals

A graph consists of vertices and edges. Directed graphs (digraphs) have ordered edges. A DAG (directed acyclic graph) has no cycles.

4 links · 3 backlinks

Hash Tables

A hash table maps keys to values via a hash function , giving average-case lookup, insert, and delete.

2 links · 3 backlinks

Memory Hierarchy and IO-Awareness

Modern hardware is memory-bound, not compute-bound for most ML operations. Understanding the memory hierarchy is the key to writing fast code.

3 links · 6 backlinks

P vs NP and Intractability

P = problems solvable in polynomial time. NP = problems whose solutions are verifiable in polynomial time. The question is open, but widely believed to be .

2 links · 2 backlinks

Randomized Algorithms

Randomized algorithms use random choices to achieve better average-case performance, simpler implementations, or solutions to problems where deterministic approaches are…

4 links · 1 backlink

Sorting and Selection

Sorting arranges elements in order. Selection finds the -th smallest (or largest) element without fully sorting.

2 links · 1 backlink

Systems and Scaling

Systems and scaling study how model training and inference behave on real hardware. The useful mental model is: performance is limited by compute, memory, communication, and…

7 links · 1 backlink