long context
Applied AI interview questions tagged long context, across every topic.
15 questions · 1 unlocked for you
Concepts behind "long context"
The curriculum that explains the ideas these questions test.
Foundational
The Context WindowThe context window is the maximum number of tokens a model can attend to at once, prompt plus generation. It is bounded by attention's quadratic cost, the KV cache's linear memory growth, and the length the model was trained on. A bigger window is not free or uniformly useful (models lose information in the middle), which is why retrieval often beats stuffing everything into context. Applied-AI interviews probe it because it shapes cost, latency, and the RAG-vs-long-context decision.🧠 Foundations of LLMs & GenAI
Core
Positional Encodings (RoPE and ALiBi)Attention is order-blind, so models inject token position separately. Modern LLMs use relative schemes: RoPE rotates query/key vectors by an angle proportional to position so the attention score depends only on the offset between tokens, and ALiBi adds a distance penalty to attention scores. Both extrapolate to longer sequences far better than learned absolute positions, which is why RoPE-with-scaling is how context windows get extended. Applied-AI interviews probe it because it explains how long-context models are built.🧠 Foundations of LLMs & GenAISign in
Core
Context Rot and Long-Context Failure ModesContext rot is the practical degradation of model quality as the input window fills up, even when the official window is a million tokens. Information in the middle gets ignored, attention concentrates on the first and last tokens, and reasoning that needs several scattered facts at once falls apart. Applied AI interviews probe it because candidates routinely assume a large window is a substitute for retrieval, and it is not.🧠 Foundations of LLMs & GenAISign in
Core
Retrieval vs Long ContextWhen you can fit a whole document in a model's large context window, should you, or should you retrieve only the relevant chunks? Long context is simpler but expensive (quadratic attention), slower, and unevenly used (lost in the middle); retrieval is cheaper, faster, updates without retraining, and surfaces only what matters. The answer is usually retrieval for large, changing, or partially-relevant corpora, and long context for small, cohesive inputs. Applied-AI interviews probe it because 'just use the big context window' is a common, costly oversimplification.🤖 Retrieval & AgentsSign in
Core
FlashAttention and IO-Aware KernelsNaive attention is slow not because of the matmuls but because it writes the full N-by-N attention matrix to GPU high-bandwidth memory and reads it back, which is memory-bandwidth bound. FlashAttention fuses the whole attention computation into one kernel that tiles the inputs in fast on-chip SRAM and never materializes the full matrix, using an online-softmax trick to stay exact. Applied-AI interviews probe it because it is why long-context training and serving became affordable and a clean test of GPU memory-hierarchy reasoning.🖥️ ML Infrastructure & ServingSign in
