S8-10 · 基础S8-10 · Foundation

Token 与成本预算 · 每个节点都便宜,重试起来也可能整条超支Token and Cost Budget · Cheap Nodes Can Still Produce an Over-budget Chain After Retries

context + samples + retries → per-node token flow → cumulative cost → degrade or stop

Token 与成本预算(Token and Cost Budget)是为输入、输出、重试及工具链设定 token 与货币消耗上限。单次便宜不代表端到端、含重试的任务便宜。A token and cost budget caps input, output, retries, and tool-chain consumption. A cheap single call does not guarantee a cheap end-to-end task once retries are included.

01 · 每站只收几分钱,为什么一张账单最后超了十倍01 · If every stage costs only cents, how does the final bill exceed budget tenfold?

上下文翻倍、采样从 1 次增到 4 次、失败再重试两轮。每次调用看着不贵,整条链还在预算内吗?Context doubles, samples rise from one to four, and failures retry twice. Each call still looks cheap. Is the whole chain within budget?

02增减上下文、采样数与重试,让 token 流量逐节点累加并触发降级或停止Change Context, Sample Count, and Retries to Accumulate Token Flow per Node and Trigger Degrade or Stop

token 流量表 · 预算硬门token flow ledger · budget gate
状态 AMetric A
状态 BMetric B
状态 CMetric C

所有概率、分数、成本、token 与输出均为固定种子的教学模拟,不代表真实模型输出。把主变量拖回即可复核结论。All probabilities, scores, costs, tokens, and outputs are fixed-seed teaching simulations, not real model output. Move the main variable back to verify the conclusion.

03把刚才的变化拆成 4 个零件Break the Change into Four Parts

Token and Cost Budget
INPUT

输入 tokenInput tokens

系统指令、历史、检索证据与当前任务都会累计。System instructions, history, retrieved evidence, and the current task all accumulate.

OUTPUT

输出与采样Output and sampling

多候选让生成 token 按采样数放大。Multiple candidates multiply generated tokens by sample count.

RETRY

重试放大Retry multiplier

失败重试会再次支付相关上游与模型节点。Retries repay affected upstream and model stages.

GATE

预算动作Budget action

接近上限先降级,超硬门则停止,不靠事后报表补救。Degrade near the cap and stop at the hard limit instead of relying on after-the-fact reports.

04最小机制:主交互能逐项验证Minimal Mechanism: Verify Each Link in the Interaction

MECHANISM
total_tokens = Σnode (input + output) × attempts
主交互逐节点累加 token 与教学成本;超过软门降采样、压上下文,仍超过硬预算则停止后续节点。The interaction accumulates tokens and teaching cost by node. Crossing the soft gate reduces samples and context; crossing the hard cap stops downstream work.
配置工作量Configure workload上下文 / 采样 / 重试context / samples / retries
逐节点累计Accumulate per nodetoken + 教学成本tokens + teaching cost
执行预算动作Enforce budget正常 / 降级 / 停止normal / degrade / stop

05把上下文、采样与重试全部推高,直到硬预算停止Raise Context, Samples, and Retries Until the Hard Budget Stops the Chain

主动制造失败Create a failure

边界实验Boundary experiment

预算不是页面右上角的数字。它必须在节点执行前生效,超预算时明确显示哪些节点被降级或未执行。A budget is not a dashboard number. It must act before node execution and clearly show which stages degraded or never ran.

尚未执行。先在主交互中观察正常机制。Not run yet. Observe the normal mechanism in the main interaction first.
只统计最终模型调用就够。Only the final model call needs accounting.→ ✓ 上下文、检索、采样与重试都进入端到端账本。Context, retrieval, samples, and retries all belong in the end-to-end ledger.
单次调用便宜就不会超预算。A cheap call cannot exceed budget.→ ✓ 采样和重试会乘法放大整条链成本。Sampling and retries multiply chain-wide cost.
超预算后记录告警即可。An alert after overspend is enough.→ ✓ 软门要降级,硬门要在继续花费前停止。The soft gate degrades and the hard gate stops before more spend.
06 · 一句话带走06 · One line to keep

Token 与成本预算必须按节点累计上下文、输出、采样和重试;接近上限就降级,越过硬门就停止,不能等账单出来再解释。Token and cost budgets accumulate context, output, sampling, and retries by node. Degrade near the cap and stop at the hard gate, before the bill arrives.