# Model Ops

**model-ops.infinity-sdg.com** — the ML model lifecycle with its gates written down: approved data in, evaluated models out, canaries that stop themselves.

```
dataset: registered → approved by a data steward → deprecated
model → candidate (trained on an approved dataset)
  → evaluations: accuracy · fairness · robustness · latency · safety (each with threshold and direction)
  → approve (reviewer) → canary rollout (traffic %, error budget) → completed | halted
  → production (one per model) → superseded / rolled back → retired
rollback: requested → approved by a second SRE → executed
every 15 minutes: running canaries over their error budget halt
```

## What it enforces

| Rule | Why |
|---|---|
| A candidate trains only on a dataset a data steward approved | No model on unreviewed data, and PII datasets wait for their steward |
| An evaluation's `passed` must agree with its value, threshold and direction | Results can't be mislabeled green |
| Approval needs accuracy, fairness and safety evaluations, and no failed evaluation of any kind | Fairness and safety aren't optional suites |
| Production needs a completed canary | Nothing jumps straight to 100% |
| One production version per model; supersede before promoting | Lineage stays unambiguous |
| Rollouts open only for candidates in canary | Traffic follows the state machine |
| Running canaries over their error budget halt automatically | Regressions stop without anyone watching |
| Rollbacks are approved by someone other than the requester, and a version rolls back only under an approved rollback | Four-eyes control on production changes |

Every resource is audited. Candidates keep a readable history: approved by whom, canary, promoted, rolled back.

## Resources, views, roles

- **Resources:** dataset, model, candidate, evaluation, rollout, rollback
- **Views:**
  - `promotionPipeline`
  - `failingEvaluations`: why a candidate is blocked
  - `liveCanaries`, with an over-budget flag
- **Roles:**
  - `mlengineer`: datasets, candidates, evaluations
  - `reviewer`: approves or rejects candidates
  - `steward`: approves and deprecates data
  - `sre`: canaries, promotion, rollbacks
  - `admin`

## Demo data

The demo has 10 model families: fraud scoring, search ranking, ticket summarization, document embedding, demand forecasting, weld-defect detection, churn, toxicity filtering, feed recommendations and delivery ETA. They run on 12 datasets; one PII dataset still awaits its steward, and one is deprecated.

There are 23 candidates with 111 evaluations, all consistent with their numbers:

- **Promotions:** clean ones, plus superseded versions that were retired.
- **Canaries:** one running within budget, and one halted at 3× its error budget and then abandoned.
- **Rollbacks:** 5 executed with hotfixes promoted, 2 approved, 1 rejected (the spike was upstream) and 2 requested.
- **Fairness:** two candidates fail it. One was rejected and one is still blocked.

Every decision is made by the demo user who would make it (`steward1`, `reviewer1`, `sre1`, `sre2`, `mle1`), with that user's own roles. That needs Kalos seeder 1.2.0 or later. Hashes are derived for the demo, not real artifacts.

To regenerate the data, run `python3 seeds/gen_seed.py`.

## Run it

```bash
scripts/kalos.sh validate    # static checks
scripts/kalos.sh start       # kalosd on :9219
scripts/kalos.sh verify      # live checks
```

By default, `KALOS_REPO` is `../kalos`.

Sign in with `admin` / `Admin123!`. The other users are `mle1`, `mle2`, `reviewer1`, `steward1`, `sre1` and `sre2`, all with password `Demo123!`.

## Reselling

This is an original ISDG product for ML platform teams. It has no customer models and no third-party branding.
