L2ashobby

L2ashobby

@l2ashobby.bsky.social

Learning about machine learning

26 followers52 following36 posts

Reading: Data Analysis Using Regression and Multilevel/Hierarchical Models TIL: Since estimated regression coefficients are linear combinations of iid response variables, then by CLT, those coefficients estimated across different samples from the population will also be normally distributed.

Reading: Data Analysis Using Regression and Multilevel/Hierarchical Models TIL: "Fixed effects" models are just a special case of "random effects" models that assume zero or infinite higher level variance in parameters. So "all models are random effects models." (semantics!)

LoRA involves freezing all LLM layers and adding trainable low-rank weight matrices (AB) to specific layers to adjust their outputs and fine-tuning overall model predictions. This amounts to the low-rank matrices approximating the full weight updates that would have occurred during fine-tuning.

TIL: k-Means clustering is a special case of the Expectation-Maximization (EM) algorithm using Gaussian mixture models (GMM). If the K Gaussian clusters are assumed to have zero variance and uniform mixture coefficients (1/K), then the GMM algorithm becomes the k-means clustering algorithm.

TIL: While cross-entropy loss can be thought of as a comparison between two probability distributions, in ML coding practice, the loss function takes in a neural network's predicted logits and target probabilities. This way, loss computations are more efficient, with bounded stable gradients.

TIL: In k-means clustering, data samples are first assigned to clusters based on the squared distances to each cluster center. The algorithm then updates cluster centers by finding the centroid of the assigned data samples. Essentially, the cluster centers "follow" the newly assigned data samples.

TIL: "Bootstrap Aggregating" = Bagging. Commonly used for decision trees, it is also possible to use for training ensembles of other kinds of prediction functions with relatively high variance, including neural nets!

Reading: A Survey of Monte Carlo Tree Search Methods TIL: Introduced by Auer et al., the UCB1 algorithm says a multi-arm bandit should play the j-th arm based on average reward observed for j-th arm (exploit) and inverse square root of the number of times j-th arm is played (explore).

Reading: OpenAI Spinning Up Part 3 TIL: The policy gradient used to update policy takes the general form of an expected weighted sum over the trajectory. The main summation term is the gradient of log-likelihood of policy actions. The summation weights depend on the policy optimization approach.

Reading: RL materials (David Silver RL slides, Spinning Up) TIL: In on-policy, the action for updating target policy becomes the next action (target = behavior policy). In off-policy, the action for updating target policy is not necessarily the next action (sampled from separate behavior policy).

Reading: Build a Large Language Model from Scratch, Chapter 3 TIL: Attention mechanisms were initially developed to augment the RNN EncDec architecture by addressing the limitation of how the original RNN Decoder could not access the RNN Encoder's previous hidden states over the input sequence.

Reading: Build a Large Language Model from Scratch, Chapter 2 TIL: While the OG transformer model used a pre-defined positional encoder that remained fixed during training, early OpenAI GPT models used absolute positional embeddings that were optimized during training.

Reading: Build a Large Language Model from Scratch, Chapter 2 TIL: Raw text is first processed into words and special character tokens. Then a tokenizer uses a vocabulary to map tokens to integer IDs and vice versa. Special context tokens (`endoftext`) are included in the vocabulary.

Reading: Build a Large Language Model from Scratch, Chapter 1 TIL: "when we say language models "understand," we mean that they can process and generate text in ways that appear coherent and contextually relevant, not that they possess human-like consciousness or comprehension."

The universal approximation theorem states that a neural network of a specific structure can approximate a continuous function to any accuracy. While that means deeper neural nets are not needed in theory, later experiments showed practical benefits of increasing layers vs increasing hidden size.

Reading: FastAI Book [https://github.com/fastai/fastbook/] Section: 04_mnist_basics TIL: After ensuring differences between two tensors are between 0 and 1, the squared error "ups the contrast" of those differences relative to the absolute error. This will have implications on using L1 vs L2 norm.

Reading: FastAI Book [https://github.com/fastai/fastbook/] Section: 02_production.ipynb TIL: For an object detection model, training images can be resized via crop, squishing, or padding, none of which are ideal. So the "best" solution is to crop **randomly** (above a min fraction of each image).

Reading: Deep Learning [https://www.deeplearningbook.org] Section: Chapter 3 - Probability and Information Theory TIL: While KL-Divergence is sometimes referred to as a "distance" between distributions P and Q, this is not the best mental model since KL-divergence is asymmetric.

Reading: Deep Learning [https://www.deeplearningbook.org] Section: Chapter 3 - Probability and Information Theory TIL: In information theory, cross-entropy quantifies overall information needed to encode messages with symbols sampled from distribution P when wrongly assuming distribution Q.

Reading: Deep Learning [https://www.deeplearningbook.org] Section: Chapter 3 - Probability and Information Theory TIL: In mixture distribution models, the component identity variable c is a kind of latent variable!

Reading: Deep Learning [https://www.deeplearningbook.org] Section: Chapter 3 - Probability and Information Theory TIL: Covariance measures a *linear* relationship between two variables. So Cov(x,y)=0 does not exclude the possibility of a non-linear relationship between x and y.

Reading: Deep Learning [https://www.deeplearningbook.org] Section: Chapter 3 - Probability and Information Theory TIL: Frequentist probability refers to observed outcomes over infinitely repeatable events. Bayesian probability refers to a degree of belief about a future unobserved outcome.

You are up to date.