Pidoku

Model Registry

Module 21 Lesson 21.b 1h Difficulty 2/5

Prerequisites 20.j, 20.h, 23.g


Before you start: words you need#

WordPlain meaning
RegistryThe authoritative record of which models exist, which versions, where their files live and how to serve them.
ArtifactA stored file or bundle: the weights, the tokenizer, a compiled engine.
Checksum / digestA short fingerprint (for example SHA-256) of a file’s bytes. If one byte changes, the digest changes.
OCI registryThe kind of server that stores container images (Docker Hub, Harbor, a cloud registry). It can also store models.
AliasA stable, human name such as chat-large that points at a specific model version and can be moved.
PromotionMoving a version to the next lifecycle state (draft → staged → canary → production), only when its checks pass.
Calibration setThe sample of real inputs used to choose the scales when a model is quantized (13.b).

1. What is it?#

A model registry is the record the platform consults to answer: “what should I run, and how?”

It is not a model zoo and not an experiment tracker. It is a deployment registry. Each entry says which weights, which tokenizer and chat template, which quantization, which engine version and settings, which hardware, and which evaluation approved it.

Every other platform component reads from it: the scheduler (what does a replica need?), the deployment controller (what should be running?), the router (which name maps to which replicas?), the gateway (which aliases exist?) and billing (what does a token cost?).

Facts checked on 12 November 2026.


2. Why does it exist?#

Because “which version is in production?” has a long answer:

QUESTION: "Which version of the chat model is in production?"

WRONG ANSWER: "v1.5.0"
RIGHT ANSWER: "v1.5.0: Qwen3-32B weights sha256:a3f2…, FP8 weights with an auto KV cache,
               vLLM v0.32.0, TP=2, chat template sha256:9b1c…, approved on eval suite
               prod-eval-v3 at 0.847"

Change any of those and the outputs change. Two deployments of the same checkpoint with different quantization are different models from the user’s point of view (20.j).

When someone reports “the model got worse”, you open the version record and see everything that could have caused it. Without the record you are guessing.


3. Simple analogy#

A pharmacy’s drug register. “Paracetamol” is not enough: the register records the manufacturer, the batch number, the strength, the form (tablet or syrup), the approval and the expiry date. If a patient reacts badly, the pharmacist can trace the exact batch. A model registry does the same for model deployments.


4. Tiny example: one registry entry#

YAML
model_id: chat-general
versions:
  - version: v1.5.0
    status: production          # draft | staged | canary | production | deprecated

    # --- WHAT TO LOAD ---
    artifact:
      uri: oci://registry.internal/models/qwen3-32b-fp8:v1.5.0   # or s3://… or hf://…@<commit>
      digest: sha256:a3f2…        # of the manifest that lists every file's digest
      format: safetensors
      size_bytes: 33500000000
    base_model: Qwen/Qwen3-32B@<commit sha>
    tokenizer_digest: sha256:4c0e…
    chat_template_digest: sha256:9b1c…

    # --- HOW TO SERVE IT (part of the identity) ---
    quantization:
      method: fp8-dynamic
      kv_cache_dtype: auto
      calibration_set: s3://calib/prod-sample-2026-09/   # with its own digest
      excluded_layers: [lm_head]
    engine:
      image: vllm/vllm-openai:v0.32.0@sha256:…     # pin by digest, not tag
    parallelism: {tensor_parallel: 2}
    engine_args:
      max_model_len: 32768
      max_num_seqs: 128
      max_num_batched_tokens: 8192
      gpu_memory_utilization: 0.90
      enable_prefix_caching: true

    # --- WHAT A REPLICA NEEDS (read by the scheduler, 21.e) ---
    resources:
      gpus_per_replica: 2
      gpu_types: [H100-80GB, H200-141GB, B200]
      same_nvlink_domain: true
      min_host_memory_gb: 128
      min_shm_gb: 16

    # --- WHO APPROVED IT, AND ON WHAT EVIDENCE ---
    evaluation:
      suite: prod-eval-v3
      results_uri: s3://evals/chat-general-v1.5.0.json
      summary: {our_task: 0.847, refusal_rate: 0.012}
      reference_version: v1.4.0
      delta_vs_reference: {our_task: -0.002}
      approved_by: ml-quality-team
      approved_at: "2026-10-02T14:30:00Z"
    rollout: {strategy: progressive, canary_percent: 1, guards_ref: standard-llm-guards-v3}

