Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.kaireonai.com/llms.txt

Use this file to discover all available pages before exploring further.

Auto-rollback guard on champion promotion

promoteModel({toStatus: "champion", metricsSnapshot: { auc, errorRate }}) in lib/ml/registry.ts now consults evaluateRollback from lib/ml/auto-rollback.ts BEFORE the transaction that demotes the incumbent.

Trigger

The guard fires only when:
  1. toStatus === "champion", AND
  2. metricsSnapshot.auc is supplied by the caller, AND
  3. The incumbent champion in the same family has a stored metricsSnapshot.auc to compare against.
If any of those is missing, the guard silently skips — there’s no honest comparison to make.

Thresholds

ThresholdDefaultSource
maxAucDrop5 % relative dropevaluateRollback
maxPsi0.25 per featureevaluateRollback
maxErrorRate2 %evaluateRollback
Override per call via rollbackThresholds. To force a promotion that breaches a threshold, pass bypassRollbackGuard: true — the returned object surfaces rollbackGuardBreaches so the bypass is auditable.

Failure mode

When the guard fires and bypass is not set, promoteModel throws ModelRegistryError(...) with reason rollback_guard. The incumbent champion stays in place; no DB state changes.

TS-side preprocessing orchestrator

lib/ml/preprocessing.ts bundles WOE binning + target encoding into a single fitPreprocessing / applyPreprocessing API. Why TS-side instead of porting into gbm_trainer.py:
  1. Most Kaireon scoring engines (bayesian, thompson, online, epsilon, scorecard) live entirely in TS and never cross the Python boundary. A TS-side bridge makes binning + encoding available to all engines, not just GBM.
  2. Keeps W6.2 testable + deterministic without a Python service in CI.

Honest limit

V1 fits encoders only. Saving / loading them across train + score boundaries is the caller’s responsibility — AlgorithmModel.modelState is the natural home but is not yet auto-populated from this orchestrator. Auto-binning of gbm_trainer.py features is roadmap work.