ML & Deep Learning Foundations·Question 44 of 55Advanced

What is maximum likelihood estimation? Show how it generates the standard loss functions, and where the Bayesian view (MAP) connects to regularization.

Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.

Model answer: the part to lead with

MLE picks parameters that make the observed data most probable under the model: θ* = argmax_θ Π p_θ(dataᵢ). You maximise the log-likelihood in practice - monotone (same argmax), turns the product into a sum (i.i.d. data → per-example losses that mini-batch cleanly), and avoids floating-point underflow from multiplying thousands of probabilities. A likelihood is not a probability distribution over θ - it's the data's probability viewed as a function of parameters; it needn't integrate to 1 over θ.

Full worked answer

MLE picks parameters that make the observed data most probable under the model: θ* = argmax_θ Π p_θ(dataᵢ). You maximise the log-likelihood in practice - monotone (same argmax), turns the product into a sum (i.i.d. data → per-example losses that mini-batch cleanly), and avoids floating-point underflow from multiplying thousands of probabilities. A likelihood is not a probability distribution over θ - it's the data's probability viewed as a function of parameters; it needn't integrate to 1 over θ.

The generative move interviewers want: choose a noise model, get a loss for free.

  • Categorical likelihood over classes/tokens → NLL = cross-entropy. LLM pretraining is MLE of the text distribution, token by token.
  • Gaussian likelihood with fixed variance around a predicted mean → NLL = MSE (up to constants).
  • Laplace noise → L1/MAE (hence its robustness to outliers - heavy tails expect occasional large errors).
  • Bernoulli → binary cross-entropy; Poisson → Poisson regression loss.

So "which loss?" is really "which conditional distribution do I believe generated the targets?"

MAP (maximum a posteriori) adds a prior: maximise log p(data|θ) + log p(θ). A zero-mean Gaussian prior on weights adds −λ‖θ‖², i.e., L2/weight decay; a Laplace prior adds −λ‖θ‖₁, i.e., L1. Regularization is literally a prior belief that weights should be small - the Bayesian and the penalised-optimization views are the same math.

Properties worth citing: MLE is consistent and asymptotically efficient under regularity conditions, but with finite data it overfits - it happily assigns probability 1 to events seen once (the smoothing problem in classical n-gram LMs). Priors/regularization are the finite-data correction. One modern wrinkle: RLHF-style objectives leave the MLE framework - they optimise expected reward with a KL leash back to the MLE-trained reference model, which is why the KL term is there: it anchors the policy to the distribution MLE learned.

What a good answer covers

  • MLE picks parameters that make the observed data most probable under the model: θ = argmax_θ Π p_θ(dataᵢ)
  • You maximise the log-likelihood in practice - monotone (same argmax), turns the product into a sum (i.i.d
  • A likelihood is not a probability distribution over θ - it's the data's probability viewed as a function…
  • LLM pretraining is MLE of the text distribution, token by token
  • So "which loss?" is really "which conditional distribution do I believe generated the targets?"

Key terms: log · cross-entropy · MSE · L1/MAE · MAP · L2/weight decay · L1

Interviewer follow-ups to expect

  1. Derive MSE from the Gaussian likelihood explicitly. Why does MLE + one observation of a rare event give pathological probabilities, and what's the fix?

  2. What role does the KL penalty play in RLHF from this viewpoint?

Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep