← Back to LLMs Mind Map
⚡Flashcard Drill➔
⚡ LLMsID: context-extension

Long-Context Extension

长上下文扩展
🎯Core Definition
Long-context extension scales the effective context from 4K/8K to 128K/1M, via two main routes. Route one: positional-encoding surgery on RoPE — PI (Positional Interpolation) scales position m by 1/s1/s for linear interpolation; NTK-aware scaling down-weights only low frequencies while preserving high ones; YaRN (Yet another RoPE extensioN) adds a temperature t on top of NTK, scaling attention logits by 1/t1/\sqrt{t} — the most widely used today. Route two: continued pretraining on long documents (books, code repos) packed in sequence at a small learning rate.
💡Use Cases
long-document QA, codebase understanding, long-horizon agent tasks; inference relies on KV-cache management (see the AI_Infra module).
⚡Key Problems Solved
naive extrapolation pushes RoPE positions beyond the training range, destabilizing attention scores and exploding perplexity. PI/NTK/YaRN extend 4K to 128K with no or minimal training (e.g., YaRN-LLaMA-2-128K) while perplexity stays on par with short contexts; the cost is KV-cache memory growing linearly with length: a 128K-context 70B model needs hundreds of GB of KV cache (about 2×2×L×H×d×s×b2 \times 2 \times L \times H \times d \times s \times b), requiring PagedAttention-style management.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Long-Context Extension.
Use Cases
In production engineering, what are the primary use cases for Long-Context Extension and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Why does naive RoPE extrapolation fail?
2
PI vs NTK-aware scaling: what differs fundamentally?
3
YaRN's mechanism and the role of the temperature t?
4
The two routes of context extension and their trade-offs?
5
Compute/memory cost of long context and KV-management techniques?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Long-Context Extension"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
🎯 Drill This Card Now➔
← Previous CardModel Families & EvolutionNext Card →Context Engineering

🔗 More LLMs Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/LLM/card/context-extension