The operational efficacy of large language models relies heavily on their inference-time context. This has established Context Engineering (CE) as a formal discipline for optimizing these inputs. Current CE methods rely on manually crafted harnesses, such as rigid generation-reflection workflows and predefined context schemas. They impose structural biases and restrict context optimization to a narrow, intuition-bound design space. To address this, we introduce Meta Context Engineering (MCE), a bi-level framework that supersedes static CE heuristics by co-evolving CE skills and context artifacts. In MCE iterations, a meta-level agent refines engineering skills via agentic crossover, a deliberative search over the history of skills, their executions, and evaluations. A base-level agent executes these skills, learns from training rollouts, and optimizes context as flexible files and code. We evaluate MCE across five disparate domains under offline and online settings. MCE demonstrates consistent performance gains, achieving 5.6--53.8% relative improvement over state-of-the-art agentic CE methods (mean of 16.9%), while maintaining superior context adaptability, transferability, and efficiency in both context usage and training.
翻译:大型语言模型的操作效能高度依赖于其推理时的上下文环境,这促使上下文工程(CE)发展成为一门优化这些输入的形式化学科。现有的上下文工程方法依赖于人工设计的框架,例如僵化的生成-反思工作流和预定义的上下文模式。这些方法引入了结构性偏差,并将上下文优化限制在一个狭窄、受直觉约束的设计空间内。为解决此问题,我们提出了元上下文工程(MCE),这是一个双层框架,通过协同演化上下文工程技能与上下文产物,取代了静态的上下文工程启发式方法。在MCE的迭代过程中,元层级智能体通过智能体交叉——一种对技能历史、其执行过程及评估结果的审慎搜索——来优化工程技能。基层级智能体则执行这些技能,从训练过程中学习,并将上下文优化为灵活的文件和代码。我们在离线与在线两种设置下,于五个不同领域对MCE进行了评估。MCE展现出持续的性能提升,相较于最先进的智能体式上下文工程方法,实现了5.6%至53.8%的相对改进(平均16.9%),同时在上下文使用和训练中保持了卓越的上下文适应性、可迁移性和效率。