Request a demo
All articles Practical guide

A practical guide to experiment tracking with the InsightMLFlow SDK

Log metrics, configuration, tables and images from a notebook or training script with a few lines of Python, and compare runs afterwards. What the SDK records, and two things it does not.

November 11, 2026 · 5 min read

An experiment you did not record did not happen, as far as the next person is concerned. InsightMLFlow's tracking API and Python SDK make recording cheap: initialise a run, log as you train, finish. This guide shows the calls, what ends up on the server, and the limits worth knowing.

Install and start a run

The SDK is the insightmlflow Python package. The interface is deliberately small:

import insightmlflow as im

run = im.init(project="churn-model", experiment="v3-gradient-boosting",
              api_url="https://mlflow.your-company.example", api_key=API_KEY,
              tags={"team": "retention"})

run.config({"learning_rate": 0.05, "max_depth": 6, "n_estimators": 400})

for epoch in range(20):
    train_loss, val_loss, val_auc = train_one_epoch(model)
    run.log({"train_loss": train_loss, "val_loss": val_loss, "val_auc": val_auc}, epoch=epoch)

run.log_table("confusion", rows, caption="validation set")
run.finish()

The run object also works as a context manager, so a run is finished even if training raises an error.

What is recorded

CallRecorded
config()A configuration snapshot of your hyperparameters, with a SHA-256 hash, so two runs with the same settings are recognisable and a diff shows what changed
log()Scalar metrics with step, epoch and wall time (the tracking API also accepts histogram, image, audio, video, table, plot and text metric types)
log_table(), log_image()Tables of rows and images, by key and step
tag()Free-form tags on the run
automaticCPU and memory usage while the run is open, from a background thread

On the server, the tracking data model also has room for GPU, GPU memory, disk and network metrics, which can be sent through the tracking API. Metrics stream to the interface live over server-sent events while a run is in progress, and a comparison endpoint lines up runs side by side.

Letting the training agent read the run

When a training job's metrics come back, the training agent analyses them. With a language model configured it writes the analysis; if the model is unavailable it falls back to fixed rules, which are worth knowing because they also make good habits:

SignalRule-based reading
Training accuracy minus validation accuracyabove 0.05 mild, above 0.15 moderate, above 0.25 severe overfitting
Validation loss against training lossmore than 1.5 times training loss is flagged
Validation score0.95 or more excellent, 0.85 good, 0.70 fair

These readings are only possible if you log both training and validation metrics, at every epoch, under consistent names.

Two things to know

log_artifact() records a reference, not a file. It stores the path or URI and a type (model, dataset, and so on). Put the artefact itself in your object storage and log its URI, so the run points at something durable.
Authentication. The SDK sends the API key you pass as a bearer token. Confirm with your administrator which kind of token your InsightMLFlow deployment accepts before rolling the SDK out to a team.

Habits that make tracking useful

  • One experiment per question. "v3-gradient-boosting" is a question; "test-final-2" is not.
  • Log the configuration, always. The config snapshot's hash is what lets you find the run that produced a result later.
  • Log validation metrics at every epoch. The training agent's overfitting checks compare training and validation, so it needs both.
  • Tag the data version. A run is only reproducible if you know which data it used.
  • Finish every run. Use the context manager so crashed runs are closed cleanly.

The notebook helpers that come with the SDK cover reading and writing OCI buckets, quick profiling and VIF, quick training and model comparison, and plotting, for the exploratory part before you start tracking.

Naming metrics so the training agent can read them

The rule-based checks look for specific metric names. If you want them to work, log these names (or both members of a pair):

The check needsMetric names it looks for
Accuracy gap (overfitting)accuracy or train_accuracy, and val_accuracy
Loss ratioloss or train_loss, and val_loss
Quality bandval_accuracy, falling back to the training accuracy

The example at the top of this guide logs val_auc, which is a perfectly good metric but not one the rules read; the loss pair is what they will use. For a regression model with no accuracy metric, the quality band is not produced, and the language model's analysis (when configured) is what reads the errors.

What happens on the wire

  • Each log() call is one HTTP request, sent synchronously with a 30-second timeout. Logging every batch in a fast loop adds that round trip to every step; logging once per epoch, or every few hundred steps, is usually enough.
  • Failures do not stop training. If the server cannot be reached, the SDK logs a warning and carries on, so a network problem costs you metrics, not the run. Check the run on the server after the first epoch of anything long.
  • Steps count themselves. Leave step out and it increments by one per call; pass it and the counter continues from there.
  • System metrics every 30 seconds. CPU and memory percentages are sent by a background thread, if the psutil package is installed; without it, nothing is collected.
Convert numpy values. log() records plain Python numbers as scalars and dictionaries as tables, and silently skips anything else. A numpy.float32 or numpy.int64 is not a Python float or int, so wrap values in float() before logging.

The pattern, with those points applied

with im.init(project="churn-model", experiment="v4-lower-learning-rate",
             api_url=API_URL, api_key=API_KEY) as run:
    run.config(params)
    run.tag("data_version", "2026-10-31")
    for epoch in range(epochs):
        metrics = train_one_epoch(model)   # train_loss, val_loss, val_accuracy, ...
        run.log({k: float(v) for k, v in metrics.items()}, epoch=epoch)

The context manager closes the run if training raises, the tag records the data version, the metric names match what the training agent's rule-based checks read, and the float() conversion keeps numpy values from being skipped.

Questions

Can I use it without creating a run object?

Yes. im.init() sets an active run, and the module-level im.log(), im.config() and im.finish() act on it, which is convenient in a notebook.

Does finishing a run upload anything?

No. Everything was sent as it was logged, so there is nothing to flush at the end; finish() stops the system-metrics thread and closes the run locally.

Run it on one of your own models

Bring a dataset and a model you already train. We profile it, track a run and measure drift with you in your own cloud.

Request a demo