Axfood, Sweden’s second-largest food retailer, has succeeded in improving the efficiency and scalability of their AI and machine learning operations with the help of Amazon Web Services (AWS) experts using Amazon SageMaker. Despite having numerous data science teams with their own ways of working, the organization saw the need for a new Machine Learning Operations (MLOps) best practice.
The team decided to construct a prototype from one of Axfood’s most advanced machine learning models, which forecast sales in stores and was perfect for optimizing sales and minimizing food waste. The goal of the prototype was to create a template for all data science teams in order to build scalable and effective machine learning models.
The team built a complete ML pipeline for a business case, entailing training the model to make predictions using historical data and applying the trained model to forecast future events. A high-functioning pipeline was already set with SageMaker notebooks and the third-party workflow management platform Airflow when the team decided to modernize the platform and move to Amazon SageMaker Studio and SageMaker Pipelines.
The new ML template is structured around two main pipelines, the Model Build pipeline and the Batch Inference pipeline. Both have been versioned within two separate Git repositories and are packaged into a custom project template using SageMaker Projects. This setup integrates with a third-party Git repository and Bitbucket pipelines for continuous integration and deployment (CI/CD) components.
The platform can be reused fully, and most changes can be limited to the pipeline definition and the logic for preprocessing, training, inference, and postprocessing. With SageMaker custom containers hosting the training and inference scripts, any variety of models can be accommodated without alterations to the data and model monitoring steps.
Efforts have been made to enhance the system’s generality and to reduce the amount of repetitive code in the platform. The solution has resulted in an MLOps template following current best practices that are efficient to use subsequently by all of Axfood’s data science teams. The collaboration with AWS and the automation of MLOps tasks have led to the inclusion of several functionalities including model monitoring, data lineage, and model registry.
The MLOps project’s successful implementation will facilitate Axfood’s data team in devising ML workflows in a more standardized manner. It will help simplify analysis and real-time monitoring of models in production, ensuring the quality and accuracy of ML models maintained by Axfood’s teams.