jeremyjordan / ml-monitoring

A demo of Prometheus+Grafana for monitoring an ML model served with FastAPI.
https://www.jeremyjordan.me/ml-monitoring/
MIT License
226 stars 60 forks source link

How to Monitor NLP Models? #6

Closed rileyhun closed 3 years ago

rileyhun commented 3 years ago

Hi Jeremy,

I'm following your template for a POC, and it's been very helpful. I'm creating a REST API for an NLP model (Multinomial Naive Bayes) and I'm not sure how to monitor this particular model when the predictions are classes instead of float values like the wine quality prediction model. How would the prometheus instrumentation be used to capture metrics for classification models?

Thanks,

Riley

jeremyjordan commented 3 years ago

Hi @rileyhun! There's a few things you can do here:

I'm sure there's more, these are just the first couple ideas off the top of my head.

rileyhun commented 3 years ago

This is helpful! Thanks @jeremyjordan. I'll give it a try

Hi @rileyhun! There's a few things you can do here:

  • log the probability for each class (you can use labels on the metric as long as it's sufficiently low cardinality)
  • log the word count for your input text
  • log the character count for your input text
  • log the number of unique characters in your input text

I'm sure there's more, these are just the first couple ideas off the top of my head.

This is helpful! Thanks @jeremyjordan. I'll give it a try

sujanshirol commented 2 years ago

Hi @jeremyjordan,

Thank you for listing out what to log. I'm working on a similar project. What do you think is the right tool to log and monitor. I'm looking into Prometheus and Grafana. What are your thoughts?

RohitRanga12 commented 2 years ago

@rileyhun Hi! I am working on a text classification problem, and would like to use prometheus and grafana to monitor. Would you be able to share your code for me to understand how it works?