提出六种优化AI工作流的令牌与上下文管理方法,显著降低延迟和成本。
Token Optimization and Context Window Management in Multi-Agent AI Workflows
- 设计六类工程模式,包括上下文分层与语义缓存,减少冗余计算。
- 实测冷启动延迟从3.5-10.5分钟降至61-116秒,令牌消耗减少60%-70%。
- 发现适量噪声可提升模型相关性判断,适合生产级多智能体系统优化。
多智能体AI工作流受限于令牌成本、延迟及上下文质量。本文提出基于内部生产仪表盘的实践框架,通过大模型从会议、邮件、聊天中提取结构化任务,并跨工作流路由摘要。提出六种模式:上下文分层、一次获取本地处理架构、压缩提示模板、令牌感知降级链、语义缓存、智能体间通信压缩。实际应用中,冷启动延迟从约3.5-10.5分钟降至61-116秒(六次测量),预计令牌减少60%-70%。另开展控制性上下文组合研究:在11种模型配置下,对661个匿名职场样本进行2,420次验证,固定提示为10项时,用同领域低相关项替换部分高相关项反而提升目标项的相关性一致性,称为‘相关性对比上下文’。在全部11组配对分析中,50:50信号/噪声条件比100%信号条件提升相关性准确度+0.077(95%置信区间[+0.056, +0.098],Cohen's d=0.49,Holm校正后p<.001,n=220)。该效应在九个模型族中仍保持+0.084(95%区间[+0.064, +0.103]),作为语料内描述性比较,非总体推断。融合-十实验表明,学习合成未优于机械集合合并。贡献在于建立模型研究与生产实践之间的可复现工程层,提供高效可靠的流程优化路径。
原文摘要 · Abstract (English)
Multi-agent AI workflows are limited not only by model quality but by token cost, latency, and context-window quality. This paper presents a practitioner framework for token optimization and context-window management, grounded in an internal production dashboard that extracts structured work items from meetings, email, and chat with LLMs and routes summaries across workstreams. Six patterns are described: context stratification, fetch-once/process-locally architecture, schema-contracted prompts, token-aware fallback chains, semantic caching, and inter-agent communication compression. In production they cut measured cold-load latency to 61-116 seconds (six timed runs) from an operational baseline of roughly 3.5-10.5 minutes, with an estimated 60-70% token reduction. It also reports a controlled context-composition study: 2,420 confirmatory trials across 11 model configurations, using 661 anonymized workplace items scored for relevance. Holding the prompt at a fixed ten items, replacing some high-relevance items with same-domain low-relevance items improves the model's relevance-score concordance on the target items, versus high-relevance items only; we call this relevance-contrast context. In the all-11 paired analysis, the 50:50 signal/noise condition improved relevance accuracy by +0.077 over the 100% condition (naive 95% CI [+0.056, +0.098], Cohen's d = 0.49, Holm-adjusted p < .001, n = 220). These cells are not independent; by the nine model families the effect is +0.084 (95% interval [+0.064, +0.103]), reported as a within-corpus descriptive comparison, not a population inference. A Fusion-of-N follow-up found that learned synthesis did not beat the mechanical set union of item IDs. The contribution is a measured engineering layer between model research and production agent practice: repeatable patterns and evaluation methods for faster, cheaper, more reliable workflows.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。