LLMS & TRANSFORMERS ยท INTERVIEW QUESTION
What are Large Language Models (LLMs) and how do they work?
๐ข beginner ยท Transformer Architecture
Hint: Think about the scale of parameters, training data, and the autoregressive generation process.
Answer
LLMs are neural networks (typically transformer-based) trained on massive text corpora with billions of parameters. They learn statistical patterns of language via next-token prediction: given a sequence of tokens, predict the most likely next token. At inference, they generate text autoregressively โ producing one token at a time and feeding it back as input.
Key ingredients:
- Transformer architecture with self-attention
- Massive pre-training data (web text, books, code)
- Scale (billions of parameters)
- Emergent capabilities at scale (reasoning, few-shot learning).
Examples: GPT-4, Claude, LLaMA, Gemini.
Likely follow-up: What emergent abilities appear only at very large scale?
Related questions
- Explain the self-attention mechanism in detail. What are Q, K, V and why do we use scaled dot-product attention?
- Explain positional encoding in Transformers. Compare sinusoidal, learned, RoPE, and ALiBi.
- Explain FlashAttention. How does it achieve sub-quadratic memory while maintaining exact attention?
- How does multi-head attention differ from single-head attention? Why use multiple heads?
- Explain the difference between LoRA, full fine-tuning, and prompt tuning. When would you use each?