Skip to content
~/sgevorg
Go back

Exposing the hidden links between AI training metrics

AI experiment metrics

AI experiment metrics

The result of ML training runs are the ML models. The models are giant matrices that are hard to read and make sense of (mostly). However there is a need to debug and verify the model performance systematically during and after the training.

AI researchers collect dozens of metrics during training runs in order to

Metrics are a numeric time-series data collected during an iterative process.

ML training is an iterative process and so lots of metrics (we have seen 100s per training run among Aim users) are collected with different meaning and purpose behind them.

The metrics context

A considerable amount of tracked metrics are the same metric but collected in different ways with different meanings. For instance a loss could be collected in so many different ways. A few examples:

Even though these are all losses, however each one has a different context associated with it. Therefore they all have different role when analyzing and comparing the training runs.

There is also a relationship between these metrics. Most of the times they are collected so that they could be compared together. For instance, one of the most basic requirements for the experiment tracking tools is to be able to compare train loss and validation loss as it represents whether the model generalizes well or not.

Metric context adds totally new dimension to metrics and their relationship.

How do we use or represent this relationship in current experiment tracking tools?

Metric context in existing tools

AI researchers and engineers have been historically encoding all these additional pieces of information in the metric name.

So in most of them (including TensorBoard, MLFlow, Weights and Biases) metrics are treated as numeric sequences with a name.

Typical long metric names in TensorBoard

Metric name/contexts in Wandb

What are the issues with such representation?

Metrics as objects with properties

What if the experiment tracking tools could represent metrics as full-fledged objects with context and additional metadata attached to them.

Instead of multispectral_loss_l2 we would have just a loss with the following properties and the values:

You could access these properties both on the main UI of the tool while searching through metrics and on the API when automating over some metrics during evaluation time.

For instance you could search by loss type and submit a query like this:

SELECT loss IF loss.context.type == multispectral

This would select all the multispectral losses available. In contrast to that if you ran

SELECT loss

The system would return all the losses ever recorded by your experiments.

This is a relatively simple example of the conveniences it would add when treating metrics as an object with a context.

Conclusion

Having been a super-passionate TensorBoard user in the past, I would always wonder why metrics would not have more “life” to them?

Metrics being represented as full-fledged objects aren’t just beneficial for the experiment tracking visualization/debugging but also for further automations at the evaluation step - just much better API to work with than just parsing files from TensorBoard. In this way it’s just a lot more systematic and efficient.

Shameless Plug

We have channeled these “frunstrations” into the way we have designed the Aim metrics. You can use the track function to pass as many context variables as you’d like (described in here) and use them to query, group and do other manipulations with your metrics just like in this article.


I am Gev, an AI engineer, co-author of Aim. We have been super-lucky to have folks use Aim and share feedback, use-cases about experiment tracking. I am using these Substack series to share more about our experience in building Aim, generally AI dev tools, design decisions and dilemmas. You can find me on Twitter here.

Originally published on Substack on August 6, 2021.


Share this post:

Next Post
Initial commit