Transformers
Attention
LLM Training
Classification/PCA
Misc
100

What is a token in a language model?

A piece of text, such as a word, part of a word, or punctuation.

100

What do Q, K, and V stand for in attention?

Query, Key, Value. 

100

An LLM is initially trained on massive amounts of text from books, websites, and articles, without being given explicit instructions or labeled answers. Which phase of LLM training is this, and what is its main goal?

Pretraining. The model learns general language patterns, knowledge, and relationships by predicting the next token.

100

A classifier predicts 80 out of 100 examples correctly. What is its accuracy, and why might this metric be misleading?

80%. Accuracy can be misleading if classes are imbalanced.

100

A regression model predicts a house price of $450,000, but the actual price is $500,000. What is the residual?

$50,000, using residual = actual − predicted.

200

Before a transformer can process text, each token is converted into a numerical vector. What is this vector called, and why is it needed?

Token embedding. It converts discrete tokens into numerical representations that the model can process.

200

What does attention allow a token to do?

Look at other tokens and gather relevant information.

200

An LLM is being trained on a massive dataset of web pages and books. Developers notice that many documents appear multiple times, causing the model to repeatedly encounter identical examples. Which phase of LLM training does this concern, and what should developers do?

Pretraining. Developers should deduplicate the training data to reduce memorization, improve data diversity, and avoid wasting compute.

200

A disease classifier misses many patients who actually have the disease. Should we prioritize precision or recall, and why?

Recall, because we want to minimize false negatives.

200

A regression model has low training error but high test error. What is likely happening, and name one way to address it.

Overfitting. Use regularization, reduce model complexity, or collect more data.

300

Why do transformers need positional information?

Attention alone doesn't know token order, so positional information helps distinguish sequences with different word orders.

300

What does softmax do to attention scores?

Converts them into weights that sum to 1.

300

A pretrained LLM can complete sentences but struggles to follow instructions. What training phase would help, and what kind of data would it use?

Supervised fine-tuning (SFT), using prompt–ideal response pairs.

300

A classifier lowers its decision threshold from 0.8 to 0.3. What happens to the number of positive predictions and to recall?

Both the number of positive predictions and recall increase or stay the same.

300

Two regression models have the same average absolute error, but one occasionally makes extremely large mistakes. Which loss function would penalize those mistakes more heavily: MSE or MAE?

MSE, because it squares errors and disproportionately penalizes large deviations.

400

What does the feedforward network (MLP) do?

Processes each token's representation independently.

400

In self-attention, two tokens have a very high query-key similarity score. What does this tell us about their relationship, and how does it affect the attention output? (does a higher similarity score generally produces a smaller or larger attention weight after softmax?)

The tokens are highly relevant to each other according to the model. A higher similarity score generally produces a larger attention weight after softmax, causing the corresponding value vector to contribute more to the output.

400

A model performs well on short prompts but struggles with long documents. Which training phase could address this, and how?

Mid-training, by continuing pretraining on longer sequences and high-quality long-context data.

400

PCA transforms a dataset with 100 features into 2 principal components. What is PCA trying to preserve, and what information might be lost?

It preserves as much variance as possible in two dimensions, but information in discarded components is lost.

400

You're training a regression model on a relatively small dataset, and its performance varies significantly depending on which examples you use for training and testing. What validation technique could you use to get a more reliable estimate of its performance, and how does it work?

K-fold cross-validation. Split the dataset into K folds, train the model K times using K−1 folds for training and the remaining fold for validation, then average the validation scores across all K runs.

500

A transformer processes a sequence of 100 tokens, each with an embedding dimension of 512. What are the dimensions of the attention score matrix for a single attention head, and what does each entry represent?

100 × 100. Each entry represents how strongly one token attends to another token.

500

How does causal masking affect attention? 

Future tokens are masked to prevent the model from seeing information it is supposed to predict.

500

A model generates two answers to a prompt, and human evaluators consistently prefer one. How can these preferences be used to improve the model?

Preference tuning, using methods like RLHF or DPO to encourage preferred responses.

500

In gradient boosted trees, why do we train trees sequentially instead of independently, and what is each new tree trying to learn?

Each new tree is trained to correct the errors of the existing ensemble, typically by fitting the negative gradients of the loss function. The trees are combined to progressively improve predictions and reduce loss.

500

You're training a model using gradient descent. The training loss decreases initially, but after several iterations, it begins oscillating and occasionally increases. What is the most likely cause, and why does this happen?

The learning rate is too high. Gradient descent takes steps that are too large, repeatedly overshooting the minimum instead of converging toward it.