大型语言模型上下文工程研究综述
A Survey of Context Engineering for Large Language Models
July 17, 2025
作者: Lingrui Mei, Jiayu Yao, Yuyao Ge, Yiwei Wang, Baolong Bi, Yujun Cai, Jiazhi Liu, Mingyu Li, Zhong-Zhi Li, Duzhen Zhang, Chenlin Zhou, Jiayi Mao, Tianze Xia, Jiafeng Guo, Shenghua Liu
cs.AI
摘要
大型语言模型(LLMs)的性能从根本上取决于推理过程中提供的上下文信息。本综述引入了“上下文工程”这一正式学科,它超越了简单的提示设计,涵盖了为LLMs系统优化信息负载的全面方法。我们提出了一个详尽的分类体系,将上下文工程分解为其基础组件以及将这些组件整合到智能系统中的复杂实现。我们首先审视了基础组件:上下文检索与生成、上下文处理以及上下文管理。随后,我们探讨了这些组件如何通过架构整合,创造出复杂的系统实现:检索增强生成(RAG)、记忆系统与工具集成推理,以及多智能体系统。通过对1300多篇研究论文的系统分析,本综述不仅为该领域绘制了技术路线图,还揭示了一个关键的研究空白:模型能力之间存在根本性的不对称性。尽管当前模型在高级上下文工程的加持下,在理解复杂上下文方面展现出卓越能力,但在生成同等复杂的长篇输出时却表现出明显的局限性。填补这一空白是未来研究的首要任务。最终,本综述为推进上下文感知AI的研究人员和工程师提供了一个统一的框架。
English
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 1300 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.