Fair CPU benchmark protocol
Quick answer
A useful CPU benchmark fixes data splits, prediction metric, tuning budget, thread limits and measurement procedure before comparing models. Report quality together with resource use. A model that wins on one dataset, budget and machine is not necessarily the best choice for another workload. Static examples tested locally with Python 3.13.5, XGBoost 3.1.3, LightGBM 4.6.0 and CatBoost 1.2.8 where imported. ByteMind package execution is unverified.
Apply a predeclared selection rule
scores={"a":[0.8,0.9],"b":[0.85,0.85],"c":[0.7,0.8]}# Scores in integer percentage points avoid float ties.points={k:[round(100*x) for x in v] for k,v in scores.items()}print(min(points,key=lambda k:(-sum(points[k]),k)))Observed local output:
aThe first two models tie on equal-sized folds; the name is the predeclared tie-break, not test accuracy.
How it works
Use identical training/validation folds and one untouched final holdout. For each family, tune the same number of configurations on the same fold IDs. Select using mean validation accuracy; break ties by a predeclared rule. Refit the selected configuration on the development data and evaluate the final holdout once. A shared frozen numeric encoding isolates some algorithm differences; native categorical workflows need a separate comparison, since encoding changes the feature space. Equal iteration budgets do not mean equal tree count for multiclass tasks, leaf capacity, FLOPs or wall time. Report the actual tree structure settings and measure fit time independently. Native XGBoost UBJ, LightGBM text and CatBoost CBM formats have different overheads; byte count is a deployment indicator, not RAM usage. Measure repeated warmed batch predictions with fixed input size and a monotonic timer; median milliseconds per batch is not single-request latency or p99. Include conversion and serving overhead separately when relevant. Set XGBoost device="cpu", LightGBM device_type="cpu" and CatBoost task_type="CPU" explicitly; GPU flag compatibility and performance require separate hardware/version checks. Record CPU, versions, seed, threads, data hash and exact configuration. Tiny fixtures often exaggerate fixed overhead and have wide metric uncertainty. Report negative results and resource limitations, not a universal ranking.
Compare fixed-stage classifiers
import pandas as pdfrom xgboost import XGBClassifierfrom lightgbm import LGBMClassifierfrom catboost import CatBoostClassifierX=pd.DataFrame({"load":list(range(20))})y=[0]*10+[1]*10models=[XGBClassifier(n_estimators=10,max_depth=1,n_jobs=1,device="cpu",tree_method="hist",random_state=7),LGBMClassifier(n_estimators=10,num_leaves=2,min_child_samples=1,verbosity=-1,n_jobs=1,device_type="cpu",random_state=7),CatBoostClassifier(iterations=10,depth=1,thread_count=1,task_type="CPU",random_seed=7,verbose=False,allow_writing_files=False)]for m in models: m.fit(X,y) print(m.predict(pd.DataFrame({"load":[2,17]})).astype(int).tolist())Observed local output:
[0, 1][0, 1][0, 1]All three fit this separable toy fixture. This is an API smoke test, not a held-out benchmark; use the milestone for model selection.
Common mistakes
Do not use the test score or fastest observed lucky run to choose a model. Do not equate equal rounds to equal compute or compare model file sizes as peak memory. Do not report a single synthetic dataset as a real production benchmark.
Practice and next steps
Run the chapter project twice. Compare deterministic scores and predictions, but expect timing variation. Change the budget in a separate experiment and record it rather than silently replacing the original result. Complete the knowledge check and staged exercise. Next: Support vector machines and kernels.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Fair CPU benchmark protocol — knowledge check
Apply fair cpu benchmark protocol to new scenarios.
Which scores select the configuration?
Do equal boosting rounds imply equal computation?
What does native artifact byte count measure?
What should a warmed latency report include?
What conclusion is supported by one synthetic comparison?