interviewpath
  • 0day streak
  • 10total XP
  • Level 1
0/6

Unit 10 · AI research · Lesson 5 of 9

AI paper route: Attention, FlashAttention, LoRA, DPO, RAG

A guided route through six influential AI papers (Attention Is All You Need, FlashAttention, PagedAttention, LoRA, DPO and RAG) with CS229 and CS336 as foundations. It explains what to extract from each paper and which roles need which paper, so you read deeply where it matters instead of skimming everything.
About 8 hFocus mode

Step 1: Learn the ideas

  • Foundations: CS229 notes on deep learning, foundation models, LLMs and RL; CS336 lectures and assignments
  • Attention Is All You Need: architecture and evaluation
  • FlashAttention: IO-aware exact attention
  • PagedAttention: KV-cache memory management for serving
  • LoRA: low-rank adaptation and parameter efficiency
  • DPO: preference optimization without an explicit reward model
  • RAG: retrieval as a latent variable for generation
  • Role-based reading depth and a three-pass method
  • Structured notes and explanations at two and ten minutes

Why it matters

AI research and research-engineering interviews often include a paper discussion: one you choose, one from a reading list, or the paper behind a technique on your CV. Interviewers look for whether you understood the mechanism, can tell what was proven from what was measured, and can say what the evidence does not show. Skimming every popular paper prepares you for none of that. This route picks six papers that anchor today's LLM stack and says how deeply to read each for your target role.

Core ideas

Foundations first. The CS229 main notes cover backpropagation in the deep-learning chapter and, in newer chapters, foundation models (including a LoRA section), retrieval-augmented generation, large language models and reinforcement learning; use them to fill gaps before each paper. CS336 rebuilds a language model from scratch: tokenizer, transformer and optimizer (Assignment 1), profiling and a FlashAttention-2 kernel (Assignment 2), scaling (3), data (4), alignment and RL (5). If you can do the matching CS336 assignment, the paper will read easily.

What to extract from each paper.

  • Attention Is All You Need (2017): scaled dot-product and multi-head attention, positional encodings, the per-layer complexity comparison with recurrence and convolution, the training recipe (warmup schedule, label smoothing) and the model-variation table, which acts as the ablation study.
  • FlashAttention (2022): exact attention computed in tiles with an online softmax and recomputation in the backward pass, an IO analysis that counts reads and writes to GPU high-bandwidth memory, and wall-clock benchmarks. Read it as an argument about memory traffic, not FLOPs.
  • PagedAttention / vLLM (2023): the KV cache stored in fixed-size blocks with a block table, as in virtual-memory paging, which nearly removes fragmentation, enables sharing across sampled sequences and supports preemption by swapping or recomputation. Evidence is serving throughput at comparable latency on synthesized request traces.
  • LoRA (2021): frozen pretrained weights plus a trainable low-rank update BA, initialized so the model starts unchanged and mergeable for inference. The analysis of which matrices to adapt and how small the rank can be matters as much as the main tables.
  • DPO (2023): starting from RLHF's KL-regularized objective, express the reward through the optimal policy and a reference policy, then fit preference pairs with a logistic loss on log-probability ratios. Study the derivation and the roles of the reference model and β.
  • RAG (2020): a dense retriever and a sequence-to-sequence generator with retrieved passages treated as a latent variable, marginalized per sequence or per token, evaluated on open-domain QA, generation and fact verification, plus index hot-swapping.

Which roles need which papers.

  • Research-oriented ML and AI research: Attention, LoRA and DPO at working or deep level; RAG at working level; FlashAttention if you work on efficiency.
  • AI infrastructure: FlashAttention and PagedAttention deep, Attention working, LoRA for multi-adapter serving, DPO and RAG at awareness.
  • ML engineering: Attention and LoRA working, RAG working if your team builds retrieval, the rest at awareness.
  • Applied AI engineering: RAG at working depth plus current retrieval practice beyond it; Attention and LoRA at awareness; FlashAttention, PagedAttention and DPO optional. These are reading priorities, not predictions about any particular interview.

Three passes. First pass (20–30 minutes): abstract, figures, conclusion; write the claim in one sentence. Second pass: method and evaluation, filling the structured notes. Third pass, for deep reads only: re-derive or reimplement the mechanism and reproduce one small result.

