Blog

    CI/CD for Healthcare ML: Automating the Path from Code Change to Deployed Model

    By GauravAugust 21, 20269 mins read
    On this page

    CI/CD for healthcare ML automates the path from a code change to a deployed model, with a gate in the middle: an eval on the pinned snapshot, a named approval, then the endpoint switch. FDA's PCCP guidance says a modification that misses its predefined acceptance criteria is not implemented, and the same fail-closed rule works well as engineering practice.

    Written for digital health founders and hospital CTOs putting clinical models into production, it covers triggers, eval, approvals, switching, rollback and logging.

    How does CI/CD for healthcare ML move a code change to a deployed model?

    CI/CD for healthcare ML moves a code change to a deployed model in four steps: the git change builds an artefact, an eval scores it on the snapshot the model card names, a named person approves it, and only then does the serving endpoint switch. Agnotic Technologies leaves the endpoint unchanged when the eval fails.

    Putting a new model version on the endpoint?

    We eval against the pinned snapshot, take a named approval, then switch. A failed eval is not implemented.

    FDA's PCCP marketing submission guidance says that if predefined acceptance criteria for a modification are not met, the failure is recorded and that modification is not implemented.

    • Change: the git revision that built this version.
    • Eval: the same snapshot id the model card names, with the clinical utility metrics agreed for the model.
    • Approval: a person who is allowed to switch production. A chatbot is not that person.
    • Switch: the endpoint now serves this version. The registry records which one.

    Interface channel tests, infrastructure pipelines and language model test suites each have their own CI. Promotion of a clinical model differs because the artefact must match a pinned snapshot, a model card and a signed approval.

    What happens when the eval fails?

    The change is recorded as failed and is not implemented. Agnotic leaves the previous version on the endpoint.

    • Record: version, snapshot, metric that failed, who ran it.
    • Do not: switch, silent-retrain, or lower the threshold after the fact.
    • Next: a new change with a new eval, not a retry of the failed artefact as if it had passed.

    What should start a promotion run?

    A promotion run starts from a merged change: model code, feature code, training configuration or the decision threshold. A calendar alone does not start one, and neither does new data arriving without a change record.

    • Model or feature code: the training or preprocessing logic changed.
    • Configuration: hyperparameters, the feature list or the snapshot reference changed.
    • Threshold: the score cut-off that turns a probability into an action changed. That counts as a model change.
    • Dependency: a library that affects numeric output was upgraded.

    Each run carries the commit that started it. If nobody can name the change, there is nothing to promote.

    What does the eval stage compare?

    The eval stage compares the candidate with the version now serving, on the same pinned snapshot, against criteria written before the run. Comparing two models on different data says nothing about which one is better.

    • Same data: both versions are scored on the snapshot id in the model card.
    • Same code path: the evaluation uses the preprocessing that serving uses, packaged with the artefact.
    • Named slices: the subgroups the card lists are reported separately, not only the overall figure.
    • Result: pass or fail against each criterion, with the numbers stored in the eval report.

    Agnotic also checks the serving version's numbers against its last recorded run. If they differ, the snapshot or the eval code has changed, and the run stops before comparing anything.

    Where should acceptance criteria be written, and when?

    Acceptance criteria should be written in the repository next to the model configuration, reviewed in a pull request, and merged before the eval runs. A criterion written after seeing the result is not a criterion.

    • Location: a versioned file beside the model config, read by the pipeline.
    • Content: each metric, how it compares with the serving version and the slices it applies to.
    • Change control: editing the criteria is its own change with its own review, never part of the change it judges.

    Agnotic's pipeline refuses to run when the criteria file changed in the same commit as the model.

    Who may approve, and what does the approval record?

    Approval comes from a named person who is allowed to change what clinicians see and who did not write the change. The approval records exactly what was approved, so it cannot be moved to a different artefact later.

    • Clinical owner: confirms the result is acceptable for the intended use.
    • Engineering owner: confirms the artefact, snapshot and criteria match the run.
    • Record: approver, time, eval report id, criteria version and the artefact's content hash.
    • Separation: the pipeline rejects an approval from the account that authored the commit.

    If the artefact changes after approval, the approval no longer applies. The pipeline checks the hash before it switches.

    How should the endpoint switch, and how is it reversed?

    The endpoint should switch by moving a pointer to the approved version while the previous version stays deployed, so reversal is the same operation in the other direction. Rebuilding the old version under pressure is not a rollback plan.

    The FDA, Health Canada and MHRA guiding principles for PCCPs say a focused and bounded plan includes methods for verifying and validating changes, and mechanisms to detect and revert or stop implementation of a change that fails to meet specified performance criteria.

    • Switch: update the serving configuration to the approved artefact and record the change.
    • Check: confirm the endpoint reports the new version and its hash.
    • Reverse: point back to the previous version, which stayed deployed and warm.
    • Stop: if live checks after the switch fail, reverse first and investigate second.

    A step-by-step promotion run

    A promotion run is a fixed sequence that the pipeline enforces. Nobody skips a step by hand.

    • Step 1, build: the merged commit builds an artefact and records its content hash.
    • Step 2, evaluate: the artefact and the serving version are scored on the pinned snapshot.
    • Step 3, judge: results are checked against the criteria file at its merged version.
    • Step 4, request approval: a passing report goes to the named approvers with the hash attached.
    • Step 5, switch: after both approvals, the serving pointer moves and the registry records the version.
    • Step 6, watch: post-switch checks run, and a failure triggers the reverse.

    What are the common mistakes in healthcare ML CI/CD?

    Pipelines break where two things that should be identical quietly differ: the data, the code, the configuration or the artefact itself.

    • Wrong snapshot: the eval used a newer extract than the one the card names.
    • Training-serving skew: preprocessing in serving differs from preprocessing in evaluation.
    • Threshold edit in serving: someone changes the cut-off in the endpoint config without a run.
    • Rebuilt artefact: the deployed file is a rebuild, not the one that passed.
    • Stale approval: the approver signed a report from an earlier run.

    Each of these is caught by comparing ids and hashes, not by reading code. Agnotic puts those comparisons in the pipeline itself.

    How do you prove the served artefact is the one that passed?

    Hash the artefact when it is built, carry that hash through the eval report and the approval, and have the server verify it at load. If any of the three disagree, the server refuses to load the artefact.

    • Build: the content hash is written to the artefact's metadata.
    • Eval and approval: both reference the hash, not a file name or a tag.
    • Load: the serving process computes the hash and compares it with the approved value.

    A worked example: adding a feature to a discharge risk model

    A worked example: a data scientist adds a recent lab value as a feature to a discharge risk model. The model change and the feature code merge together, and the pipeline builds a candidate artefact.

    The eval scores the candidate and the serving version on the pinned snapshot. Overall results pass, but one subgroup named in the model card falls below its criterion. The pipeline records the run as failed, the candidate is not implemented, and the serving version stays on the endpoint.

    The team finds the lab value is missing more often for that subgroup and opens a new change. That change gets its own run. The failed artefact is not rerun or relabelled.

    The failed run's report stays in the record with its numbers. When the new change runs, its report sits next to the earlier one, so the approvers can see whether the subgroup result actually improved.

    What should run after the switch?

    After the switch, live checks confirm the endpoint serves the approved version and that its outputs look the way the eval said they would. These checks are not a second eval; they catch deployment faults.

    • Version check: the endpoint reports the approved version and hash.
    • Shape check: the score distribution on live traffic sits within the range the eval report recorded on the snapshot.
    • Error check: request failures and latency stay within the service limits the team set.
    • Owner sign-off: the clinical owner confirms the first outputs they reviewed look as expected.

    Longer-term watching belongs to drift detection, which is a separate loop. The post-switch checks end once the owner signs off.

    What should the pipeline log, and how do you know it is working?

    Log each run's commit, artefact hash, snapshot id, criteria version, result and approvers. The pipeline is working when every version that has ever served can be traced to a passing run and two approvals.

    • Per run: commit, hash, snapshot id, criteria version, result and duration.
    • Per switch: who approved, what changed, and the version that was replaced.
    • Audit query: list served versions with no passing run. The answer should be none.

    How does Agnotic run the gate?

    Agnotic builds the promotion pipeline for the client: the hash at build, the eval against the pinned snapshot, the criteria file check, the two-person approval, the pointer switch and the post-switch checks.

    Eval, signature, switch. Failed eval stays off.

    Engineering practice informed by PCCP wording, not an FDA filing.

    Sources

    Frequently Asked Questions

    Not on this path. Record the failure and leave the previous version serving.

    Talk to an engineer about your project

    Name the version and the snapshot. We will run the eval, take a signature, and switch only when the gate passes.

    Go deeper

    Services and solutions on this topic