Not Everything Needs an LLM: How PostHog Uses Decision Models
- ID: b8930a9a
- 原文链接: https://newsletter.posthog.com/p/decision-models
- 作者: Jina Yoon
- 日期: 2026-11-09
- 更新: 2026-11-09
- 分类: coding
- 来源类型: newsletter
- 标签: decision-models, llm-pipeline, cost, calibration, production
- 质量评分: 4/5
- 抓取时间: 2026-11-18T12:21:47Z
中文导读
PostHog 的决策模型生产实践:用结构化问题返回类型化答案加校准概率(他们的例子是 Jev),而不是 LLM 的自由文本。决策模型比 frontier 模型最多便宜 444.6 倍、快 193.6 倍,所以拿来门控昂贵的 LLM 调用:Replay Vision 的 PII 清洗流水线先用两个窄 yes/no 问题打分(是否出现真人姓名、是否露出联系方式或证件),把误报压到单个宽问题的约十分之一,0.4 以上才交给 Gemini 重写,生产环境 98.7% 的会话摘要完全跳过 LLM 调用。校准纪律很明确:0.85 分仍意味着千次约 150 次错,阈值按哪种错误代价更高来定——PII 场景漏报更贵所以压到 0.4,Slack 机器人误答更烦人所以抬到 0.85+。
为什么值得关注
"什么任务不必上 LLM"是成本工程里最容易被含糊带过的一层,这篇文章给了可直接抄的分工纪律:门控昂贵调用、模型路由、单步表面核验、替换"杀鸡用牛刀"的调用这四类归决策模型,多步推理和开放任务仍归 LLM。同样有价值的是踩坑记录:阈值不能跨模型版本迁移(同一模型 v1/v2 阈值就变了)、决策模型链式多步判断会打爆服务(一个每小时 12–38k token 的排序任务把其他产品的调用阻塞了数小时)、对 PR review 发现排序的 AUC 只有 0.52——边界感比能力上限更值得学。
关键信息
- 决策模型(文中例子 Jev)返回类型化答案+校准概率:noul(是否)、choice(多选一)、score(打分);校准意味着 0.5 分约为五成胜率的硬币
- 成本杠杆:据 TypeSafe AI,比 frontier 模型最多便宜 444.6 倍、快 193.6 倍
- 用法一 · 门控昂贵 LLM 调用:Replay Vision PII 清洗用两个窄 yes/no 问题("是否点名真实人物""是否展示联系方式或证件"),任一 ≥0.4 才交给 Gemini 重写;窄问题把误报压到宽问题的约 1/10;生产环境 98.7% 的会话摘要完全跳过 LLM 调用
- 阈值纪律:0.85 分仍≈千次 150 错;按更贵的错误定阈值——PII 场景漏报(个人数据当干净数据存)比误报(多一次 LLM 调用)贵,取 0.4;Slack 机器人免打扰自动答题场景误答更烦人,取 0.85+
- 用法二 · 模型路由:被 @ 时先用 choice 问题选"最可能一次做对的最便宜模型",每个选项带一句能力说明(如 GPT Luna:轻量便宜,适合短答、查询、摘要、小改动)
- 路由踩坑:阈值不可迁移——Error Tracking 自动合并相似日志的实验中同一模型 v1/v2 阈值不同;改为按项目可配置,judge 先影子模式跑,再用手标数据重校准;growth 团队因此推动模型无关接口,自建内部 AI gateway 支持换模型测试(含自托管)
- 用法三 · 表面核验(face-value checks):嵌入检索先出候选列表,决策模型只判"这条摘要是否匹配搜索意图",按概率重排;20 条测试查询上排序质量提升约 25%
- 反面教材 · 多步推理:Highlights 排序曾用决策模型链式两问(是否值得看+为什么值得看),每小时任务单请求高达 32 会话、12–38k token,打爆模型服务器并阻塞其他产品数小时——多步推理留给 LLM,或在决策模型前先做重预处理
- 用法四 · 替换过配的 LLM:SQL 图表选择从确定性规则(日期+数值列→折线图等)升级为决策模型看 SQL 与结果前三行推荐更合适的图(如按浏览器拆分的柱状图替代聚合折线)
- 能力边界:Jev 单请求默认 64k token、单问题 32k,长上下文模式更慢更不准;给 PR review agent 的发现排序做 5 个 noul 问题,AUC 仅 0.52,不可用
- 混合路线:内部 AI 研究团队的 Jeeves 是"不确定时先推理再决策"的混合决策模型,现为 PostHog 未指定模型时的默认决策调用;社区有类似变体 Kev
English Summary
PostHog's production lessons on decision models — structured questions (noul/choice/score) that return a typed answer with a calibrated probability, exemplified by Jev, which runs up to 444.6× cheaper and 193.6× faster than frontier models. Four uses made it to production: (1) gating expensive LLM calls — Replay Vision's PII pipeline scores each session summary with two narrow yes/no questions (real person named? contact details or ID shown?), cutting false flags to ~a tenth of a single broad question; anything ≥0.4 goes to a Gemini rewrite, and 98.7% of summaries skip the LLM call entirely. (2) Model routing — a choice question picks the cheapest model likely to finish correctly on the first try, with per-option capability notes. (3) Face-value checks — embeddings derive the candidate list first, then the decision model judges each result against the search intent and reranks by probability (+25% ranking quality on 20 test queries). (4) Replacing overqualified LLMs — chart picking for SQL results now uses a decision model over the query and first three rows instead of deterministic rules. The pitfalls are as instructive: thresholds don't transfer across model versions (v1 vs v2 differed; now per-project configurable with shadow-mode judges recalibrated on hand-labeled data); chained multi-step judgments flooded their model server (an hourly 12–38k-token ranking job blocked other products for hours); and ranking PR-review findings scored AUC 0.52 — Jev caps at 64k tokens per request and its long-context mode is slower and less accurate. Jeeves, a hybrid decision model that reasons before deciding when unsure, is now the default for decision calls that don't name a model.