Common misconceptions

  • "Every AI role needs all six papers in full." Depth should follow the role; applied-AI interviews probe RAG engineering far more than FlashAttention's IO analysis.
  • "FlashAttention approximates attention to save memory." It is exact; savings come from never materializing the attention matrix in HBM and recomputing it in the backward pass.
  • "DPO optimizes a different objective because it drops the reward model." It targets the same KL-regularized objective under the Bradley-Terry model; the reward is implicit in the policy and reference.
  • "LoRA always matches full fine-tuning." The paper reports specific models and tasks; the gap depends on task, rank, adapted matrices and budget.
  • "Today's RAG systems are what the RAG paper describes." It trains retriever and generator jointly on fixed tasks; most current systems use frozen retrievers and prompted LLMs.
  • "PagedAttention makes the attention kernel faster." Its gain is memory efficiency that allows larger batches; the paged kernel itself adds some overhead, which the paper measures.

How to approach it

Read your role's deep-read papers first, alternating each with the matching CS229 or CS336 material. Use the paper guides' note prompts, and for every paper practise a two-minute and a ten-minute explanation. Interviewers often follow up with "what would you change?" or "what does this result not show?", so end each paper with one experiment you would run next.

Suggested order

  1. 1Decide your role mix and mark each paper deep, working or awareness using the role list in the notes.
  2. 2Refresh foundations: CS229 main notes, the deep-learning and large-language-model chapters; skim the CS336 lecture material on transformer architecture.
  3. 3Read Attention Is All You Need with its paper guide, then implement attention in the "Implementing attention from scratch" topic.
  4. 4Read LoRA with its paper guide and the CS229 LoRA section; implement a LoRA layer and check that merging reproduces the unmerged outputs.
  5. 5Read DPO with its paper guide; derive the loss from the KL-regularized objective on paper and implement it on a toy preference problem.
  6. 6Read RAG with its paper guide and write down how RAG-Sequence and RAG-Token marginalize differently.
  7. 7For infrastructure-leaning roles, read FlashAttention and PagedAttention with their guides and do CS336 Assignment 2 or the KV-cache project.
  8. 8For each paper, record a two-minute explanation and list one threat to validity and one follow-up experiment.

Paper guides: Attention Is All You Need, FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness, Efficient Memory Management for Large Language Model Serving with PagedAttention, LoRA: Low-Rank Adaptation of Large Language Models, Direct Preference Optimization: Your Language Model is Secretly a Reward Model, Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks

Step 2: Check off what you can do

Tap each one you can genuinely do or explain. Each earns 10 XP.

Step 3: Go deeper

  • Stanford CS229 Machine LearningStart here

    Stanford University

    Section: Main lecture notes (deep learning, foundation models, LLM and RL chapters)

    Foundations behind each paper, including short sections on LoRA and retrieval-augmented generation.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • Stanford CS336 Language Modeling from ScratchStart here

    Stanford University

    Implementation-first foundation: transformer, FlashAttention-2 kernel, scaling, data and alignment assignments.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • Attention Is All You Need

    arXiv

    First paper on the route; read with its guide before implementing attention.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • LoRA: Low-Rank Adaptation of Large Language Models

    arXiv

    Parameter-efficient fine-tuning paper; read the analysis sections, not only the tables.

    Open(opens in a new tab)Link responded, 5 Oct 2026
  • Direct Preference Optimization: Your Language Model is Secretly a Reward Model

    arXiv

    Derivation-heavy alignment paper; work through Section 4 and the appendix derivations.

    Open(opens in a new tab)Link responded, 5 Oct 2026

Step 4: Practice

A paper counts as studied only when its structured notes are filled and you have explained it aloud. For each deep-read paper, do the matching implementation exercise; for awareness-level papers, a first-pass summary plus the split between guaranteed and measured claims is enough.

Record attempts on each problem’s page (+15 XP, +10 more when solved on your own).

Step 5: Test yourself

Answer each one out loud or on paper before you finish the lesson.

  1. Question 1Why does FlashAttention reduce memory traffic without changing the result?
  2. Question 2Which KV-cache allocation problem does PagedAttention address, and what does its approach cost?
  3. Question 3Why is one LoRA factor initialized to zero?
  4. Question 4What role does the reference policy play in the DPO loss?
  5. Question 5How do RAG-Sequence and RAG-Token differ in what they marginalize over?
  6. Question 6Which result in the Transformer paper acts as an ablation study?
  7. Question 7Which claims in these papers are analyses or derivations, and which are benchmark measurements?

You’re done when you can

  • Give a two-minute explanation of each paper on your role’s list without notes.
  • Fill all ten structured-note fields for every deep-read paper.
  • Implement at least two of: attention with tests, a LoRA layer with a merge test, the DPO loss, a KV cache.
  • Name one baseline choice and one threat to validity for each deep-read paper.
  • Explain which papers your target role needs deeply and why.

Finish the lesson

How confident do you feel?

Lesson complete!

+50 XP

Reviews will come up on the Practice tab so it sticks.

Your notes and study time

Log study time