This document gives formal definitions of the KPIs and cost models used
in CHEN. All formulas here are implemented in
src/chen/benchmarks/kpis.py and src/chen/core/config.py.
For a single expert invocation with i input tokens, o output
tokens, and P million parameters loaded:
where:
-
$c_\text{in}$ = USD per 1M input tokens (default: 0.15) -
$c_\text{out}$ = USD per 1M output tokens (default: 0.60) -
$c_\text{param}$ = USD per (1M params × 1K tokens) of compute (default: 0.00001) -
$\mathbb{1}_\text{tax}$ = 1 ifinclude_param_tax=True(monolith baseline), else 0
The param_tax term approximates the cost of loading all parameters
into VRAM for the query — the "monolith tax" CHEN is designed to avoid.
For a pipeline invoking experts
Note that
where:
-
$P_\text{baseline}$ = parameter count of the baseline monolith (e.g. 70,000 for 70B) $P_\text{distinct} = \sum_{e \in \text{distinct experts invoked}} P_e$
- EPU > 1: CHEN used fewer parameters than the baseline and (we hope) matched its quality.
- EPU ≥ 3: the target. If a 14B CHEN swarm matches a 42B monolith, EPU = 3.0.
- EPU < 1: CHEN used more parameters than the baseline. Routing is wasteful.
EPU measures capacity efficiency, not quality. A high EPU with low accuracy means we were efficient but wrong. Always pair EPU with an accuracy comparison against the baseline.
The pipeline also computes a per-run "capacity utilization" EPU:
where
where
CHEN should beat the monolith on LTA for simple queries (where the router activates few experts) and be competitive on hard queries.
A value of 1.0 means every KV-cache transfer succeeded; 0.0 means all failed (the pipeline ran in text-fallback mode).
This metric measures transfer success, not nuance preservation. A
real Phase 2 experiment should also compute the KL divergence between
expert
A small KL means the KV-pass produced similar logits to the text-pass (suggesting nuance was preserved). A large KL means the KV-pass produced meaningfully different output (which could be better or worse — needs the accuracy check).
This KL-based probe is on the roadmap; v0.1 ships only the success-rate metric.
For each expert role
where:
-
$\sigma$ = sigmoid function -
$b_r$ = bias for role$r$ -
$w_{r,f}$ = weight for feature$f$ on role$r$ -
$\phi_f(x)$ = feature$f$ of prompt$x$ (keyword density, length bucket, code/math indicator) -
$F$ = feature set
The router then:
- Filters roles with
$\text{score}_r \geq \tau$ (threshold, default 0.15). - Sorts by score descending.
- Caps at
max_activationexperts. - Forces
force_last_role(default: SYNTHESIZER) to be the final expert.
- Mixture of Experts survey — Fedus et al.
- Mixtral of Experts — Mistral AI
- Switch Transformer — Fedus et al.
- Scaling Laws for Neural Language Models — Kaplan et al.