The “how to serve it” block is what separates a real registry from a file listing. Most teams record the checkpoint and forget the rest.


5. Technical explanation#

The API#

# Discovery
GET  /v1/models                             list all
GET  /v1/models/{id}/versions/{v}           full record
GET  /v1/models/{id}/production             what is serving now
GET  /v1/aliases/{alias}                    "chat-large" → model and version

# Lifecycle
POST /v1/models/{id}/versions               register a new version (draft)
POST /v1/models/{id}/versions/{v}/evaluate  attach evaluation results
POST /v1/models/{id}/versions/{v}/promote   draft → staged → canary → production
POST /v1/models/{id}/versions/{v}/rollback  revert to the previous production version
POST /v1/models/{id}/versions/{v}/deprecate

# Platform integration
GET  /v1/deployments                        what should be running where
GET  /v1/models/{id}/resources              what a replica needs (for the scheduler)

Promotion with gates is what makes it a registry rather than a database:

draft ──[evaluation passes]──▶ staged ──[shadow traffic ok]──▶ canary
      ──[guards hold for 2 h]──▶ production ──[new version]──▶ deprecated

The registry checks each condition itself. It does not trust whoever runs the deployment to remember. The canary and guard mechanics are in 20.j and 23.g.

Where the bytes live#

Three storage patterns are common in 2026:

PatternHow a replica gets the weightsGood for
Object store (S3, GCS, Azure Blob) plus a manifest of digestsDownload at start, or stream with a loader such as Run:ai Model Streamer (20.g)The default; cheap; fast with parallel reads
Hugging Face Hub (public or a private hub)Pull a repository at a pinned commit, never a branch nameOpen models; pin revision to a commit SHA
OCI registryPull the model like a container imageReusing image tooling: signing, scanning, mirroring, caching on nodes

The OCI route has matured:

  • ModelPack (a CNCF Sandbox project since May 2025) is a vendor-neutral specification for packaging a model as an OCI artifact, with its own media types for weights, config, code and docs. KitOps ModelKits and Docker’s model packaging can produce it.
  • Kubernetes image volumes (volumes[].image) went stable in Kubernetes 1.36 (April 2026). A pod can mount an OCI artifact read-only as a volume, so weights ship separately from the engine image and are cached by the node’s container runtime.
  • KServe accepts storageUri: oci://…; its “modelcar” runs the model image as an extra container and links the files into the server’s filesystem without copying them.

Whichever store you use, the registry records a digest of a manifest that lists every file’s digest. A corrupted shard otherwise loads silently and produces plausible nonsense.

The node-local cache and engine artifacts#

STORAGE LAYOUT (object store)
  s3://models/{model_id}/{version}/
    ├── manifest.json            digests for every file
    ├── config.json, tokenizer/, chat_template.jinja
    ├── model-00001-of-00014.safetensors …
    └── engine_artifacts/        per GPU type and parallelism
        ├── h100-tp2/  compile_cache/ (torch.compile, CUDA graphs) or engine.plan (TensorRT-LLM)
        └── b200-tp2/

REGIONAL COPIES
  replicate to each region's bucket; never pull across regions per node (egress cost, 23.f)

NODE-LOCAL CACHE
  /var/cache/models/{model_id}/{version}/, filled ahead of time by a DaemonSet,
  or by the container runtime's image cache when models are OCI artifacts
  → cold start drops from minutes to seconds (3.g, 20.g)

