Landscapes, checkpoints and probes

Landscapes, checkpoints and probes

The loss surface around a model, checkpoints you can open in Anatomy, and how chosen examples were learned.

Three ways to see inside a training run. A landscape is the loss around the model, computed in your process by run.landscape. A checkpoint marks a step and can carry the model's structure, so Anatomy opens the network as it was then. A probe set is a set of examples whose predictions the client sends at every epoch, for data maps and per-example learning curves.

The client sends an Idempotency-Key with each POST here, so a retried landscape, checkpoint, probe set or evaluation is stored once and answered as the first was (Idempotent-Replayed: true); see retrying safely. These POSTs take a gzip body. Inputs and weights stay with you unless you send them.

#Attach a landscape

POST/v1/runs/{run_id}/landscapesAPI key or session

Store a landscape the client computed: a plane (random-plane, or pca-plane for the path training took), a line between two sets of weights, or a hessian spectrum. JSON, optionally gzip, at most 8 MB (413 body_too_large). The plan sets how many landscapes a run holds (403 quota_exceeded, param: training_landscapes). Sharpness, noise scale and step probes are series, not landscapes (landscape/sharpness, landscape/step_probe/x0 to x4).

In a grid, rows follow y: grid.loss[j][i] is the loss at (x[i], y[j]). Cells may be null or not finite. A malformed landscape is 400 invalid_landscape with param.

Path parameters

run_idstringrequired

The run's id: run_ and 8 to 64 lowercase letters or digits.

Headers

Idempotency-Keystringoptional

1 to 255 visible ASCII characters, such as a UUID (400 invalid_idempotency_key otherwise). Sent again with the same key within 24 hours, the request gets the first answer back, with Idempotent-Replayed: true, instead of storing the landscape twice. See retrying safely.

Content-Encodingstringoptional
gzip (or x-gzip) for a compressed body. Any other encoding is 415 unsupported_encoding, refused before the body is read.

Body parameters

kindstringrequired
random-plane, pca-plane, line or hessian.
label / center_stepoptional

A label of your own, and the step of the weights at the centre.

resolutionarray of integersoptional
[len(x), len(y)], 2 to 2,048 a side and at most 1,048,576 cells; a line's is [n] or [n, 1].
rangesarrayoptional
[[x min, x max], [y min, y max]].
normalizationstringoptional

How the directions were scaled: filter for a random plane, pca for a trajectory plane.

eval_fingerprint / compute_secondsoptional

The fingerprint of the fixed evaluation batches, and what it cost.

gridobjectoptional

Planes: {x, y, loss, metrics}, loss len(y) rows of len(x) values, each metric the same shape.

lineobjectoptional
{alpha, loss, metrics, from_step, to_step, other_run}: 2 to 100,000 finite alpha values; other_run a run of this workspace.
trajectoryarrayoptional
pca-plane: the snapshots' positions, {step, x, y, loss}.
explained_variancearray of numbersoptional
pca-plane: the share of movement each direction explains.
statsobjectoptional

Up to 1 MB. The client sends lr, eval_examples, eval_batches, seed and tensors; a Hessian adds top_eigenvalues, trace, density and stability_line.

Returns

The landscape's metadata. 201.
run.landscape("trajectory", at="end", loss=loss, data=val_set)   # computed at finish(), then uploaded
run.landscape("random-plane", loss=loss, data=val_set)           # now: 31 × 31, filter-normalised
curl -X POST https://api.kaimei.ai/v1/runs/run_3f2a19c0d1e2f3a4b5c6/landscapes \
  -H "Authorization: Bearer $KAIMEI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kind": "random-plane", "center_step": 1200, "resolution": [3, 2],
       "grid": {"x": [-1, 0, 1], "y": [-1, 1], "loss": [[2.0, 1.0, 2.0], [1.5, 0.5, 1.5]]}}' \
  -H "Idempotency-Key: 6c0f1e2a-4b3d-4e5f-9a8b-7c6d5e4f3a2b"
201 CreatedResponse
{
  "object": "landscape",
  "id": "lsc_1d394be1e01ff04affee",
  "kind": "pca-plane",
  "label": "end of training",
  "center_step": 1200,
  "resolution": [3, 3],
  "eval_fingerprint": "sha256:5be0a1",
  "compute_seconds": 41.2,
  "created_at": "2026-12-05T12:01:00.650104+00:00"
}

