在发送给贵价 LLM 总结前,先用普通代码做去重、过滤脏数据、合并重复内容,可将 40 个 Worker 41,200 tokens 输入压缩至 1/6,显著降低账单。
每个人都遇到但没人说的问题
想象一下,你构建了这样一个 AI Agent Pipeline:
你有 1 个研究问题
→ 发送给 40 个 AI Worker 从不同角度搜索信息
→ 各自返回答案
→ 汇总所有答案,发送给 1 个强大的 AI 总结成报告
听起来不错:40 个便宜的 worker + 1 个强大的总结模型。但真实发生的情况是:[1]
每个 AI Worker 返回的不是"简短答案",而是"小文档",包含了引言、格式化、不同风格的来源引用,更糟糕的是:
40 个答案中,有 15 个是重复信息——同一件事、同一来源,只是写法不同
40 个答案中,有 6 个是脏数据——字段缺失、时间戳损坏、claim 无证据
然后你把这些全部丢给那个强大的 AI 去读
AI 阅读了 40 份文档(41,200 tokens)
判断哪些是脏数据、应该忽略
然后才开始思考、总结报告
这就是问题所在:你花钱让强大的 AI 做数据清洗工作,而这根本不需要用 AI 来做
Reducer Engineering 的原理
Reducer Engineering 的理念是:
"在把数据发送给昂贵的 AI 之前,先用普通代码做清洗——剔除脏数据、合并重复信息、按优先级排序,然后再交给 AI 思考"
这个原理分为 3 个步骤:
步骤 1:Drop,剔除脏数据
valid = [f for f in raw if f.claim and f.evidence and f.source]
如果关键字段缺失,就剔除,不需要让 AI 来做判断
步骤 2:Group,合并重复数据
grouped = {}
for f in valid:
key = normalize(f.claim) # 将文本规范化为统一格式
grouped[key].append(f)
15 个讨论同一件事的答案 → 合并为 1 组,并标记"另有 14 个 worker 确认"
步骤 3:Sort,按优先级排序
best = max(group, key=lambda f: f.confidence)
deduped = sorted(deduped, key=lambda f: f.confidence, reverse=True)
最可靠的答案排在前面,AI 读完后立即能理解
结果:从 41,200 tokens 降至 5,300 tokens,减少 87%,剩余的都是 AI 读取后能立即继续思考的"干净数据"
实际数据,使用 Reducer 前后的对比
以下是 Gipp(@gippp69)真实 Pipeline 的数据,他是"Reducer Engineering"这个词的创造者 [1]:
每次节省 $1.19,听起来不多,但如果你每月运行 1,000 次,那就是 $1,190/月,或 $14,280/年
更令人惊叹的是,质量也提升了,因为 Reducer 捕获了 23 处原始数据传递从未发现的矛盾点,并将人工介入率从 12% 降至 2%
哪些人使用了同样的理念
Reducer Engineering 不是孤立的理念,有其他人在用不同的名称谈论同样的原理:
Context Compaction 是一种通过"删除噪声、保留信号"来减少 context window tokens 数量的技术,而不是总结或重新编码 [2]
Morph 报告称 Context Compaction 可以减少 50-70% 的 tokens 且不损失质量 [3],Anthropic 在 2026 年 2 月推出了 Compaction API(beta),让 Opus 4.6-4.8 自动压缩 context [4]
与 Reducer 相同的原理:不要发送原始数据,先清洗
研究人员发现 LLM Agents 经常"走太多路"、做重复工作,他们提出 Trajectory Reduction——删除不必要的步骤,在不降低准确率的前提下降低成本 [5]
与 Reducer 相同的原理:在数据到达模型之前删除不必要的工作
Microsoft 推出了 Conductor,一个开源 CLI(MIT 许可证),用于定义确定性的 multi-agent workflows [6]:
"You define your multi-agent workflows in YAML, and the routing between agents is deterministic."
与 Reducer 相同的原理:使用确定性逻辑代替 LLM 进行路由和编排
Zylos Research 建议"A database query that returns 500 rows doesn't need to send all 500 rows to the LLM, the agent should extract and forward only the relevant subset" [7]
与 Reducer 相同的原理:不要发送原始数据,先过滤再发送
为什么这个原理是可信的
Reducer Engineering 不是"技巧"或"捷径",它有研究和工程原理的支撑:
Liu 等人(Stanford,2023,发表于 TACL 2024)发现:
"模型读取 context 中间部分的信息效果比开头和结尾差,准确率呈 U 形——开头好,中间下降,结尾好" [8]
Reducer 直接解决了这个问题:将 context 从 41,200 tokens 减少到 5,300 tokens,所有数据都处于"最佳位置",并按 confidence 排序,重要数据在前,模型读取效果最佳
这是计算机科学的基本原理——如果输入数据不好,无论模型多强大,输出都不会好
Reducer 是这个原理在 AI Pipeline 中的应用,"Clean Data In, Good Results Out"
当这些级别的公司都在使用相同的原理时,这意味着它不仅仅是一个"好点子",而是被验证过的最佳实践
Gipp 报告的是真实 Pipeline 的数据,不是模拟:86% 的成本降低、78% 的延迟降低、发现 23 个矛盾点,最重要的是:人工升级率降低了 83%——这是可量化的质量指标
如何开始使用 Reducer Engineering,Step by Step
修复之前,先测量 synthesis model 的 tokens、cost、latency,记录为 baseline
步骤 2:分析原始输出
打开 workers 的原始输出,统计有多少重复、有多少脏数据、有多少格式噪声
步骤 3:编写 Reducer
普通 Python 代码,3 个函数:
def reduce_findings(raw: list[Finding]) -> list[Finding]:
# 步骤 1:剔除格式错误的数据
valid = [f for f in raw if f.claim and f.evidence and f.source]
# 步骤 2:按规范化的 claim 分组
grouped = {}
for f in valid:
key = normalize(f.claim)
if key not in grouped:
grouped[key] = []
grouped[key].append(f)
# 步骤 3:保留最佳答案 + 按 confidence 排序
deduped = []
for key, group in grouped.items():
best = max(group, key=lambda f: f.confidence)
if len(group) > 1:
best.evidence += f" [confirmed by {len(group)-1} other worker(s)]"
deduped.append(best)
return sorted(deduped, key=lambda f: f.confidence, reverse=True)
步骤 4:验证
与 baseline 对比 tokens、cost、latency、quality,看降低了多少
需要注意的 3 件事
normalize() 函数使用 similarity match,如果 2 个 claims 用词相似但含义不同,可能会被错误合并,导致数据丢失
防范方法:手动 spot-check,并为 similarity 设置 threshold
86% 这个数字来自 Gipp 的 Pipeline——有 40 个 workers 且数据重复多,你的 Pipeline 可能数据重复较少,可能是 40-70%,这也仍然值得
Reducer 解决的是"原始数据太多"的问题,但不解决"worker 搜索了错误信息"或"总结模型不够强"的问题——你仍然需要好的 workers 和强大的 synthesis model
不适用的场景
只在对话中使用 AI、没有 Pipeline 的人
使用免费模型、没有成本可降低的人
最后,Gipp 的结语最好:
"Forty Claude Haiku workers were never the expensive part. The expensive part was Claude Sonnet reading all forty outputs raw and doing cleanup work before it could start reasoning."
你不是因为 workers 贵而花钱,而是因为你让贵的 AI 读垃圾——停止这样做,使用 Reducer
以我个人的看法,Reducer Engineering 是"投入少、回报大"的技术之一,我把它用在自己的 Pipeline 上,从 20 个 workers → 1 个 reducer → synthesis model,成本降低了约 70%,虽然没达到 Gipp 的 86%,但每月也节省了几百美元
我认识的一个团队的真实例子:Pipeline 有 50+ 个 workers,使用 reducer 之前,synthesis model 每次运行耗时 3 分钟,使用 reducer 后降至 40 秒,成本从每次 $4.50 降至 $0.60,每月 1,000 次运行节省 $3,900,人工升级率从 15% 降至 3%
你呢,你试过 deterministic reducer 吗?你的 Pipeline 数据重复有多严重?试着测量一下,然后在文章下面分享数据吧
[1] Gipp (@gippp69). "Reducer Engineering: Cutting What Your Model Has To Read (Full Guide)". X. 2026 年 8 月 11 日. https://x.com/gippp69/status/2087120797206819322
[2] Morph. "Context Compaction: Delete Noise, Keep Signal, Technical Guide". 2026. https://www.morphllm.com/context-compaction
[3] Morph. "LLM Cost Optimization: 5 Levers to Cut API Spend 70-85%". 2026. https://www.morphllm.com/llm-cost-optimization
[4] Anthropic. "Compaction API (beta)". 2026 年 2 月. https://docs.anthropic.com/en/docs/build-with-claude/compaction
[5] "Reducing Cost of LLM Agents with Trajectory Reduction". arXiv. 2025. https://arxiv.org/html/2509.23586v2
[6] Microsoft Open Source Blog. "Conductor: Deterministic orchestration for multi-agent AI workflows". 2026 年 5 月 14 日. https://opensource.microsoft.com/blog/2026/05/14/conductor-deterministic-orchestration-for-multi-agent-ai-workflows/
[7] Zylos Research. "AI Agent Cost Optimization: Token Budgets, Model Routing, and Production FinOps". 2026 年 4 月. https://zylos.ai/research/2026-04-12-ai-agent-cost-optimization-token-budget-model-routing/
[8] Liu, Nelson F., et al. "Lost in the Middle: How Language Models Use Long Contexts". Transactions of the Association for Computational Linguistics (TACL), 2024. Stanford University. 2023. https://arxiv.org/abs/2307.03172
本文分析了 Gipp 在 X 上的原文、Stanford 的研究以及来自 Anthropic、Microsoft、Morph、Zylos Research 的资料,数据截至 2026 年 8 月 12 日,Nokka
你曾经遇到过 synthesis model 读取太多垃圾的问题吗?试过用 deterministic reducer 了吗?或者用其他方法降低成本?在文章下面分享你的经验吧