This is a guest post co-authored with Nafi Ahmet Turgut, Hasan Burak Yel and Damla Şentürk from Getir.
Established in 2015, Can has positioned itself as a pioneer in the field of ultra-fast grocery delivery. This innovative technology company has revolutionized the last mile delivery segment with its attractive 'groceries in minutes' offering. With a presence in Turkey, the United Kingdom, the Netherlands, Germany and the United States, Getir has become a multinational force to be reckoned with. Today, the Getir brand represents a diversified conglomerate spanning nine different verticals, all working synergistically under a singular umbrella.
In this post, we explain how we built an end-to-end product category prediction pipeline to help business teams using Amazon SageMaker and AWS Batch, reducing model training duration by 90%.
Understanding our existing product range in detail is a crucial challenge that we, along with many businesses, face in today's fast-paced and competitive market. An effective solution to this problem is product category prediction. A model that generates a complete category tree allows our commercial teams to compare our existing product portfolio with that of our competitors, offering a strategic advantage. Therefore, our central challenge is the creation and implementation of an accurate product category prediction model.
We leverage the powerful tools provided by AWS to address this challenge and effectively navigate the complex field of machine learning (ML) and predictive analytics. Our efforts led to the successful creation of an end-to-end product category prediction pipeline, combining the strengths of SageMaker and AWS Batch.
This predictive analytics capability, particularly accurate forecasting of product categories, has proven invaluable. Provided our teams with critical data-driven insights that optimized inventory management, improved customer interactions, and strengthened our market presence.
The methodology we explain in this post ranges from the initial phase of collecting the feature set to the final implementation of the prediction process. An important aspect of our strategy has been using SageMaker and AWS Batch to refine pre-trained BERT models for seven different languages. Additionally, our seamless integration with AWS's object storage service, Amazon Simple Storage Service (Amazon S3), has been key to efficiently storing and accessing these refined models.
SageMaker is a fully managed machine learning service. With SageMaker, data scientists and developers can quickly and effortlessly build and train machine learning models, then deploy them directly to a production-ready hosted environment.
As a fully managed service, AWS Batch helps you run batch computing workloads of any scale. AWS Batch automatically provisions compute resources and optimizes workload distribution based on the number and scale of workloads. With AWS Batch, you don't need to install or manage batch computing software, so you can focus your time on analyzing results and resolving issues. We use GPU jobs that help us run jobs that use the GPUs of an instance.
Solution Overview
Five people from Getir's data science team and infrastructure team worked together on this project. The project was completed within a month and was put into production after a week of testing.
The following diagram shows the architecture of the solution.
The model in progress is run separately for each country. The architecture includes two AWS Batch GPU cron jobs for each country, which run at defined schedules.
We overcame some challenges by strategically deploying GPU resources from SageMaker and AWS Batch. The process used to address each difficulty is detailed in the following sections.
Tuning Multilingual BERT Models with AWS Batch GPU Jobs
We were looking for a solution that supported multiple languages for our diverse user base. BERT models were an obvious choice due to their established ability to handle complex natural language tasks effectively. To tailor these models to our needs, we leverage the power of AWS by using single-node GPU instance jobs. This allowed us to fine-tune pre-trained BERT models for each of the seven languages we needed support for. Through this method, we ensure high accuracy in predicting product categories, overcoming any possible language barrier.
Efficient model storage with Amazon S3
Our next step was to address model storage and management. For this, we selected Amazon S3, known for its scalability and security. Storing our tuned BERT models in Amazon S3 allowed us to provide easy access to different teams within our organization, which significantly streamlined our deployment process. This was a crucial aspect in achieving agility in our operations and seamless integration of our ML efforts.
Create an end-to-end prediction pipeline
An efficient process was needed to get the most out of our pre-trained models. We first implemented these models in SageMaker, a move that enabled real-time predictions with low latency, thus improving our user experience. For larger scale batch predictions, which were equally vital to our operations, we used AWS Batch GPU Jobs. This ensured optimal use of our resources, providing us with a perfect balance between performance and efficiency.
Exploring future possibilities with SageMaker MME
As we continue to evolve and look for efficiencies in our machine learning process, one avenue we are interested in exploring is using SageMaker Multi-Model Endpoints (MME) to deploy our optimized models. With MME, we can potentially streamline the deployment of multiple optimized models, ensuring efficient model management while benefiting from native SageMaker capabilities such as shadow variants, auto-scaling, and Amazon CloudWatch integration. This exploration aligns with our continued pursuit to enhance our predictive analytics capabilities and deliver superior experiences to our customers.
Conclusion
Our successful integration of SageMaker and AWS Batch has not only addressed our specific challenges but has also significantly increased our operational efficiency. By implementing a sophisticated product category prediction process, we can arm our sales teams with data-driven insights, thereby facilitating more effective decision-making.
Our results say a lot about the effectiveness of our approach. We have achieved 80% prediction accuracy across all four levels of category granularity, which plays an important role in shaping product variety for each country we serve. This level of accuracy extends our reach beyond language barriers and ensures we serve our diverse user base with the utmost precision.
Additionally, by strategically using AWS Batch GPU scheduled jobs, we have been able to reduce our model training duration by 90%. This efficiency has further simplified our processes and strengthened our operational agility. Efficient model storage using Amazon S3 has played a key role in this achievement, balancing real-time and batch predictions.
To learn more about how to get started building your own machine learning pipelines with SageMaker, see the Amazon SageMaker resources. AWS Batch is a great choice if you're looking for a low-cost, scalable solution to run batch jobs with low operational overhead. To get started, see Getting Started with AWS Batch.
About the authors
Nafi Ahmet Turgut He completed his master's degree in Electrical and Electronic Engineering and worked as a graduate research scientist. His goal was to create machine learning algorithms to simulate neural network anomalies. He joined Getir in 2019 and currently works as Senior Manager of Data Science and Analytics. His team is responsible for designing, implementing and maintaining end-to-end machine learning algorithms and data-driven solutions for Getir.
Hasan Burak Yel He received his bachelor's degree in Electrical and Electronic Engineering from Boğaziçi University. He worked at Turkcell, mainly focusing on time series forecasting, data visualization and network automation. He joined Getir in 2021 and currently works as a Data Science and Analytics Manager with responsibility for the Search, Recommendation and Growth domains.
Damla Sentürk He received his bachelor's degree in Computer Engineering from Galatasaray University. She continues her master's degree in Computer Engineering at Boğaziçi University. She joined Getir in 2022 and has been working as a data scientist. She has worked on commercial, supply chain and discovery-related projects.
Esra Kayabali is a Senior Solutions Architect at AWS, specializing in the analytics domain, including data warehousing, data lakes, big data analytics, batch and real-time data streaming, and data integration. He has 12 years of experience in software architecture and development. He is passionate about learning and teaching cloud technologies.