Agent Wranglers

MLO-47Recommended

Retire models on purpose

When a model leaves production, remove its alias and endpoint and stop its feature jobs. Keep its registry entry, run record and card for as long as any decision record names it.

How to do it

Old models left running keep costing money and keep a door open. Deleted models break every appeal about a decision they made. Mark the version as retired in the registry with a date and a reason. Find the last decision that names it, as in keep a record of every decision about a person. Delete its weights and snapshot only after that record's retention ends.

Examples

Python example

def retire(version: ModelVersion, reason: str) -> None:
    if serving.endpoints_using(version):
        raise StillServing(version.id)
    registry.set_tag(version, "retired", f"{date.today().isoformat()}: {reason}")
    feature_jobs.stop_for(version)

TypeScript example

export async function retire(version: ModelVersion, reason: string) {
  if ((await serving.endpointsUsing(version)).length) throw new StillServing(version.id);
  await registry.setTag(version, 'retired', `${new Date().toISOString().slice(0, 10)}: ${reason}`);
  await featureJobs.stopFor(version);
}

How to check

No serving endpoint or alias points at a version marked retired. Every retired version has a date and a reason. A query finds no decision record that names a version whose weights are gone.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/machine-learning/serving-and-release/model-retirement">Agent Wranglers machine learning playbook</a>. In code you write, add a comment next to it with the same link.