LLMs & Generative AI
A large language model is one idea repeated to exhaustion: predict the next token, append it, predict again. Almost everything an interviewer probes here — why the model works, why it is expensive to serve, why it still hallucinates — falls out of that loop and the transformer that runs it. This topic builds the model from the inside out, then covers the two systems the industry wraps around it.
We start with the architecture: attention, the KV cache, and the tricks (Mixture-of-Experts, grouped-query attention, RoPE) that make a modern model affordable. Then training — how a base model is pretrained and then aligned, and why LoRA and RAG solve different problems that candidates routinely conflate. Then serving, where the sharpest claims live: FlashAttention is exact, speculative decoding is lossless, and quantization trades accuracy for bandwidth. Finally the two application layers — RAG, which grounds answers in retrieved text, and agents, which let the model call tools in a loop.
Layers
- LLM architecture — the transformer block and attention, the KV cache and how its size scales, MoE routing, MQA/GQA, RoPE, and why decoder-only won.
- LLM training — pretraining vs SFT vs RLHF/DPO, LoRA as parameter-efficient tuning, why RAG is not fine-tuning, scaling laws and catastrophic forgetting.
- LLM serving — the KV cache in production, continuous batching, lossless speculative decoding, exact FlashAttention, quantization trade-offs, prefill vs decode.
- RAG — chunking, embeddings, vector search and reranking, why retrieval grounds answers and cuts hallucination, context limits and evaluation.
- AI agents — tool calling, the ReAct planning loop, memory, multi-step orchestration, failure modes and guardrails.