Skip to main content

Appendix I. Mathematical Supplement: Enhanced Metrics for Existing Chapters

This supplement gives formal definitions for metrics used in Chapters 2, 3, 7, 15, 21, and 27. Use it to check assumptions and notation when applying those metrics.

I.1 Enhanced Agent Quality Metrics (Chapter 2)

I.1.1 Reliability: pass@k and pass^k formalized

Let \(X_{ij} \in \{0,1\}\) indicate success on attempt \(j\) of task \(i\), with \(P(X_{ij} = 1) = p_i\).

pass@k: \(\text{pass@k}_i = 1 - (1 - p_i)^k\)

pass^k: \(\text{pass}^k_i = p_i^k\)

Reliability gap: \(\Delta_i(k) = 1 - (1 - p_i)^k - p_i^k\)

Large \(\Delta_i(k)\) indicates a consistency problem, not a capability gap.

I.1.2 Robustness to perturbation

Let \(f: \mathcal{X} \to \mathcal{Y}\) be the agent, \(M: \mathcal{Y} \times \mathcal{Y} \to [0,1]\) a per-example metric.

Population robustness: \[R_{\text{pop}} = \mathbb{E}_{(x,y) \sim \mathcal{D}}\mathbb{E}_{\delta \sim \mathcal{P}}[M(f(x + \delta), y)]\]

I.1.3 Calibration error

For probabilistic agent output \(\hat{p} = P(\text{success} \mid x)\):

\[\text{ECE} = \sum_{b=1}^{B} \frac{n_b}{N} |\text{acc}(b) - \text{conf}(b)|\]

MCE: \(\text{MCE} = \max_b |\text{acc}(b) - \text{conf}(b)|\). Overconfidence: \(\text{OC} = \mathbb{E}[\hat{p} - y]\).

I.1.4 Efficiency metrics