#List landscapes

GET/v1/runs/{run_id}/landscapesAPI key or session

The run's landscapes, without their grids.

Path parameters

run_idstringrequired

The run's id: run_ and 8 to 64 lowercase letters or digits.

Query parameters

kindstringoptional

One kind.

Returns

A page of landscape metadata.
client.runs.landscapes("run_3f2a19c0d1e2f3a4b5c6")
curl https://api.kaimei.ai/v1/runs/run_3f2a19c0d1e2f3a4b5c6/landscapes \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "object": "list",
  "data": [
    {
      "object": "landscape",
      "id": "lsc_1d394be1e01ff04affee",
      "kind": "pca-plane",
      "label": "end of training",
      "center_step": 1200,
      "resolution": [3, 3],
      "eval_fingerprint": "sha256:5be0a1",
      "compute_seconds": 41.2,
      "created_at": "2026-12-05T12:01:00.650104+00:00"
    }
  ],
  "total": 1,
  "limit": 1,
  "offset": 0,
  "has_more": false,
  "next_cursor": null
}

#Retrieve a landscape

GET/v1/runs/{run_id}/landscapes/{landscape_id}API key or session

Everything stored for one landscape (404 landscape_not_found otherwise).

Path parameters

run_idstringrequired

The run's id: run_ and 8 to 64 lowercase letters or digits.

landscape_idstringrequired
lsc_ identifier.

Returns

The metadata with ranges, normalization, grid, line, trajectory, explained_variance and stats.
surface = client.runs.landscape("run_3f2a19c0d1e2f3a4b5c6", "lsc_1d394be1e01ff04affee")
print(surface.grid["loss"][1][1])     # the loss at (x[1], y[1])
curl https://api.kaimei.ai/v1/runs/run_3f2a19c0d1e2f3a4b5c6/landscapes/lsc_1d394be1e01ff04affee \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "object": "landscape",
  "id": "lsc_1d394be1e01ff04affee",
  "kind": "pca-plane",
  "label": "end of training",
  "center_step": 1200,
  "resolution": [3, 3],
  "eval_fingerprint": "sha256:5be0a1",
  "compute_seconds": 41.2,
  "created_at": "2026-12-05T12:01:00.650104+00:00",
  "ranges": [[-1.0, 1.0], [-1.0, 1.0]],
  "normalization": "pca",
  "grid": {
    "x": [-1.0, 0.0, 1.0],
    "y": [-1.0, 0.0, 1.0],
    "loss": [
      [2.4, 1.9, 2.2],
      [1.7, 0.52, 1.6],
      [2.1, 1.8, "NaN"]
    ],
    "metrics": {
      "accuracy": [
        [0.41, 0.55, 0.47],
        [0.6, 0.87, 0.62],
        [0.44, 0.57, "NaN"]
      ]
    }
  },
  "line": null,
  "trajectory": [
    {"step": 0, "x": -0.8, "y": 0.2, "loss": 2.31},
    {"step": 600, "x": -0.3, "y": 0.1, "loss": 0.72},
    {"step": 1200, "x": 0.0, "y": 0.0, "loss": 0.52}
  ],
  "explained_variance": [0.81, 0.12],
  "stats": {
    "lr": 0.0005,
    "eval_examples": 1024,
    "eval_batches": 4,
    "seed": 0
  }
}

#Record a checkpoint

POST/v1/runs/{run_id}/checkpointsAPI key or session

Mark a step with its metrics. With create_model (and upload auto or structure) Kaimei also makes a hidden checkpoint model, named <run name> (step <n>), for the client to upload the network's structure to through the structure routes: with auto, every weight summarised as its shape and statistics, so no weight value leaves the machine; with structure, the weights too, so Kaimei can run it.

Checkpoint models stay out of model lists, search, counts and the plan's models, and go with the run. Making a version or a fork of one, or setting its status, makes it a registered model (within the plan's models); one can't be transferred (409 checkpoint_model). The plan sets how many checkpoints with a model a run holds (403 quota_exceeded, param: training_checkpoints) and how many checkpoint models a workspace holds (training_checkpoint_models). An imported run's checkpoints get no model: create_model left out is false there, and true is 400 invalid_checkpoint. In the dashboard /models/<slug>?anatomy=sight opens one in Sight.

Path parameters

