Skip to content
Development
Skill

/agentsop-cost-tiered-models

Split a multi-call LM workflow by cognitive load, not by accuracy: let one strong model make the few reasoning decisions and a cheap model do the many mechanical executions (Aider architect+editor, DSPy optimizer-LM vs task-LM, vLLM speculative draft+target, LangGraph

From plugin
skillalchemy
28747 skills
Install
$ npx -y skills add agentsope/SkillAlchemy --skill agentsop-cost-tiered-models --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/agentsop-cost-tiered-models

Context preview

The summary Claude sees to decide when to auto-load this skill.

Split a multi-call LM workflow by cognitive load, not by accuracy: let one strong model make the few reasoning decisions and a cheap model do the many mechanical executions (Aider architect+editor, DSPy optimizer-LM vs task-LM, vLLM speculative draft+target, LangGraph

SKILL.md

agentsop-cost-tiered-models.SKILL.md
name: agentsop-cost-tiered-models
version: 0.1.0
description: >-
  Split a multi-call LM workflow by cognitive load, not by accuracy: let one strong model
  make the few reasoning decisions and a cheap model do the many mechanical executions
  (Aider architect+editor, DSPy optimizer-LM vs task-LM, vLLM speculative draft+target,
  LangGraph supervisor+worker are the same shape). Use when designing or cost-optimizing a
  pipeline that calls an LM many times, when deciding which steps need a strong reasoner vs
  a cheap executor, or when adding an escalation valve for when the cheap tier degrades.
  Search keywords: reduce LLM cost, cheaper model, lower token cost, model cascade, route to
  cheap model, strong model plus cheap model, LLM cost optimization.
domain: cost-aware model/role splitting in multi-call LM workflows
dated: 2026-05
audience: coder-agents and engineers designing multi-call LM pipelines
sources:
  - https://aider.chat/2024/09/26/architect.html
  - https://github.com/stanfordnlp/dspy/issues/1596
  - https://docs.vllm.ai/en/latest/features/speculative_decoding/
  - https://langchain-ai.github.io/langgraph/concepts/multi_agent/

Cost-aware Model/Role Split — "强推理者 + 廉价执行者"

> 一句话:一条多次调用 LM 的工作流里,**少数调用需要推理,多数调用是机械执行**。让一个强模型做决策,让一个便宜模型干活——按认知负荷拆分,不是按"哪个更准"拆分。

> **统一声明**:Phase B 发现这个模式在 4 个 SOP 里以 4 个名字反复出现——DSPy 的 optimizer-LM vs task-LM、Aider 的 architect+editor、vLLM 的 speculative draft+target、LangGraph 的 supervisor+worker。它们是**同一个形状**。本技能把这个形状抽出来,命名为 cost-tiered models。详见 §7 跨框架对照。

---

1. 何时激活 (When to activate)

任一情形成立时激活本技能:

  • 工作流会**对 LM 发起多次调用**,且这些调用**认知负荷不均**——有的需要规划/推理/判断,有的只是改写、抽取、格式化、应用一个已定好的决定。
  • 你正在为一条 LM 流水线**选模型**,并且默认想"全程用同一个最强模型"——这是本技能要挑战的反射。
  • 你有一个**强 reasoner 但执行差**的模型(典型:o1/o3 推理强但编辑代码格式脏),需要给它配一个干净的执行者。
  • 你在**成本/延迟压力**下,想知道哪些调用可以降级到便宜模型而不掉质量。
  • 你在设计 **agent 编排**(supervisor 路由 + worker 执行),或 **推理加速**(speculative draft + target verify),意识到这和上面是同一个决策。

**不应激活**(见 §6):

  • 单次调用、无内部步骤的工作流——没有可拆分的角色。
  • 微型工作流(2–3 次调用、总成本可忽略)——拆分的协调开销 > 节省。
  • 质量是唯一目标、成本无关紧要的场景——直接全程用最强模型。

---

2. 核心心智模型 (Core Mental Model)

**按认知负荷拆分:一个强模型做决策,一个便宜模型执行——而且绝大多数调用是执行。**

2.1 两层,不是一层

绝大多数团队的默认是"全程一个模型"。这把两种本质不同的工作混在了一个价位上:

| 层 | 工作性质 | 调用频率 | 模型要求 | 选谁 | |---|---|---|---|---| | **Tier-S(决策层)** | 规划、推理、路由、判断、提案 | **少**(每任务 1–N 次) | 推理强;执行干不干净不重要 | 最强 reasoner | | **Tier-E(执行层)** | 改写、抽取、格式化、应用决定、生成草稿 | **多**(占总调用 80%+) | 听话、格式干净、便宜、快 | 便宜/快模型 |

关键洞察:**成本由调用次数主导,调用次数由执行层主导**。所以把执行层降级到便宜模型,省下大部分成本,却几乎不碰决策质量——因为决策层调用次数少,仍然用最强模型。

2.2 为什么"强 reasoner 执行差"是常态而非例外

推理能力和指令依从(产出干净的 diff/JSON/格式)是两种不同的能力,不总同向。Aider 的 Polyglot 数据是最干净的证据:o1-preview **单独**跑 79.7%,但它当 architect 配一个便宜 editor 后,整体到 82.7%–85%——**两次便宜的专门调用胜过一次又贵又全能的调用** [aider.chat/2024/09/26/architect.html]。强模型负责"想",便宜模型负责"把想法落成格式正确的编辑"。

2.3 三种省钱方向,同一个形状

  • **省钱**:执行层从 GPT-4o 降到 mini/Llama,决策层不动。
  • **提质**:把"想"和"做"解耦,强模型不再被格式约束分心(JSON-wrapping 实测会降低模型推理能力 [aider.chat/2024/08/14])。
  • **提速**:便宜模型先草拟(draft),强模型只做验证(vLLM speculative decoding 的本质就是这个 [docs.vllm.ai speculative_decoding])。

三者都是"强决策 + 廉价执行"的拆分,只是优化目标不同。

2.4 升级阀门(escalation valve)

拆分不是单向的。便宜执行者会在某些输入上**失败或退化**(格式错、跑题、质量塌)。正确的设计带一个**回退-升级阀门**:检测到执行层失败 → 把这一步升级到强模型重试。便宜执行者覆盖 80–95% 的常规输入,强模型兜底长尾。这把"省钱"和"不掉质量"同时拿到。

---

3. SOP 工作流 (SOP Workflow)

[Step 0] 列出工作流里所有 LM 调用
   └─ 对每次调用记:它在"想"还是在"做"?预期调用频率?

[Step 1] 给每次调用打认知负荷标签
   ├─ 高推理(规划/路由/判断/提案/纠错)        → 候选 Tier-S
   └─ 机械执行(改写/抽取/格式化/应用决定/草稿)  → 候选 Tier-E
   规则:把"需要全局判断 / 一旦错代价高 / 频率低"的归 Tier-S,
        其余尽量下沉到 Tier-E。

[Step 2] 分配模型层
   ├─ Tier-S → 你能负担的最强 reasoner(少量调用,单价高无所谓)
   ├─ Tier-E → 便宜/快模型(大量调用,单价主导总成本)
   └─ 给 Tier-E 选最适配它的输出格式(弱模型用 whole/简单 schema,
      不要逼它产 token 高效但易错的 diff)。

[Step 3] 度量质量 delta(必须做,否则是赌博)
   ├─ baseline:全程强模型的质量分 + 成本
   ├─ split:S+E 拆分后的质量分 + 成本
   ├─ 看 (质量 delta, 成本 delta) 这一对,不要只看其一
   └─ 在你自己的真实任务上量,不要信别人 benchmark 的绝对数

[Step 4] 装升级阀门
   ├─ 定义"执行层失败"的可检测信号(格式不合法 / 测试不过 /
   │   schema 校验失败 / 自评分低)
   ├─ 失败 → 升级到 Tier-S 重试这一步(或换执行格式重试)
   └─ 记录升级率:若 >30%,说明这步本就属于 Tier-S,重新归类

[Step 5] 调拆分点(tune the split)
   ├─ 升级率高 / 质量掉太多 → 把更多步上移到 Tier-S
   ├─ 升级率近 0 / 质量持平 → 把更多步下沉到 Tier-E,再省一截
   └─ 拆分点是个滑块,不是开关;按 Step 3 的数往返调

---

4. 操作模型 (Operation Model)

OP-1: Role-tier mapping(角色→层映射)

  • **Trigger**: 一条多次调用 LM 的工作流,想知道哪些调用降级安全。
  • **Action**: 对每次调用问"它在想还是在做"。想(规划/路由/判断/提案)→ Tier-S;做(改写/抽取/格式化/应用)→ Tier-E。Tier-S 配最强 reasoner,Tier-E 配便宜模型。
  • **Output**: 一张 (调用 → 层 → 模型) 映射表 + 预期成本结构(哪层主导成本)。
  • **Evidence**: 四框架共有形状 §7;DSPy 文档明确"决定哪个模型优化 vs 哪个是 task model——它们可以不同" [dspy SKILL §3 Stage]。

OP-2: The architect+editor recipe(架构师+编辑者配方)

  • **Trigger**: 你有强 reasoner 但它执行(产出干净 diff/格式)差,或想给任何"推理后要落地"的步骤解耦。
  • **Action**: 强模型当 architect 只输出**自然语言方案**(不写最终格式);便宜模型当 editor 把方案落成格式正确的产物。给 editor 用瘦提示 + 它擅长的格式(Aider 自动切 `editor-diff`/`editor-whole`)。
  • **Output**: 两步管线:propose(强、自由文本)→ apply(廉价、严格格式)。
  • **Evidence**: Aider Polyglot Pass@2——o1-preview 单跑 **79.7%**,o1-preview+Sonnet **82.7%**,o1-preview+o1-mini(whole) **85%**;连 Sonnet 自配 editor 也从 77.4%→**80.5%** [aider.chat/2024/09/26/architect.html]。

OP-3: Fallback-escalation(回退-升级阀门)

  • **Trigger**: 便宜执行者在部分输入上失败/退化。
  • **Action**: 定义可检测的失败信号(格式非法、测试失败、schema 不过、自评低)→ 命中则把该步升级到 Tier-S 重试。记录升级率。
  • **Output**: 带升级阀门的执行层;升级率指标。
  • **Evidence**: vLLM speculative decoding 是硬件层同构——draft 提议、target 验证,验证失败就用 target 的真分布纠正 [docs.vllm.ai speculative_decoding];Aider 编辑错误时升级模型/换格式重试 [aider.chat/troubleshooting/edit-errors]。

OP-4: Format-by-tier(按层选输出格式)

  • **Trigger**: 给 Tier-E 选输出格式。
  • **Action**: 别让便宜模型背强模型的负担。弱执行者用解析最稳的格式(whole 文件 / 简单 schema),不要逼它产 token 高效但字节敏感的 diff。**绝不**把代码/复杂产物包进 JSON tool-call。
  • **Output**: 每个 Tier-E 调用的格式选择。
  • **Evidence**: "所有模型在 JSON 包裹下基准都变差,包括 Sonnet" [aider.chat/2024/08/14/code-in-json.html];Aider 已为各模型选好默认编辑格式。

OP-5: Cheap-optimizer / expensive-task(廉价优化器 + 昂贵任务模型)

  • **Trigger**: 你在自动调提示/搜索/编排(meta 层),而被服务的 task 调用很贵。
  • **Action**: meta 层(优化、提案、搜索)用便宜模型;被优化的 task 调用才用贵模型。注意这是 §2 的**镜像**——这里"决策/搜索"反而可以便宜,"执行任务"才贵。判据始终是:**哪类调用的质量直接进最终产物,哪类只是脚手架**。脚手架降级。

-

Read more
Ships withskillalchemy

From thought to skill. From signal to structure.

Get the whole plugin
Stats
289
Stars
17
Forks
Active
Maintenance
Python
Language
MIT
License
7d ago
Last commit
2mo ago
Created

Repo: agentsope/SkillAlchemy

Other skills on skillalchemy.