Engine artifacts are often forgotten, and they save 1–10 minutes of compilation per cold start. Key them by GPU type, parallelism and engine version, because a compile cache built for one does not fit another.

Integration with the platform#

REGISTRY → SCHEDULER            "needs 2 GPUs of type [H100, H200, B200] in one NVLink domain"  (21.e)
REGISTRY → DEPLOYMENT CONTROLLER "production is v1.5.0 with these engine args" → reconcile       (21.a)
REGISTRY → ROUTER               "model X is served by these pools, with these capabilities"     (21.g)
REGISTRY → GATEWAY              "alias chat-large → chat-general v1.5.0"                         (21.i)
REGISTRY → BILLING              "price per input token, per output token"                        (23.c)

The alias layer deserves attention. Clients ask for chat-large; the registry maps it to a model and version. You can change the model underneath without changing every client.

Build or adopt#

Small platform (< 10 models):
  a Git repository of YAML records + an object store or OCI registry + CI that checks digests
  and runs the evaluation gate. Genuinely enough; do not over-build.

Medium platform (10–100 models, several teams):
  a real service with the API above, backed by Postgres and object or OCI storage.

Large platform:
  the above, plus multi-region replication, approval workflows,
  automatic evaluation, and cost attribution.

Off-the-shelf registries cover parts of this. MLflow (3.18 in November 2026) has a model registry with versions, mutable aliases (for example champion) and tags; its older Staging/Production stages still exist. Hugging Face Hub gives versioned repositories and model cards. KServe and the distributed frameworks (21.j) hold serving config in their own custom resources. None of them, alone, ties weights, serving config, hardware needs and an enforced promotion gate into one record, so most platforms either extend one of them with that schema or keep the deployment record in Git and use them as artifact stores.


6. Under the hood: the deployment identity#

Treat a deployment as a fingerprint of everything that changes its outputs. If the fingerprint changes, it is a new deployment and must pass the gate again.

Go
// identity.go — a deployment's identity is the checkpoint PLUS everything that changes its outputs.
package main

import (
	"crypto/sha256"
	"encoding/json"
	"fmt"
)

type Deployment struct {
	WeightsDigest   string `json:"weights_digest"`   // sha256 of the weight manifest
	TokenizerDigest string `json:"tokenizer_digest"` // tokenizer + chat template
	Quantization    string `json:"quantization"`
	KVCacheDtype    string `json:"kv_cache_dtype"`
	EngineImage     string `json:"engine_image"`    // pinned by digest in real life
	TensorParallel  int    `json:"tensor_parallel"` // changes reduction order, so numerics
	MaxModelLen     int    `json:"max_model_len"`
}

// identity hashes the canonical JSON form. encoding/json writes struct fields in a fixed order.
func identity(d Deployment) string {
	b, _ := json.Marshal(d)
	sum := sha256.Sum256(b)
	return fmt.Sprintf("%x", sum[:6])
}

func main() {
	base := Deployment{"sha256:a3f2", "sha256:9b1c", "fp8-dynamic", "auto", "vllm/vllm-openai:v0.32.0", 2, 32768}
	fmt.Println("base                 ", identity(base))

	changes := []struct {
		what string
		edit func(*Deployment)
	}{
		{"same config again   ", func(d *Deployment) {}},
		{"KV cache to fp8     ", func(d *Deployment) { d.KVCacheDtype = "fp8" }},
		{"new chat template   ", func(d *Deployment) { d.TokenizerDigest = "sha256:77aa" }},
		{"engine v0.33.0      ", func(d *Deployment) { d.EngineImage = "vllm/vllm-openai:v0.33.0" }},
		{"TP 2 -> 4           ", func(d *Deployment) { d.TensorParallel = 4 }},
	}
	for _, c := range changes {
		d := base
		c.edit(&d)
		id := identity(d)
		note := "different deployment: evaluate before promoting"
		if id == identity(base) {
			note = "identical"
		}
		fmt.Println(c.what, id, " ", note)
	}
}