run_idstringrequired

The run's id: run_ and 8 to 64 lowercase letters or digits.

Headers

Idempotency-Keystringoptional

1 to 255 visible ASCII characters, such as a UUID (400 invalid_idempotency_key otherwise). Sent again with the same key within 24 hours, the request gets the first answer back, with Idempotent-Replayed: true, instead of recording the checkpoint twice. See retrying safely.

Content-Encodingstringoptional
gzip (or x-gzip) for a compressed body. Any other encoding is 415 unsupported_encoding, refused before the body is read.

Body parameters

stepintegeroptional

Left out: the run's latest.

epoch / labeloptional

Such as 3 and best. The same step and label again answer 200 with that checkpoint.

metricsobjectoptional

The values at that step.

uploadstringoptionaldefault "auto"
auto, structure, results (only probe predictions) or none.
local_pathstringoptional

Where your own checkpoint file is.

create_modelbooleanoptionaldefault true

Make the hidden model. An imported run's default is false.

Returns

The checkpoint: id, step, epoch, label, metrics, upload, model ({id, slug}), has_structure, local_path, created_at. 201, or 200 when it was already recorded.
run.checkpoint(model, label="best")      # metrics, a checkpoint event, and the structure in the background
curl -X POST https://api.kaimei.ai/v1/runs/run_3f2a19c0d1e2f3a4b5c6/checkpoints \
  -H "Authorization: Bearer $KAIMEI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"step": 1200, "epoch": 3, "label": "best", "metrics": {"val/loss": 0.71}}'
201 CreatedResponse
{
  "object": "checkpoint",
  "id": "ckp_6d56343dc14598716aea",
  "step": 1200,
  "epoch": 3.0,
  "label": "best",
  "metrics": {"val/loss": 0.71},
  "upload": "auto",
  "model": {
    "id": "mdl_354a0d97094ebae8ba6e",
    "slug": "bright-falcon-12-step-1200"
  },
  "has_structure": false,
  "local_path": null,
  "created_at": "2026-12-05T12:01:00.674939+00:00"
}

#List checkpoints

GET/v1/runs/{run_id}/checkpointsAPI key or session

The run's checkpoints by step. has_structure says whether a structure reached the checkpoint's model.

Path parameters

run_idstringrequired

The run's id: run_ and 8 to 64 lowercase letters or digits.

Returns

A page of checkpoints.
curl https://api.kaimei.ai/v1/runs/run_3f2a19c0d1e2f3a4b5c6/checkpoints \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "object": "list",
  "data": [
    {
      "object": "checkpoint",
      "id": "ckp_6d56343dc14598716aea",
      "step": 1200,
      "epoch": 3.0,
      "label": "best",
      "metrics": {"val/loss": 0.71},
      "upload": "auto",
      "model": {
        "id": "mdl_354a0d97094ebae8ba6e",
        "slug": "bright-falcon-12-step-1200"
      },
      "has_structure": false,
      "local_path": null,
      "created_at": "2026-12-05T12:01:00.674939+00:00"
    }
  ],
  "total": 1,
  "limit": 1,
  "offset": 0,
  "has_more": false,
  "next_cursor": null
}

#Create a probe set

POST/v1/probe-setsAPI key or session

Examples to follow through training, by id with their labels; the inputs stay with you. The same name and fingerprint in a project answer 200 with the set it has. The plan sets how large a set may be (403 quota_exceeded, param: probe_examples), and a set counts in the training storage (param: training_storage). A label outside classes is 400 invalid_probe.

Headers

Idempotency-Keystringoptional

1 to 255 visible ASCII characters, such as a UUID (400 invalid_idempotency_key otherwise). Sent again with the same key within 24 hours, the request gets the first answer back, with Idempotent-Replayed: true, instead of making the set twice. See retrying safely.

Content-Encodingstringoptional
gzip (or x-gzip) for a compressed body. Any other encoding is 415 unsupported_encoding, refused before the body is read.

Body parameters

namestringrequired

example_idsarray of stringsrequired

Unique, up to 200 characters each.

labelsarrayrequired

One per example: a class, or a number for regression.

projectstringoptional

A project's slug, id or name.

taskstringoptionaldefault "classification"
classification or regression.
classesarrayoptional

In the order predictions give them. Left out: the labels' distinct values, sorted.

fingerprintstringoptional

