KatInterview

LLM Internals: Architecture, Fine-Tuning, and Evaluation

Machine LearningModel answer
MediumModel answerMachine Learningllmtransformersfine-tuning

Last updated

Explain decoder-only Transformer internals, compare positional encoding schemes, choose a PEFT strategy, and design an evaluation pipeline for a production LLM.

Large Language Model Architecture, Tuning, and Evaluation

Modern LLM development spans several interconnected concerns: understanding how the model is built, how to adapt it efficiently, how to keep it from overfitting, and how to know whether it actually works.

Address all four areas below. Be specific — name components, give formulas where they help, and ground your fine-tuning discussion in real experience.

Part 1 — Architecture

  • Compare encoder–decoder models (e.g., T5, BART) and decoder-only models (e.g., GPT, LLaMA, Mistral). What makes decoder-only the dominant choice for general-purpose language models today?
  • Walk through the layers in a decoder-only block: causal self-attention, the feed-forward sublayer, normalization placement, and residual connections. Explain what each component does and why it is designed the way it is.

Part 2 — Positional Encodings

Compare the three main families — absolute (sinusoidal or learned), relative (e.g., ALiBi, T5 biases), and rotary (RoPE) — on the following dimensions:

  • How position information enters the computation
  • Extrapolation behavior beyond training length
  • Compatibility with efficient attention implementations
  • Parameter cost

Part 3 — Parameter-Efficient Fine-Tuning

You have a 7B-parameter base model and a domain-specific supervised dataset. Describe your fine-tuning approach:

  • When would you choose LoRA, QLoRA, adapters, or full fine-tuning?
  • What are the practical trade-offs in memory, latency, and quality for each?
  • Briefly describe a real (or realistic) fine-tuning project: task, data size, method, hyperparameters, and measured outcome.

Part 4 — Regularization and Evaluation

  • What techniques prevent overfitting during fine-tuning? Cover data-side and training-side strategies.
  • How do you evaluate an LLM? Distinguish intrinsic from extrinsic metrics, and offline from online validation. What can go wrong if you rely on only one type?

Hints

Hint 1

For the architecture comparison, anchor your answer on what makes decoder-only models easy to scale and serve: a single training objective, a uniform stack, and a KV cache that pairs naturally with autoregressive generation.

Hint 2

RoPE encodes relative position inside the attention dot product by rotating query and key vectors — think about why that makes it cache-friendly and why naive length extrapolation still fails.

Hint 3

Structure your fine-tuning story as: task → data → method choice (with reasoning) → key hyperparameters → measured result. Interviewers weight the reasoning behind method choice at least as heavily as the outcome numbers.