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
| Call | Recorded |
|---|---|
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 |
| automatic | CPU 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:
| Signal | Rule-based reading |
|---|---|
| Training accuracy minus validation accuracy | above 0.05 mild, above 0.15 moderate, above 0.25 severe overfitting |
| Validation loss against training loss | more than 1.5 times training loss is flagged |
| Validation score | 0.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.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 needs | Metric names it looks for |
|---|---|
| Accuracy gap (overfitting) | accuracy or train_accuracy, and val_accuracy |
| Loss ratio | loss or train_loss, and val_loss |
| Quality band | val_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
stepout 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
psutilpackage is installed; without it, nothing is collected.
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.