The client's hash of the inputs. Kaimei computes its own, sha256: of the task, classes, ids and labels, and keeps that.

Returns

The probe set: id, name, size, task, classes, fingerprint, project, created_at. 201.
run.probe(x_hard, labels=y_hard, ids=hard_ids, model=model)   # Kaimei gets ids, labels and a hash
curl -X POST https://api.kaimei.ai/v1/probe-sets \
  -H "Authorization: Bearer $KAIMEI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"project": "credit-risk", "name": "hard-cases", "example_ids": ["app-1041", "app-2210", "app-3307"],
       "labels": ["approve", "decline", "decline"], "classes": ["approve", "decline"]}'
201 CreatedResponse
{
  "object": "probe_set",
  "id": "prb_b696220cd006ebda87d1",
  "name": "hard-cases",
  "size": 3,
  "task": "classification",
  "classes": ["approve", "decline"],
  "fingerprint": "sha256:0ab9f9643f854ed2a1280d1a3258430436d876b96a184cee9847225833ca34cd",
  "project": {
    "id": "prj_d28a961cfec4c14af1e9",
    "slug": "credit-risk",
    "name": "credit-risk"
  },
  "created_at": "2026-12-05T12:01:00.837062+00:00"
}

#List probe sets

GET/v1/probe-setsAPI key or session

Probe sets of the workspace.

Query parameters

projectstringoptional

A project's slug, id or name.

runstringoptional

A run's id: the sets it evaluated.

Returns

A page of probe sets.
curl https://api.kaimei.ai/v1/probe-sets?project=credit-risk \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "object": "list",
  "data": [
    {
      "object": "probe_set",
      "id": "prb_b696220cd006ebda87d1",
      "name": "hard-cases",
      "size": 3,
      "task": "classification",
      "classes": ["approve", "decline"],
      "fingerprint": "sha256:0ab9f9643f854ed2a1280d1a3258430436d876b96a184cee9847225833ca34cd",
      "project": {
        "id": "prj_d28a961cfec4c14af1e9",
        "slug": "credit-risk",
        "name": "credit-risk"
      },
      "created_at": "2026-12-05T12:01:00.837062+00:00"
    }
  ],
  "total": 1,
  "limit": 100,
  "offset": 0,
  "has_more": false,
  "next_cursor": null
}

#Retrieve a probe set

GET/v1/probe-sets/{probe_set_id}API key or session

One probe set with its example ids and labels.

Path parameters

probe_set_idstringrequired
prb_ identifier.

Returns

The probe set with example_ids and labels.
curl https://api.kaimei.ai/v1/probe-sets/prb_b696220cd006ebda87d1 \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "object": "probe_set",
  "id": "prb_b696220cd006ebda87d1",
  "name": "hard-cases",
  "size": 3,
  "task": "classification",
  "classes": ["approve", "decline"],
  "fingerprint": "sha256:0ab9f9643f854ed2a1280d1a3258430436d876b96a184cee9847225833ca34cd",
  "project": {
    "id": "prj_d28a961cfec4c14af1e9",
    "slug": "credit-risk",
    "name": "credit-risk"
  },
  "created_at": "2026-12-05T12:01:00.837062+00:00",
  "example_ids": ["app-1041", "app-2210", "app-3307"],
  "labels": ["approve", "decline", "decline"]
}

#Record an evaluation

POST/v1/runs/{run_id}/probe-resultsAPI key or session

The model's predictions for a probe set at one step. For classification, each example's probabilities in the order of classes (each row between 0 and 1 and summing to 1 within 0.01; send softmax, not logits); with two classes a flat list is the second class's probability. For regression, one value each. A row that isn't finite is kept as not a number and scores 0. The same step again replaces that evaluation. Kept compressed, as 32-bit floats.

Path parameters

run_idstringrequired

The run's id: run_ and 8 to 64 lowercase letters or digits.

Headers

Idempotency-Keystringoptional

1 to 255 visible ASCII characters, such as a UUID (400 invalid_idempotency_key otherwise). Sent again with the same key within 24 hours, the request gets the first answer back, with Idempotent-Replayed: true, instead of storing the evaluation twice. See retrying safely.

Content-Encodingstringoptional
gzip (or x-gzip) for a compressed body. Any other encoding is 415 unsupported_encoding, refused before the body is read.

Body parameters

