符号说明

Machine Learning Systems spans machine learning (computer science and statistics) and systems (computer architecture and hardware). Each field developed its notation independently, and many symbols mean different things across communities and publications. This collision creates real confusion when the disciplines merge. The conventions below establish a single notation that eliminates this ambiguity.

Consider a simple statement: “Increasing \(B\) improves throughput.” To an ML researcher, \(B\) means batch size. To a hardware engineer, \(B\) means bandwidth. Both interpretations are correct in their respective fields, but in ML Systems we need both concepts in the same equation—hence the need for a single, consistent convention.

The Iron Law of ML Systems

For serialized execution phases, the iron-law performance decomposition is:

\[T = \underbrace{\frac{D_{\text{vol}}}{\text{BW}}}_{\text{Memory Time}} + \underbrace{\frac{O}{R_{\text{peak}} \cdot \eta_{\text{hw}}}}_{\text{Compute Time}} + \underbrace{L_{\text{lat}}}_{\text{Latency Overhead}}\]

Each variable was chosen deliberately to avoid collision with standard ML terminology.

Symbol Definition Unit Why This Symbol?
\(T\) Time seconds Unambiguous. Wall-clock time for an operation.
\(D_{\text{vol}}\) Data Volume bytes Avoids collision with \(D\) (Dataset Size). In scaling laws, \(D\) means training tokens. Here we need bytes moved through memory. The subscript disambiguates.
\(\text{BW}\) Bandwidth bytes/s Avoids collision with \(B\) (Batch Size). Systems literature often uses \(B\) for bandwidth, while ML literature often uses \(B\) for batch size. The notation preserves the ML convention.
\(O\) Operations FLOPs Total floating-point operations. Clean in equations (vs. “\(\text{Ops}\)”).
\(R_{\text{peak}}\) Peak Rate FLOP/s Avoids collision with \(P\) (Parameters). Roofline presentations often use \(P\) for performance, while ML literature commonly uses \(P\) for parameter count. The notation preserves the ML convention.
\(\eta_{\text{hw}}\) Efficiency — Hardware utilization \((0 \le \eta_{\text{hw}} \le 1)\). Avoids collision with learning rate \((\eta)\).
\(L_{\text{lat}}\) Latency seconds Avoids collision with \(\mathcal{L}\) (Loss). Fixed overhead time (kernel launch, network RTT). The subscript distinguishes from the loss function.

Why these choices matter

Without careful notation, sentences become ambiguous:

“Reducing \(D\) improves performance.”

The sentence has two possible readings:

  • Reducing dataset size (fewer training samples) can speed training but may reduce accuracy.
  • Reducing data volume moved (for example, through compression or quantization) can speed inference, with accuracy effects that depend on the technique and calibration.

With our notation, we can write precisely:

“Reducing \(D_{\text{vol}}\) through FP32-to-INT8 quantization cuts parameter memory traffic to one quarter while \(D\) (training data) remains unchanged.”

Our notation eliminates this ambiguity: “\(\text{BW}\) limits throughput” has only one reading.

Subscripted variants

An upright root names the quantity, and the subscript names which instance of it is meant. The convention holds closely related measurements apart instead of collapsing them into a single symbol:

  • \(\text{BW}_{\text{disk}}\), \(\text{BW}_{\text{network}}\), \(\text{BW}_{\text{accelerator}}\): bandwidth at three points on the data path
  • \(D_{\text{vol}}\), \(R_{\text{peak}}\), \(L_{\text{lat}}\), \(\eta_{\text{hw}}\): iron-law terms, each held clear of a common ML symbol
  • \(E_{\text{move}}\), \(E_{\text{compute}}\), \(E_{\text{total}}\): one energy budget split into tradeable parts

The subscript therefore carries part of the claim. Disk and accelerator bandwidth differ by orders of magnitude, so a figure is reproducible only when the subscript says where it was measured.

The Degradation Equation

