Tier 1: Kernel Benchmark
Tests a single operator replacement by instantiating baseline and candidatenn.Modules side-by-side, copying weights, and comparing forward() outputs and timing across a registry of input shapes.
A scenario passes if max-abs-error < 0.01 (bfloat16 tolerance). Speedup > 1.0 means faster than baseline.
Tier 2: E2E Benchmark
Full-model inference benchmarks. The CLI mirrors vLLM’s interface, so the same flags work in both.Tier 3: Eval Sweep
Runs a standardized evaluation across all candidate kernels using fixed workloads. Each job pair (baseline vs candidate) runs in an isolated subprocess to prevent contamination.Standardized workloads
Eval uses fixed, non-configurable workloads for reproducibility: Throughput (per model/TP pair):prefill-heavy— 1024 input, 512 output tokensbalanced— 512 input, 512 output tokensdecode-heavy— 512 input, 1024 output tokens
single-request— batch 1, 128 in/out tokensfixed-batch-32— batch 32, 128 in/out tokens
Input Registry
Kernel benchmarks (Tier 1) draw input shapes from a YAML manifest atbench/utils/inputs/llm.yaml. Each entry specifies tensor shapes, dtypes, and init args for a given operator × model × TP × sequence-length combination.
Experiment Tracking
All three benchmark tiers automatically log their results to MLflow. After anykb_nano kernels, kb_nano e2e, or kb_nano eval run, you can query the results with kb_nano history or browse them in the MLflow web UI via kb_nano mlflow-ui. See Experiment Tracking for details.
Conflict Resolution
When multiple candidate kernels overlap (e.g. an L2attention kernel internally replaces an L1 rms_norm), the kernel swapper detects subsumption automatically and warns. Candidates are always applied bottom-up (L1 → L4).