probe_setstringrequired
prb_ identifier.
predictionsarrayrequired

One row (or value) per example, in the set's order.

stepintegeroptional

Left out: the run's latest.

checkpointstringoptional

The checkpoint it was evaluated at.

lossesarray of numbersoptional

Each example's loss.

Returns

{"ok": true, "evaluations": n}: how many evaluations of the set the run holds.
run.evaluate_probes(model)      # the adapters call it at every epoch
curl -X POST https://api.kaimei.ai/v1/runs/run_3f2a19c0d1e2f3a4b5c6/probe-results \
  -H "Authorization: Bearer $KAIMEI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"probe_set": "prb_b696220cd006ebda87d1", "step": 1200,
       "predictions": [[0.95, 0.05], [0.2, 0.8], [0.4, 0.6]]}'
200 OKResponse
{
  "ok": true,
  "evaluations": 3
}

#Read a data map

GET/v1/runs/{run_id}/data-mapAPI key or session

Where each probe example sits in training (Swayamdipta et al., 2020): its confidence (the mean probability of its true class over the evaluations), variability (its spread) and correctness (the share of evaluations it was right), with forgetting events (right, then wrong at the next evaluation; Toneva et al., 2019). Regions: ambiguous from variability 0.2, else easy from confidence 0.5, else hard. mislabeled lists examples never right in two or more evaluations that another class took with at least 0.7 at the last; forgotten, those forgotten twice or more.

A regression set scores each prediction max(0, 1 − |error| / s), s the targets' standard deviation, right when the error is at most half of s. 404 probe_results_not_found when the run has no evaluation of the set.

Path parameters

run_idstringrequired

The run's id: run_ and 8 to 64 lowercase letters or digits.

Query parameters

probe_setstringoptional

Left out: the set the run evaluated last.

Returns

probe_set, task, evaluations, steps, examples, counts by region, mislabeled, forgotten and thresholds.
curl https://api.kaimei.ai/v1/runs/run_3f2a19c0d1e2f3a4b5c6/data-map?probe_set=prb_b696220cd006ebda87d1 \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "probe_set": "prb_b696220cd006ebda87d1",
  "task": "classification",
  "evaluations": 3,
  "steps": [400, 800, 1200],
  "examples": [
    {
      "id": "app-1041",
      "label": "approve",
      "confidence": 0.883333,
      "variability": 0.062361,
      "correctness": 1.0,
      "forgetting": 0,
      "region": "easy"
    },
    {
      "id": "app-2210",
      "label": "decline",
      "confidence": 0.633333,
      "variability": 0.169967,
      "correctness": 0.666667,
      "forgetting": 0,
      "region": "easy"
    },
    {
      "id": "app-3307",
      "label": "decline",
      "confidence": 0.533333,
      "variability": 0.169967,
      "correctness": 0.666667,
      "forgetting": 1,
      "region": "easy"
    }
  ],
  "counts": {"easy": 3, "ambiguous": 0, "hard": 0},
  "mislabeled": [],
  "forgotten": [],
  "thresholds": {
    "ambiguous_variability": 0.2,
    "easy_confidence": 0.5,
    "mislabeled_confidence": 0.7,
    "forgotten_events": 2
  }
}

#Read an example's learning curve

GET/v1/runs/{run_id}/probe-results/{example_id}API key or session

One probe example across the evaluations: the probability of its true class, the class predicted, whether it was right, and its loss (404 example_not_found otherwise).

Path parameters

run_idstringrequired

The run's id: run_ and 8 to 64 lowercase letters or digits.

example_idstringrequired

The example's id in the set.

Query parameters

probe_setstringoptional

Left out: the set the run evaluated last.

Returns

example_id, label, probe_set, step, true_prob, predicted, correct and loss (or null).
curl https://api.kaimei.ai/v1/runs/run_3f2a19c0d1e2f3a4b5c6/probe-results/app-3307?probe_set=prb_b696220cd006ebda87d1 \
  -H "Authorization: Bearer $KAIMEI_API_KEY"
200 OKResponse
{
  "example_id": "app-3307",
  "label": "decline",
  "probe_set": "prb_b696220cd006ebda87d1",
  "step": [400, 800, 1200],
  "true_prob": [0.7, 0.3, 0.6],
  "predicted": ["decline", "approve", "decline"],
  "correct": [true, false, true],
  "loss": null
}