<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vamsi Krishna on Medium]]></title>
        <description><![CDATA[Stories by Vamsi Krishna on Medium]]></description>
        <link>https://medium.com/@vamsikrishnap97?source=rss-9b5d6ea0a709------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XqURq2C01eYzPLSJ0FPTlg.jpeg</url>
            <title>Stories by Vamsi Krishna on Medium</title>
            <link>https://medium.com/@vamsikrishnap97?source=rss-9b5d6ea0a709------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:59:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vamsikrishnap97/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building Rock-Solid ML Systems]]></title>
            <link>https://medium.com/swiggy-bytes/building-rock-solid-ml-systems-d1d5ab544f0e?source=rss-9b5d6ea0a709------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1d5ab544f0e</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[operational-excellence]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Vamsi Krishna]]></dc:creator>
            <pubDate>Wed, 11 Dec 2024 10:13:55 GMT</pubDate>
            <atom:updated>2024-12-11T10:55:06.118Z</atom:updated>
            <content:encoded><![CDATA[<h4>Best Practices for Operational Excellence and Reliability</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*6XS36y9n1lmn5U-K" /></figure><p>At Swiggy, machine learning drives a lot of critical applications that millions of customers depend on daily from Instamart grocery recommendations to the estimated time of arrival (ETA) of your order from your favorite restaurant. These ML models enable Swiggy to run like a well oiled machine and are pivotal for our broader vision of providing unparalleled convenience to our customers. The accuracy and reliability of these predictions are not just important but they are <strong>business</strong> <strong>critical</strong>. Any system failure or erroneous prediction could have significant consequences for our customers, restaurants or delivery executives. This makes ML Opex i.e. operational excellence in machine learning not just a goal, but <strong>an absolute necessity</strong>. In this blog, we’ll explore how Swiggy ensures ML reliability at scale by focusing on best practices that deliver consistent performance across our systems.</p><h3>Why do we need ML Opex?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HHr1I2Yy0oT4Umr5" /></figure><p>Typically, Machine Learning systems are not “set and forget”. There is a clear need of constant monitoring and updates. There have been multiple instances at Swiggy and across the industry as well where the need for best ML Opex practices has been established.</p><p>Let us talk about two such examples at Swiggy:</p><ul><li><em>Here is an illustrative example: </em><a href="https://bytes.swiggy.com/predicting-food-delivery-time-at-cart-cda23a84ba63"><strong><em>Estimated Time of Arrival (ETA)</em></strong></a><strong><em> predictions </em></strong><em>are key for customer experience as it gives the user a sense of assurance. It is a Machine Learning algorithm with a mix of hyper-local, temporal and real-time features, all of which are computed on the logs cutting across multiple engineering services. One of our upstream services inadvertently provided data in milliseconds instead of microseconds. In the absence of the right measures the model would have produced erroneous ETA predictions, however, with safeguards like input-clipping and real time observability we solve for this. More on these safeguards later.</em></li><li><strong><em>Swiggy Bolt</em></strong><em> is a service offering 10-minute delivery, currently available at select restaurants for their fast-prep items. On the similar lines, </em><strong><em>Swiggy XL</em></strong><em> offers orders for large, party-sized deliveries, enabled through our brand new three-wheeler fleet. With any new product capability, the obvious changes are implemented in downstream systems and models. However, underlying shifts in data distribution and second-order implications on the model features often arise. These shifts can result in suboptimal predictions, hindering our ability to deliver </em><strong><em>unparalleled convenience</em></strong><em> to our customers.</em></li></ul><p>These examples tell us the <strong>absolute necessity</strong> of having comprehensive Machine Learning reliability measures and monitoring systems, where the smallest of data discrepancies or a new product capability can lead to significant inefficiencies in our operations.</p><p>Updates to engineering systems and products are inevitable and at Swiggy, they happen quite frequently! This keeps us constantly focused on enhancing the reliability and resilience of our ML models, ensuring they perform seamlessly in a dynamic environment.</p><h4>Understanding the Difference from Engineering System Opex</h4><p>At the heart of it, Engineering System Opex is very different from ML Opex. Traditionally, Engg Systems is about keeping services fast and stable whereas for ML systems there are a multitude of other performance metrics that one needs to track. The key differences are as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nTW0EvAa9vFgc5GPGNrcKg.png" /></figure><p>The additional metrics that one needs to track for machine learning systems is purely a result of the probabilistic nature of ML systems as opposed to deterministic wrt Engineering Systems.</p><h3>Brief Introduction of ML OpEx at Swiggy</h3><p>To ensure that machine learning systems provide reliable and effective results, we need to focus on two key phases: <strong>pre-deployment</strong> and <strong>post-deployment. </strong>Both of these are critical to ensure model performance is seamless in production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tU8fPuKdinc1-HNz" /></figure><h4><strong>Pre-deployment</strong>:</h4><blockquote><strong><em>Exploratory Data Analysis (EDA):</em></strong></blockquote><p><em>“EDA is like cleaning your room. You start by picking up the obvious trash!”</em></p><p>This<strong> </strong>is key for any machine learning model, it provides the data scientist with a clear understanding of the underlying distribution and potential anomalies in the data. It enables the data scientist to</p><ol><li>Remove the noise to build a more effective model.</li><li>Identify any shift in distribution between train and validation data.</li><li>Have a clearer picture of the potential risks associated with model performance</li><li>Make an informed decision with respect to feature creation and model building.</li></ol><blockquote><strong><em>Sensitivity Analysis:</em></strong></blockquote><p><em>“It’s like tuning a musical instrument. Your model either sounds like a masterpiece… or an alien trying to communicate.”</em></p><p>Before deploying the model, it’s essential to understand how sensitive the model is to different values for each variable.</p><ul><li>Identify model weaknesses and non-intuitive behavior by evaluating sensitivity to variable changes.</li><li>Determine each feature’s “operating range” where the model maintains confidence.</li></ul><blockquote><strong><em>Unit Testing:</em></strong></blockquote><p><em>“Where every line of code is a villain and unit tests are the only hero.”</em></p><p>Pretty similar to what we do in traditional software development, we need to pass our model pipeline through thorough unit testing.</p><ul><li>Perform unit testing across the pipeline, covering data preprocessing, feature generation, and serving.</li><li>Validate data quality between offline training data and real-time/historical feature jobs, and test input-output transformations in TensorFlow Serving.</li></ul><blockquote><strong><em>Offline Shadow Mode:</em></strong></blockquote><p><em>“Test in peace, knowing full well that when the model hits production, chaos will reign.”</em></p><p>This is a strategy to assess the model’s ability to predict on a historical dataset specifically on an out of time data set.</p><ul><li>This will establish if the model generalizes well and shows similar metrics on an out of time dataset.</li><li>This technique allows us to fine-tune the model without impacting downstream services</li></ul><blockquote><strong><em>Online Shadow Mode:</em></strong></blockquote><p><em>“Not taking credit for it… . yet.”</em></p><p>This is a strategy to assess a model’s ability to predict under real-world data.</p><ul><li>The model predicts on live production-grade data, but predictions are stored separately without being consumed.</li><li>Comparing predictions to known outcomes estimates real-world performance.</li><li>Offline shadow testing provides a controlled environment; it cannot fully capture the nuances of production-grade streaming data, which can exhibit temporal patterns, distribution shifts, or unseen edge cases.</li></ul><blockquote><strong><em>Fallback Mechanism:</em></strong></blockquote><p><em>“When your model goes haywire, it’s time for the big red button.”</em></p><p>What happens if the model fails and is providing wildly erroneous predictions? Depending on the product we can have multiple kinds of fallbacks.</p><p><strong>Biz Critical Real-Time Model with high features and variability</strong></p><p>These models usually are critical and very difficult to build fail-safes around. The typical approach we follow is</p><ul><li><strong>Input Clipping:</strong> Restrict inputs beyond the defined operating range to its max/min values to maintain reasonable outputs.</li><li><strong>Output Clipping:</strong> Set output limits to handle unusual results for specific feature value combinations.</li></ul><p>The goal of any machine learning algorithm is to be able to predict on “unseen” data and for the model to extrapolate well. The thought behind clipping isn’t to limit this ability but to avoid obvious errors. Defining the right operating ranges allows us to find the right tradeoff between risk-aversion and model extrapolation.</p><p><strong>Real Time Model with limited features and variability</strong></p><p>For these kinds of models, one can have simple heuristic fallbacks which can act as a placeholder until the issues with the primary model are fixed.</p><p><strong>Non-critical real-time model</strong></p><p>For non-business-critical models, we can automatically disable the model when its predictions become unreliable. Once its reliability improves, the model can be reactivated.</p><p><strong>Non Real time model</strong></p><p>For these models, one can create the aforementioned fallbacks or depending on the feasibility and criticality we can even engage human oversight.</p><blockquote><strong><em>Error Codes:</em></strong></blockquote><p><em>“The model can’t decide, might be right… might be wrong. Send help!!!”</em></p><p>Error codes are an essential part of any engineering system, in a ML system it can be used as a proxy for confidence in the output. Based on the specific use case, the service consuming the model output can then determine how to handle the model’s predictions for downstream applications. Error codes could be of the form</p><ul><li>Clean prediction without any imputation.</li><li>Input Clipped</li><li>Output Clipped</li><li>Fallback to previous version/ heuristic prediction</li></ul><p>Based on this, we can choose BCP (<strong>Business Continuity Plan</strong>) &amp; get buffer time to fix the error without getting impacted heavily.</p><h4><strong>Post-deployment</strong>:</h4><p>We divide monitoring and alerting into 3 specific groups</p><ul><li><strong>Real-Time Alerts:</strong> Immediate P0 alerts for potential inaccuracies in features or predictions, requiring urgent attention from Engineering and Data Science teams.</li><li><strong>Feature Drift Alerts:</strong> Highlight shifts in feature distributions, signaling the need for investigation into long-term efficacy.</li><li><strong>Output Variable Drift Alerts:</strong> Indicate drifts in actual values, prompting data scientists to assess models for re-training or intervention.</li></ul><h3>Conclusion</h3><p>Both the pre-deployment and post-deployment phases are critical to the success of any machine learning system. The pre-deployment phase lays the foundation for a robust and reliable model, while continuous monitoring ensures resilience in real-world scenarios. Together, these steps form the backbone of a high-performing ML system.</p><p>In this blog, we’ve primarily focused on the <strong><em>why</em></strong> and <strong><em>what</em></strong> behind ML OPEX, giving you a solid understanding of the key processes involved. But this is just the beginning! In our upcoming blogs, we will dive into the <strong><em>how</em></strong> — unpacking each phase with detailed insights, best practices, and loads of Swiggy anecdotes to illustrate the nuances of ML deployment. Get ready for more in-depth discussions, expert tips, and exciting stories that will help you take your ML systems to the next level! Stay tuned!</p><h4>Author</h4><p><a href="/service/mailto:vamsi.p@swiggy.in">Vamsi Krishna</a></p><h4><strong>Guide</strong></h4><p><a href="/service/mailto:goda.doreswamy@swiggy.in">Goda Doreswamy Ramkumar</a></p><h4><strong>Reviewer</strong></h4><p><a href="/service/mailto:nishant.agrawal@swiggy.in">Nishant Agrawal</a> <a href="/service/mailto:sunil.rathee@swiggy.in">Sunil Rathee</a> <a href="/service/mailto:soumyajyoti.banerjee@swiggy.in">Soumyajyoti Banerjee</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1d5ab544f0e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swiggy-bytes/building-rock-solid-ml-systems-d1d5ab544f0e">Building Rock-Solid ML Systems</a> was originally published in <a href="https://medium.com/swiggy-bytes">Swiggy Bytes — Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>