A Survey of Context Engineering for Large Language Models

AK's Picks LLM Long Context Model Editing NLP RAG DCRS Agent Agent Memory Multi-agent Collaboration
大语言模型(LLMs)的性能从根本上取决于推理过程中所提供的上下文信息。本文提出了“上下文工程”(Context Engineering)这一正式的研究领域,它超越了简单的提示设计,涵盖了针对LLMs的信息内容系统优化。我们提出了一个全面的分类体系,将上下文工程分解为基础组成部分,以及将这些部分整合进智能系统中的高级实现方式。我们首先探讨了基础组成部分:上下文检索与生成、上下文处理和上下文管理。随后,我们研究了这些组件如何在架构层面进行整合,以构建复杂的系统实现:检索增强生成(RAG)、记忆系统与工具集成推理,以及多智能体系统。通过对超过1400篇研究论文的系统分析,本综述不仅为该领域建立了技术发展路线图,还揭示了一个关键的研究空白:模型能力之间存在根本性的不对称。尽管当前模型通过先进的上下文工程增强了理解复杂上下文的能力,表现出显著的熟练度,但在生成同样复杂、长篇的输出方面仍存在明显局限。弥补这一差距是未来研究的关键优先事项。最终,本综述为推动上下文感知人工智能的研究人员和工程师提供了一个统一的框架。
The performance of Large Language Models (LLMs) is fundamentally determined by the contextual information provided during inference. This survey introduces Context Engineering, a formal discipline that transcends simple prompt design to encompass the systematic optimization of information payloads for LLMs. We present a comprehensive taxonomy decomposing Context Engineering into its foundational components and the sophisticated implementations that integrate them into intelligent systems. We first examine the foundational components: context retrieval and generation, context processing and context management. We then explore how these components are architecturally integrated to create sophisticated system implementations: retrieval-augmented generation (RAG), memory systems and tool-integrated reasoning, and multi-agent systems. Through this systematic analysis of over 1400 research papers, our survey not only establishes a technical roadmap for the field but also reveals a critical research gap: a fundamental asymmetry exists between model capabilities. While current models, augmented by advanced context engineering, demonstrate remarkable proficiency in understanding complex contexts, they exhibit pronounced limitations in generating equally sophisticated, long-form outputs. Addressing this gap is a defining priority for future research. Ultimately, this survey provides a unified framework for both researchers and engineers advancing context-aware AI.
许愿