Cost per success: \(\text{CpS} = \frac{\mathbb{E}[\text{cost}]}{P(\text{success})}\). Latency-reliability Pareto frontier: \[\mathcal{F} = \{a \in \mathcal{A} : \nexists a' \text{ s.t. } L(a') \leq L(a) \land R(a') \geq R(a) \text{ with one strict}\}\]

I.2 Dataset Robustness Metrics (Chapter 3)

I.2.1 Coverage guarantees

For task groups \(g_k\) with coverage \(C_k = |\{i : x_i \in g_k\}|/N\):

Minimum coverage: \(C_{\min} = \min_k C_k\).

PAC guarantee: With probability \(1-\delta\), \(|\theta - \hat{\theta}| \leq \epsilon\) if \(N \geq \frac{\log(2/\delta)}{2\epsilon^2}\).

Group-specific (Bonferroni): \(N_k \geq \frac{\log(2K/\delta)}{2\epsilon_k^2}\).

I.2.2 Dataset difficulty and discrimination

Item discrimination: \(D_i = \frac{\partial P(Y_i = 1 \mid \theta)}{\partial \theta}\). Item difficulty: \(b_i = -\log P(Y_i = 1 \mid \theta = 0)\).

Fisher information: \(\mathcal{I}(\theta) = \sum_{i=1}^{N} \frac{1}{P(Y_i \mid \theta)(1 - P(Y_i \mid \theta))} \left(\frac{\partial P(Y_i \mid \theta)}{\partial \theta}\right)^2\).

I.2.3 Label uncertainty and inter-annotator agreement

Fleiss’ kappa: \(\kappa = \frac{\bar{P} - \bar{P}_e}{1 - \bar{P}_e}\). Krippendorff’s alpha: \(\alpha = 1 - \frac{D_o}{D_e}\).

Label uncertainty per item: \(U_i = -\sum_{j=1}^{C} \hat{p}_{ij} \log \hat{p}_{ij}\).

I.2.4 Dataset contamination detection

Contamination score: \(\text{contam}(x) = \max_{x' \in \mathcal{D}_{\text{train}}} s(x, x')\).

Contamination rate: \(\rho = \frac{1}{|\mathcal{D}_{\text{eval}}|}\sum_{x} \mathbb{I}\{\text{contam}(x) > \tau\}\).

Robustness degradation: \(\Delta R = A - R_{\text{pop}}\) where \(A = \mathbb{E}[M(f(x), y)]\).

Per-perturbation robustness: \(R_p = \mathbb{E}_{(x,y) \sim \mathcal{D}}\mathbb{E}_{\delta \sim \mathcal{P}_p}[M(f(x + \delta), y)]\).

I.3 Drift Detection: LLM Judge in Production (Chapters 7, 15, 21)

I.3.1 Judge score drift

For calibration set \(\mathcal{C} = \{\tau_1, \dots, \tau_M\}\):

Mean drift: \(\Delta\mu_t = \left|\frac{1}{M}\sum_{i} J_t(\tau_i) - \frac{1}{M}\sum_{i} J_{t-1}(\tau_i)\right|\).

Variance drift: \(\Delta\sigma^2_t = |\text{Var}(J_t(\mathcal{C})) - \text{Var}(J_{t-1}(\mathcal{C}))|\).

Judge ICC: \(\text{ICC}_{\text{judge}} = \frac{\sigma^2_{\text{trajectory}}}{\sigma^2_{\text{trajectory}} + \sigma^2_{\text{judge}} + \sigma^2_{\text{error}}}\).

I.3.2 Judge calibration drift

For probabilistic scores \(p_t(\tau) = P(\text{success} \mid \tau, t)\):

Calibration slope: \(y_i = \beta_0 + \beta_1 p_t(\tau_i) + \epsilon_i\). Ideal: \(\beta_0 = 0, \beta_1 = 1\).

Brier score decomposition: \[\text{BS} = \text{calibration} + \text{refinement} + \text{uncertainty}\]

I.4 Drift Detection: Evaluation Dataset (Chapters 3, 21)

I.4.1 Feature-level drift

\[\text{PSI}_j = \sum_{b=1}^{B} (p_{j,\text{cur},b} - p_{j,\text{ref},b}) \log\frac{p_{j,\text{cur},b}}{p_{j,\text{ref},b}}\]

MMD: \(\widehat{\text{MMD}}^2 = \frac{1}{n(n-1)}\sum_{i \neq i'} k(x_i, x_{i'}) + \frac{1}{m(m-1)}\sum_{j \neq j'} k(y_j, y_{j'}) - \frac{2}{nm}\sum_{i,j} k(x_i, y_j)\).

I.4.2 Label drift

\(\Delta\pi_t = |\pi_t - \pi_{t-1}|\). Page-Hinkley: \(PH_t = \sum_{i=1}^{t} (\pi_i - \bar{\pi}) - \min_{s \leq t} \sum_{i=1}^{s} (\pi_i - \bar{\pi})\).

I.4.3 Dataset representativeness

Importance weight: \(w(x) = \frac{P_{\text{prod}}(x)}{P_{\text{eval}}(x)}\).

ESS: \(\text{ESS} = \frac{(\sum_{i} w(x_i))^2}{\sum_{i} w(x_i)^2}\). Representativeness: \(\rho = \text{ESS}/N\).

I.4.4 Dataset decay

Half-life: \(\tau_{1/2} = \inf\{t : I_t \leq \frac{1}{2} I_0\}\) where \(I_t = I(E_t; R_t)\).

I.5 Integrated Scorecard with Uncertainty

\[\text{Scorecard}_d = (\hat{\theta}_d,\; \text{CI}_d,\; \text{SE}_d,\; \text{ICC}_d,\; \text{drift}_d)\]

Release rule: Ship only if \(\forall d \in \text{critical\_dims}: \text{lower\_bound}(\text{CI}_d) \geq \text{threshold}_d\) and \(\text{drift}_d < \text{drift\_threshold}_d\).