The degradation equation is a fitted local model. Divergence alone does not determine the direction of accuracy change, so estimate \(\lambda\) from labeled outcomes. Some symbols below, such as \(\tau\), appear in chapter prose rather than in the equation. \[\text{Accuracy}(t) \approx \text{Accuracy}_0 - \lambda \cdot \mathcal{D}(P_t \lVert P_0)\]

Symbol Definition Unit/Type Notes
\(\text{Accuracy}(t)\) Accuracy at Time \(t\) Scalar Model accuracy after the model has been deployed for time \(t\).
\(\text{Accuracy}_0\) Initial Accuracy Scalar Model accuracy at deployment time.
\(\lambda\) Fitted Sensitivity Scalar Local coefficient estimated from outcomes over a stated range; not a universal constant. (Not wavelength.)
\(P_t\) Current Distribution Distribution The data distribution at time \(t\). (Not parameters—use \(P\) for parameter count.)
\(P_0\) Training Distribution Distribution The data distribution at training time.
\(\mathcal{D}(P_t \lVert P_0)\) Statistical Divergence Scalar \(\ge 0\) Measures how far \(P_t\) has drifted from \(P_0\). Common choices: KL divergence, total variation, Wasserstein. (Calligraphic to avoid collision with \(D\) = dataset size.)
\(\tau\) Response Threshold Scalar \(> 0\) Operational threshold for investigation; it does not automatically trigger retraining.

The Energy Corollary

With effective per-byte and per-operation costs, workload energy is approximated as: \[E_{\text{total}} \approx D_{\text{vol}} \times E_{\text{move}} + O \times E_{\text{compute}}\]

Symbol Definition Unit Notes
\(E_{\text{total}}\) Total Energy joules Total energy consumed by an ML workload, decomposed into data-movement and compute terms.
\(E_{\text{move}}\) Energy per Byte Moved joules/byte Effective movement cost; total energy also depends on bytes moved and operations executed.
\(E_{\text{compute}}\) Energy per Operation joules/FLOP Energy cost of a single arithmetic operation.

Deep Learning Notation

This book follows standard deep learning conventions (Goodfellow 等 2016年) with explicit disambiguation for systems variables.

Goodfellow, Ian, Yoshua Bengio, 和 Aaron Courville. 2016年. Deep Learning. MIT Press.
Symbol Definition Dimensions/Type
\(B\) Batch Size Integer. The number of samples processed in parallel. (Never bandwidth.)
\(P\) Parameters Integer. The total count of scalar model parameters, including weights and biases. (Never peak FLOP/s.)
\(D\) Dataset Size Integer. Number of training samples or tokens. (Never data volume in bytes—use \(D_{\text{vol}}\).)
\(S\) Sequence Length Integer. Number of tokens or time steps.
\(d\) Hidden Dimension Integer. Size of the hidden state vector.
\(d_{\text{head}}\) Attention Head Dimension Integer. Per-head hidden dimension in attention layers.
\(N_L\) Number of Layers Integer. Total number of layers in a network.
\(N_{\text{heads}}\) Number of Attention Heads Integer. Number of attention heads in a multi-head attention layer.
\(H_{\text{KV}}\) Number of Key-Value Heads Integer. Number of key-value heads in grouped-query or multi-query attention.
\(\ell\) Layer Index Integer. Index for a layer. Use instead of bare \(L\) when indexing layers, since \(L\) collides with loss and latency.
\(\mathcal{L}\) Loss Function Scalar. The objective function minimized during training.
\(\eta\) Learning Rate Scalar. Step size for the optimizer. (Never bare for hardware efficiency—use \(\eta_{\text{hw}}\).)
\(\theta\) Model Parameters Parameter collection, often treated as a vector. The set of all learnable parameters.
\(p(x)\) Distribution Probability mass/density for a random variable. Use lowercase \(p(\cdot)\) for generic distributions to avoid collision with \(P\) (parameter count).
\(p(y \mid x)\) Conditional Distribution Conditional probability/density. Use this form for generic label relationships; reserve \(P_0\) and \(P_t\) for the degradation equation’s training/current distributions.
\(\Pr(E)\) Event Probability Probability of an event \(E\). Use for event statements such as \(\Pr(\text{batch}=0)\); use \(p(x)\) and \(p(y \mid x)\) for distributions.