Output:

base                  15db7546ceb1
same config again    15db7546ceb1   identical
KV cache to fp8      20ba5269dcb3   different deployment: evaluate before promoting
new chat template    017fb4ec2c2a   different deployment: evaluate before promoting
engine v0.33.0       5b11a17c078e   different deployment: evaluate before promoting
TP 2 -> 4            ab15b0c9efd6   different deployment: evaluate before promoting

Not every field changes outputs equally. An engine upgrade or a TP change usually moves results by tiny numerical amounts; a KV cache format or a chat template change can move them a lot. A practical rule: any identity change re-runs the automated evaluation; only large deltas need a human.


7. Performance implications#

  • Cold start is a registry problem. Pre-built engine artifacts plus node-local weights turn a 10-minute start into tens of seconds, which is what makes autoscaling (20.g) and placement changes (21.e) affordable.
  • Pulling from the registry must scale. Fifty replicas starting at once and each downloading 65 GB is 3.25 TB of reads. Use regional copies, node caches, peer-to-peer distribution or GPU-to-GPU weight transfer (21.j).
  • Lookups are control-plane work. The router and gateway cache the registry’s answers (21.a); nothing calls it per request.

8. Production implications#

  • The registry is the source of truth. Anything serving that is not in the registry is an incident.
  • Record the whole serving configuration as part of the version.
  • Enforce promotion gates in the registry, not in someone’s memory.
  • Pin everything by digest: weights, engine image, tokenizer, calibration set. Tags and branch names move.
  • Store engine artifacts per GPU type, parallelism and engine version.
  • Keep deprecated versions deployable for 30 days or more for rollback.
  • Use aliases so client-facing names stay stable.
  • Put the version in every metric label and response header (23.g, 23.h).
  • Treat the artifact store as part of your supply chain: sign artifacts, scan pickled formats, prefer safetensors (23.i).

9. Common mistakes#

  1. Recording only the checkpoint. The serving config also decides the outputs.
  2. Using an experiment tracker as the deployment registry without adding serving config and gates.
  3. No digests. A corrupted shard produces plausible garbage.
  4. Pinning by tag or branch (latest, main). The bytes change under the same name.
  5. No engine artifact storage. Recompiling on every cold start.
  6. No aliases. Every model change needs every client to change.
  7. Deleting old versions at once. No rollback path.
  8. Promotion without gates. The evaluation gets skipped under pressure.
  9. No record of the calibration set for a quantized model, so it cannot be reproduced.

10. Hands-on exercise#

  1. Write the record. Fill in the section 4 template for a model you serve. Which fields were not recorded anywhere?
  2. Run identity.go. Add chat_template_digest, max_num_seqs and the calibration set digest. Which of these should change the identity, and which only affect speed? Split the struct into “output-affecting” and “performance-only” fields.
  3. Build a minimal registry. Implement the API from section 5 with SQLite and a directory, including the promotion gates.
  4. Reproduce a deployment. Give the record alone to a colleague and have them deploy it. What was missing?
  5. Try OCI packaging. Package a small model as an OCI artifact (KitOps, or Docker’s model packaging with ModelPack output), push it to a local registry, and mount it in a pod with an image volume. Compare start time with downloading from object storage.

11. Interview questions#

  1. What must a registry entry contain beyond the checkpoint URI?
  2. Why is the serving configuration part of a model’s identity? Give three fields that change outputs.
  3. Describe the promotion path and what gates each step.
  4. Why store engine artifacts, and how should they be keyed?
  5. Compare object storage, the Hugging Face Hub and an OCI registry as the home for weights.
  6. Why use aliases rather than exposing version IDs to clients?
  7. What do you keep for rollback, and for how long?

12. Further reading#

Checked on 12 November 2026.

↑↓ navigate↵ openesc close

100% drag to pan · scroll or pinch to zoom · double-click to zoom in