Latin matrices and vectors are set in bold (\(\mathbf{W}\), \(\mathbf{x}\)); scalars, dimensions, indices, and individual matrix entries stay italic (\(N\), \(d\), \(i\), \(W_{ij}\)). The generic parameter symbol \(\theta\) is the one conventional exception and stays italic. Local matrix algebra follows the same bold rule: matrix operands are bold (\(\mathbf{A}\), \(\mathbf{B}\), \(\mathbf{C}\)), as in general matrix multiply (GEMM) \(\mathbf{C}=\alpha \mathbf{A}\mathbf{B}+\beta \mathbf{C}\). The bold form marks a matrix operand and is distinct from the italic scalar batch size \(B\), which remains batch size in scalar contexts.

Performance, Serving, and Memory Notation

Reusable performance and serving quantities follow the same collision-avoidance rule as the iron law. Rates use \(R\) or descriptive Greek symbols; request counts use \(Q_{\text{req}}\) rather than overloading \(N\); queue utilization uses a subscripted \(\rho\) so bare \(\rho\) remains available for other ratio models.

Symbol Definition Unit/Type Notes
\(I\) Arithmetic Intensity FLOP/byte Workload FLOPs per byte moved. The Roofline Model uses \(I\) as the independent variable.
\(I_{\text{ridge}}\) Roofline Ridge Point FLOP/byte \(I_{\text{ridge}} = R_{\text{peak}}/\text{BW}\). Prefer this explicit form over starred shorthand so the meaning remains clear in prose.
\(R_{\text{attain}}\) Attainable Compute Rate FLOP/s Roofline bound: \(R_{\text{attain}} \leq \min(R_{\text{peak}}, I \times \text{BW})\). Uses \(R\), not \(T\), because this quantity is a rate.
\(\text{MFU}\) Model FLOPs Utilization Dimensionless Useful model FLOP/s divided by available peak FLOP/s. Text acronym avoids overloading \(\eta\).
\(r_{\text{comp}}\) Compression Ratio Dimensionless Uncompressed size divided by compressed size. A compressed payload has \(1/r_{\text{comp}}\) of the uncompressed size; the subscript avoids bare \(C\) collisions.
\(Q_{\text{req}}\) Request Concurrency requests Average in-flight requests in a stable serving system (\(Q_{\text{req}} = \lambda_{\text{arr}} \cdot T_{\text{lat}}\) via Little’s Law). Avoids collision with \(N\) as device count in distributed settings.
\(\lambda_{\text{arr}}\) Arrival Rate requests/s Request arrival rate. The subscript avoids collision with \(\lambda\) as degradation sensitivity or failure rate.
\(T_{\text{lat}}\) Request Time in System seconds End-to-end queueing/serving latency for Little’s Law. Distinct from \(L_{\text{lat}}\), the fixed-latency term in the iron law.
\(T_{\text{svc}}(B)\) Batch Service Time seconds Time to serve a batch of size \(B\).
\(\mu_{\text{eff}}(B)\) Effective Service Rate requests/s Batched service rate, typically \(\mu_{\text{eff}}(B) = B/T_{\text{svc}}(B)\).
\(\rho_{\text{serv}}\) Serving Utilization Dimensionless Queue/server utilization. Use instead of bare \(\rho\), which is reserved for communication-computation ratio in distributed contexts.
\(M_{\text{total}}\) Total Memory Footprint bytes Sum of explicit memory components; avoids bare \(M\) ambiguity.
\(M_{\text{weights}}\) Weight Memory bytes Memory occupied by model parameters.
\(M_{\text{gradients}}\) Gradient Memory bytes Memory occupied by stored gradients.
\(M_{\text{optimizer}}\) Optimizer-State Memory bytes Momentum, variance, master weights, and related optimizer buffers.
\(M_{\text{activations}}\) Activation Memory bytes Retained activations for the backward pass or serving intermediates.
\(s_{\text{elem}}\) Element Storage Size bytes/element Bytes per stored tensor element.

Units and Precision

  • Physical units: This book uses SI (metric) units throughout, including meters, kilograms, seconds, watts, and °C, consistent with standard engineering and scientific practice. Where source data was originally reported in imperial units, the book converts to SI and notes the original values parenthetically. A space always separates the number from the unit (for example, 100 ms, 2 TB/s).
  • Data and memory: This book uses decimal SI prefixes only: KB = \(10^3\) bytes, MB = \(10^6\), GB = \(10^9\), TB = \(10^{12}\). Binary-prefixed units do not appear in prose; all capacities, throughputs, and model sizes are reported in decimal units (for example, 80 GB, 2 TB/s, 102 MB).
  • Compute: The notation distinguishes operation counts from rates. Total work uses FLOPs (for example, GFLOPs, TFLOPs), while throughput uses FLOP/s with decimal prefixes (for example, GFLOP/s, TFLOP/s).
    • 1 TFLOP = \(10^{12}\) FLOPs
    • 1 TFLOP/s = \(10^{12}\) FLOPs per second
    • Arithmetic intensity conventionally uses FLOP/byte as a unit ratio (floating-point operations per byte moved). This is a ratio unit, not a total-work symbol or throughput symbol.
  • Currency: Dollar amounts use the dollar sign ($); unless otherwise noted, dollar-denominated costs are U.S. dollars (USD).
  • Precision:
    • FP64: Double precision (8 bytes)
    • FP32: Single precision (4 bytes)
    • TF32: TensorFloat-32 (19-bit Tensor Core compute mode; inputs and storage remain FP32)
    • FP16: Half precision (2 bytes, standard range)
    • BF16: Brain float (2 bytes, wide dynamic range)
    • FP8: Quarter precision (1 byte, E4M3 or E5M2 format)
    • FP4: 4-bit floating-point format
    • INT8: 8-bit integer (1 byte)
    • INT4: 4-bit integer; lower integer precisions follow the same uppercase INTn pattern (for example, INT3, INT2)

Quick Reference: Resolving Collisions

Common collision points in ML Systems literature include:

Symbol ML Meaning Systems Meaning Book Convention
\(B\) Batch Size Bandwidth Batch Size. Use \(\text{BW}\) for bandwidth.
\(P\) Parameters Peak FLOP/s Parameters. Use \(R_{\text{peak}}\) for peak rate.
\(D\) Dataset Size Data Volume Dataset Size. Use \(D_{\text{vol}}\) for bytes moved.
\(L\) Loss Latency Loss \((\mathcal{L})\). Use \(L_{\text{lat}}\) for latency.
\(\eta\) Learning Rate Efficiency Learning Rate. Use \(\eta_{\text{hw}}\) for efficiency.

As a general principle, ML conventions take precedence for single letters, while systems concepts get subscripts or multi-letter symbols. This reflects the primary audience (ML practitioners learning systems) and preserves compatibility with the vast ML literature.

智能体系统记号

本书新增了用于表示轨迹、任务契约、H·S·A 暴露、模型调用及其预算、轨迹的时间与成本、恢复以及从轨迹中学习的记号。上文的通用表格仍规定其所定义的每一个符号,本扩展仅在此基础上增补。仅出现在某一处推导中的符号会在使用处定义,不在此列出。

本书反复使用以下五个关系式。轨迹是单个委派任务的有序记录,记为

\[\tau = (s_0, a_0, o_1, s_1, a_1, o_2, \dots, s_T)\]

在 \(H\) 轮的时间范围内,其按实际经过时间计量的持续时间为

\[T_{\text{task}} = \sum_{k=1}^{H} \left( T_{\text{model}}^{(k)} + T_{\text{tool}}^{(k)} + T_{\text{wait}}^{(k)} + T_{\text{runtime}}^{(k)} \right)\]

轨迹有效吞吐率是资源 \(R\)(轮次、词元、沙箱时间或美元)中用于结果通过验证的轨迹的份额,

\[\mathcal{G} = \frac{\sum_{i \in \mathcal{T}_{\text{success}}} R_i}{\sum_{j \in \mathcal{T}_{\text{all}}} R_j}\]

一条轨迹若连续执行 \(N\) 个提议而不检查其中任何一个,每个提议正确的概率均为 \(1 - \epsilon\),且彼此独立,则其错误会累积,成功概率为

\[\Pr(\text{success}) = (1 - \epsilon)^N\]

每个获接受任务的成本,是将 \(N\) 次尝试的全部支出除以其中获接受的 \(N_{\text{acc}}\) 次尝试,

\[C_{\text{eff}} = \frac{\sum_{i=1}^{N} C_{\text{attempt}, i}}{N_{\text{acc}}}\]

轨迹与智能体循环

循环中的符号描述轨迹的一轮:运行时组装的上下文、模型返回的提议、运行时对该提议作出的决策,以及返回的结果。

符号 定义 单位 说明
\(\tau\) 轨迹 元组 单个委派任务的有序记录,\(\tau = (s_0, a_0, o_1, \dots, s_T)\)。本书中,单独出现的 \(\tau\) 始终表示一条轨迹。
\(t\) 轮次索引 整数 对轨迹内的轮次计数。\(s_T\) 表示最后一轮结束后的状态。
\(g\) 目标 文本 委派的任务及其完成规则,在整条轨迹中保持固定。任务契约将其记为 \(G\)。
\(c_t\) 上下文 词元 运行时在第 \(t\) 轮组装并发送的内容:指令、目标、工具定义,以及动作、观测和证据的历史记录。
\(s_t\) 第 \(t\) 轮的状态 记录 模型在第 \(t\) 轮看到的上下文状态。在第五部分中,指策略所依据的条件状态。
\(a_t\) 动作提议 文本或工具调用 模型在第 \(t\) 轮提出的内容。在运行时准许该提议之前,不会执行任何操作。
\(a_{\text{prop}}\), \(a_{\text{perm}}\) 提议的动作、获准的动作 工具调用 分别表示运行时检查前的提议,以及检查后准许的动作。
\(o_t\) 观测 带类型的结果 动作返回的内容,例如退出码、捕获的输出、响应体或状态。
\(v_t\) 验证证据 通过/失败或分数 运行时对动作执行后的状态进行检查所得的结果,独立于动作本身和模型的报告。
\(\pi_\theta\) 策略 分布 将模型视为给定上下文时提议的概率分布,其参数为 \(\theta\)。
\(\mathcal{S}\) 智能体系统 元组 \(\mathcal{S} = \langle \pi_\theta, \mathcal{H}, \mathcal{E}, \mathcal{M}, \mathcal{V} \rangle\):策略、运行框架、环境、记忆和验证器。
\(\mathcal{I}\) 闭包算子 函数 \(\mathcal{I}: \mathcal{A}_{\text{prop}} \times \mathcal{S}_{\text{sys}} \to \mathcal{A}_{\text{perm}} \cup \{\bot\}\)。运行时根据当前系统状态 \(\mathcal{S}_{\text{sys}}\) 对每个提议进行的检查。
\(\bot\) 拒绝 符号 被拒绝的提议。它以带类型的错误形式传递给模型,并使环境保持不变。

任务契约

任务契约规定一条轨迹的目的、运行位置、允许执行的操作与可见的信息,以及终止条件。

符号 定义 单位 说明
\(\mathcal{C}\) 任务契约 元组 \(\mathcal{C} = \langle G, \mathcal{E}_{\text{env}}, \mathcal{A}_{\text{perm}}, \mathcal{O}_{\text{avail}}, \mathcal{K}_{\text{comp}} \rangle\)。
\(G\) 目标 文本 期望达到的最终状态,并明确不包含的范围。
\(\mathcal{E}_{\text{env}}\) 环境 规约 工作发生的可复现环境:基准提交、镜像、配置、网络规则。
\(\mathcal{A}_{\text{perm}}\) 允许的操作 集合 任务可调用的工具及每种工具的使用限制。按任务明确最小权限。
\(\mathcal{O}_{\text{avail}}\) 可用观测 规约 智能体可以看到什么以及可以看到多少,包括截断和脱敏规则。
\(\mathcal{K}_{\text{comp}}\) 完成标准 检查项集合 在指定的闭环证据级别上,判定任务何时完成的检查项。模型声称任务已完成,绝不属于这些检查项。

H·S·A 暴露维度

H·S·A 表示智能体任务相较于单次模型调用新增的三个暴露维度。任务在这些维度上的位置表明其暴露程度。运行时必须针对这种暴露提供的闭环保障由不变式闭环原则决定,并非第四个维度。零环境权限描述的是模型在每个权限级别上的状态,没有对应的符号。

符号 定义 单位 说明
\(H\) 跨度 轮次 一条轨迹运行的轮次数:\(H = 1\)(单次调用)、\(H \approx 10\)(短循环)、\(H \geq 100\)(数分钟至数小时)。给定 \(H\) 时,实际经过的时间为 \(T_{\text{task}}\)。
\(S_0\) 至 \(S_3\) 状态 级别 任务在轮次之间携带的内容:\(S_0\)(无)、\(S_1\)(上下文窗口和 KV 缓存)、\(S_2\)(沙箱中的工作文件)、\(S_3\)(持续时间超出会话,或共享范围超出会话的持久状态)。书写时附带级别,因为单独的 \(S\) 表示序列长度。
\(A_0\) 至 \(A_3\) 权限 级别 任务通过其工具可以执行的操作:\(A_0\)(读取权限)、\(A_1\)(修改仅限于可丢弃的沙箱内)、\(A_2\)(可安全重试或可补偿的外部操作)、\(A_3\)(不可逆的外部操作)。该维度同时涵盖机密性与完整性,因此 \(A_0\) 并不意味着影响范围为零。

闭环证据级别从弱到强依次为:自我报告、静态检查、可见测试、封闭测试和形式化证明。这些级别使用文字命名,没有对应的符号。

模型调用与预算

模型调用受到其上下文窗口以及运行时为每个请求设置的限制约束。轨迹则受到智能体运行框架在上下文之外维护的预算约束。

符号 定义 单位 说明
\(S\) 序列长度 词元 序列长度的通用符号,此处用于表示一次调用所读取的提示词长度。状态暴露维度始终附带级别书写,即 \(S_0\) 至 \(S_3\)。
\(K\) 输出长度 词元 一次调用生成的词元数。小写 \(k\) 专用于表示样本数,例如 pass@\(k\)。
\(S_{\max}\) 上下文窗口 词元 每次调用中提示词与输出总长度的硬性上限:\(S + K_{\max} \le S_{\max}\)。
\(K_{\max}\) 输出上限 词元 运行时允许一次调用生成的最大词元数。
\(B_{\text{reason}}\) 推理预算 词元 一次调用在作答前可消耗的推理词元数上限。
\(t_{\text{tok}}\) 每词元解码时间 秒 在单个流上生成一个输出词元所需的时间。
\(T_{\text{call}}\) 调用延迟 秒 \(T_{\text{call}} \approx T_{\text{queue}} + T_{\text{prefill}}(S) + K \cdot t_{\text{tok}}\)。前两项之和为首词元延迟。
\(\mathbf{B}\) 轨迹预算 向量 \(\mathbf{B} = \langle H_{\max}, N_{\max}, T_{\max}, C_{\max} \rangle\),分别为轮次、词元数、实际经过时间和美元费用的上限,由智能体运行框架在每次调用前检查。使用粗体,以区别于批大小 \(B\)。
\(T_{\max}\) 截止时间 秒 运行时对单次调用或整条轨迹强制执行的实际经过时间上限。正文会指明其适用范围。
\(C_{\max}\) 费用上限 美元 运行时在发起下一次调用前强制执行的支出上限。
\(m_{\text{token}}\) 每词元 KV 字节数 字节/词元 \(m_{\text{token}} = 2 \cdot N_L \cdot H_{\text{KV}} \cdot d_{\text{head}} \cdot s_{\text{elem}}\),使用表示层数、KV 头数、头维度和元素大小的通用符号。
\(M_{\text{KV}}\) KV 内存占用 字节 一条轨迹在加速器内存中保留的注意力状态,\(M_{\text{KV}} = S \cdot m_{\text{token}}\)。
\(O_{\text{mem}}\) 等待期间占用的内存 字节·秒 \(O_{\text{mem}} = M_{\text{KV}} \cdot T_{\text{wait}}\),表示暂停的轨迹在等待工具时持续占用的加速器内存。

轨迹的时间与费用

智能体系统以每个通过验收的任务为单位进行度量,而非以每次请求为单位。时间项分解单个回合的耗时,成本项则量化各次尝试及其所换取的通过验收结果的费用。

符号 定义 单位 说明
\(T_{\text{task}}\) 轨迹时长 秒 对各回合的模型耗时、工具耗时、等待时间和运行时耗时求和。
\(T_{\text{model}}\) 模型耗时 秒 单个回合中用于模型调用的时间。
\(T_{\text{tool}}\) 工具耗时 秒 工具执行所需的时间,例如构建或运行测试的时间。
\(T_{\text{wait}}\) 外部等待时间 秒 等待远程服务或人工批准所花费的时间。
\(T_{\text{runtime}}\) 运行时耗时 秒 运行时自身工作的耗时:组装上下文、验证提议、执行检查。
\(\mathcal{T}_{\text{all}}\), \(\mathcal{T}_{\text{success}}\) 轨迹集合 集合 所有已派发的轨迹,以及其中结果通过验证的轨迹子集。带下标的花体 \(\mathcal{T}\) 始终表示轨迹集合。
\(\mathcal{G}\) 轨迹有效利用率 比例 \([0, 1]\) 资源中用于结果通过验证的轨迹的份额。无效利用率为 \(1 - \mathcal{G}\)。
\(C_{\text{task}}\) 轨迹成本 美元或词元 单条轨迹的支出,并对照 \(C_{\max}\) 进行核查。
\(C_{\text{attempt}}\) 尝试成本 美元 单次尝试的全部成本:输入和输出词元、工具费用、沙箱运行时间、验证及人工审核。
\(N_{\text{acc}}\) 通过验收的尝试 次数 结果通过验收检查的尝试。
\(C_{\text{eff}}\) 每个通过验收任务的成本 美元/任务 所有尝试的总支出除以 \(N_{\text{acc}}\)。失败的尝试也须全额付费。

恢复、评估与学习

这些符号在运行时、评估和学习各章中反复出现。

符号 定义 单位 说明
\(k_{\text{idem}}\) 幂等键 字符串 由轨迹、回合、调用、工具和规范化参数确定性地派生的键,确保重试调用不会重复产生同一效果。
\(K_{\text{repair}}\) 修复次数上限 次数 对单个失败步骤进行前向修复的最大尝试次数;达到上限后,智能体运行框架执行补偿或升级处理。
pass@\(k\) \(k\) 次运行中至少一次成功的概率 概率 同一任务的 \(k\) 次运行中至少一次成功的概率。该指标衡量潜力,只有验证器在各次运行中进行选择时才能达到。
pass\(^k\) \(k\) 次运行全部成功的概率 概率 同一任务的全部 \(k\) 次运行均成功的概率。该指标衡量重复运行的可靠性。
\(m_t\) 损失掩码 二元值 \(\{0, 1\}\) 策略生成的词元(推理、工具调用、回答)取 \(m_t = 1\),提示和观测中的词元取 \(m_t = 0\)。
\(\mathcal{L}_{\text{SFT}}\) 掩码微调损失 交叉熵 \(\mathcal{L}_{\text{SFT}}(\theta) = -\sum_t m_t \log \pi_\theta(x_t \mid x_{<t})\)。
\(R(\tau)\) 轨迹奖励 标量 验证器赋予整条轨迹的奖励。
\(\hat{V}(s_t)\) 价值估计 标量 从状态 \(s_t\) 出发的成功概率估计。
\(\hat{A}(s_t, a_t)\) 优势估计 标量 某个动作使价值估计提高的幅度,即 \(\hat{V}(s_{t+1}) - \hat{V}(s_t)\)。与权限等级 \(A_0\) 至 \(A_3\) 不同。

消除符号冲突

智能体系统借用机器学习、系统和控制领域的记号,因此有些字母具有不止一种含义。以下约定确保每个符号只表达一种含义。

符号 其他常见含义 本书约定
\(\tau\) 温度;阈值 不带修饰的 \(\tau\) 表示轨迹。采样温度用文字表述,或写作 \(\tau_{\text{temp}}\)。
\(H\) 注意力头数;隐藏层维度 \(H\) 表示以回合数计的时域长度。注意力头使用 \(N_{\text{heads}}\) 和 \(H_{\text{KV}}\);隐藏层维度使用 \(d\)。
\(S\) 状态暴露 不带修饰的 \(S\) 表示序列长度。状态仅以带等级的形式书写,即 \(S_0\) 至 \(S_3\)。
\(A\) 优势;动作集合 权限仅以带等级的形式书写,即 \(A_0\) 至 \(A_3\)。优势使用 \(\hat{A}\);动作集合使用 \(\mathcal{A}_{\text{prop}}\) 和 \(\mathcal{A}_{\text{perm}}\)。
\(P\) 提示长度;精度 \(P\) 表示参数量,与共用表格中的定义一致。提示长度使用 \(S\)。
\(B\) 预算 \(B\) 表示批大小。轨迹预算使用粗体 \(\mathbf{B}\),推理预算使用 \(B_{\text{reason}}\)。
\(C\) 第四个分类轴 不存在 \(C\) 轴;闭环证据等级用文字命名。成本带有下标(\(C_{\text{task}}\)、\(C_{\text{eff}}\)、\(C_{\max}\)),任务契约使用 \(\mathcal{C}\)。
\(\mathcal{G}\) 目标 \(\mathcal{G}\) 表示轨迹有效利用率。目标在循环中使用 \(g\),在任务契约中使用 \(G\)。
\(\mathcal{T}\) 步骤序列 带下标的花体 \(\mathcal{T}\) 表示轨迹集合。时间使用 \(T\)。
\(K\) 前 \(k\) 项;样本数 \(K\) 表示以词元数计的输出长度。样本数使用小写 \(k\),如 pass@\(k\)。

其他单位

  • 词元用于计数一次调用读取和写入的内容,模型服务的吞吐量以每秒词元数报告。
  • 回合用于计数轨迹的步骤,时域长度 \(H\) 以回合数计量。
  • 每个通过验收任务的美元成本以通过验收的结果数量对支出进行归一化,而非以尝试次数或请求次数进行归一化。
  • 轨迹有效利用率(\(\mathcal{G}\))以 \([0, 1]\) 范围内的比例或百分比报告,同时注明所计量的资源。
  • 字节秒用于衡量内存占用量随时间的累积,例如在等待工具执行期间持续驻留的注意力状态。
回到顶部
← 三卷书架