<?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 Romain Deseine on Medium]]></title>
        <description><![CDATA[Stories by Romain Deseine on Medium]]></description>
        <link>https://medium.com/@romaindeseine?source=rss-2bc2cedd4f38------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Romain Deseine on Medium</title>
            <link>https://medium.com/@romaindeseine?source=rss-2bc2cedd4f38------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:00:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@romaindeseine/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[Scaling ML at Choose: How We Ship Models to Production]]></title>
            <link>https://medium.com/appchoose/scaling-ml-at-choose-how-we-ship-models-to-production-1140e63c8c45?source=rss-2bc2cedd4f38------2</link>
            <guid isPermaLink="false">https://medium.com/p/1140e63c8c45</guid>
            <dc:creator><![CDATA[Romain Deseine]]></dc:creator>
            <pubDate>Fri, 18 Jul 2025 08:47:17 GMT</pubDate>
            <atom:updated>2025-07-18T09:29:41.383Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QiHRa7Ox_Cz4z9cQdgjWEg.png" /></figure><p><em>At Choose, personalization is at the heart of our product. From flash sales to product recommendations, our machine learning models power key user experiences.</em></p><p><em>But training a good model is just the beginning. Making it available reliably in production? That’s where it gets complicated.</em></p><p><em>In this article, I share how we package and serve our models at Choose so they’re always ready to deliver value.</em></p><h3>Key Takeaways</h3><ul><li>A 5-person Data team can effectively scale ML models for hundreds of thousands of users</li><li>Smart pre-computation often beats real-time in terms of efficiency and costs</li><li>Building on your existing stack rather than adding new tools can transform your productivity</li><li>Architectural simplicity is your best friend for peaceful maintenance</li><li>SQL can become a remarkably powerful interface for ML in production</li></ul><h3>The Challenge: Personalizing for Hundreds of Thousands of Users with Just One Data Scientist</h3><p>Choose is a mobile app that offers daily flash sales. Picture this: every day, thousands of different products, several hundred thousand users with unique preferences, and the need to personalize the experience in near real-time.</p><p>Our equation was simple but brutal: how do we ensure each user sees the right sales at the right time, with a Data team of only 5 people?</p><h4>The Trap of Point Solutions</h4><p>Initially, we operated like many teams: ad-hoc solutions, deployed case by case. A model for sales ranking here, another for recommendations there… Each deployment was manual, each model had its own production logic.</p><p>The result? Technical debt that grew exponentially and a team spending more time maintaining infrastructure than creating business value.</p><p>We needed a system that was:</p><ul><li><strong>Automated</strong>: to avoid manual deployments and limit errors</li><li><strong>Reliable</strong>: so our users always have personalized recommendations</li><li><strong>Scalable</strong>: to easily add new use cases</li><li><strong>Simple to maintain</strong>: so a team with one Data Scientist can focus on innovation</li></ul><h3>Our Solution: Smart Pre-computation Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*m75bePNujc3CtQTU.png" /></figure><p>Facing this challenge, we developed a pragmatic approach built on three technological pillars already present in our stack: BigQuery, Prefect, and Postgres.</p><blockquote><strong>Important note:</strong> These specific tools aren’t the essential part. What matters is having a data warehouse for computation (Snowflake, Databricks…), an orchestrator for automation (Airflow, Dagster…), and a read-optimized database for serving (Redis, MongoDB…). The important thing is to build on your existing stack.</blockquote><h3>Why Pre-computation Instead of Real-time?</h3><p>Most tech companies immediately think “real-time serving” when talking about ML in production. We made the opposite choice: pre-compute scores and serve them from an optimized database.</p><p>Why this approach appeals to us:</p><ul><li><strong>User performance</strong>: Our APIs respond ultra-fast because scores are already calculated. No waiting for the end user, just the time to retrieve data (minimal latency).</li><li><strong>Budget under control</strong>: No more expensive GPU servers running 24/7. AI models require very powerful graphics processors for real-time calculations, but with our approach, we run them a few hours per day on standard machines.</li><li><strong>Simple architecture</strong>: We clearly separate two responsibilities: on one side score computation, on the other their distribution to users. Each part can evolve independently.</li><li><strong>Easier experimentation</strong>: We pre-compute scores for all our user cohorts (test groups), which simplifies our A/B tests. Bonus: we can even secretly test new models on real production data without impact on our users.</li></ul><p>But it’s not magic, there are trade-offs:</p><ul><li><strong>Data freshness</strong>: Our scores are updated in batches (every hour for us), not in real-time. If a user buys a product, their next scores won’t account for it until the next refresh.</li><li><strong>Additional computation step</strong>: Unlike the classic approach where the model calculates scores instantly on demand, we’ve added a scheduled intermediate step. If our data pipelines fail, scores are no longer updated.</li></ul><h3>Detailed Architecture: 3 Components, 1 Smooth Workflow</h3><h4>1. BigQuery: The Computation Brain</h4><p><strong>Why BigQuery?</strong> Three reasons convinced us: our Data team already masters it, it handles large volumes perfectly, and most importantly… it supports BigQuery ML for direct inference!</p><p>The process is surprisingly simple:</p><ul><li><strong>Model import</strong>: We use the ONNX format, a standard that allows exporting AI models created with different tools (Python, TensorFlow, PyTorch…) to BigQuery. It’s like a “universal format” for models.</li><li><strong>Scoring in SQL</strong>: Once the model is imported, we can use it directly in our SQL queries with the PREDICT function, as if it were a normal function.</li></ul><blockquote><strong>The unexpected advantage</strong>: Anyone on the team who knows SQL can now query models, do analysis, or even test new versions! Gone are the days when only the Data Scientist could touch the models.</blockquote><h4>2. Prefect: The Orchestrator That Never Lets You Down</h4><p>Prefect handles two critical missions:</p><ul><li><strong>Score automation</strong>: scheduled execution of BigQuery calculations</li><li><strong>Ingestion to Postgres</strong>: reliable transfer of results to the service layer</li></ul><p>The monitoring interface gives us complete visibility into our pipeline status. In case of failure, rapid manual intervention is possible.</p><h4>3. Postgres: The Ultra-Fast Service Layer</h4><p>To serve scores to our API, we use Postgres with an <strong>optimized storage</strong> strategy.</p><p><strong>Key concept</strong>: Instead of storing individual scores, we pre-compute and store the final results directly (sorted lists, recommendations, etc.).</p><p>The API performs direct SELECT queries using the indexed user_id. Postgres returns the pre-computed list that the API immediately uses to personalize the experience.</p><h3>Concrete Results: The Metrics That Matter</h3><h4><strong>Performance:</strong></h4><ul><li>API latency: &lt; 50ms to retrieve personalized recommendations (even on small servers without GPU)</li><li>Availability: 99.9% (with automatic fallback in case of failure)</li></ul><h4><strong>Team productivity:</strong></h4><ul><li>New model deployment: from several days to a few hours</li><li>Time spent on flow maintenance: virtually zero (0 pipeline-related incidents since deployment)</li><li>Parallel experimentation: dramatically increased ease</li></ul><h4><strong>Costs:</strong></h4><ul><li>Serving infrastructure: ~5x reduction vs real-time solution (no expensive GPU servers)</li><li>BigQuery costs: slight increase but negligible compared to API server savings</li></ul><h3>Lessons Learned: What We Would Do Differently</h3><h4>✅ What Works Very Well</h4><ul><li><strong>Architectural simplicity</strong>: fewer components = fewer failure points</li><li><strong>Reusing existing tools</strong>: building on the stack already mastered by the team</li><li><strong>SQL as interface</strong>: our Data Analyst can now do ML experiments independently</li><li><strong>Separation of concerns</strong>: Data Engineer manages infra, Data Scientist focuses on models</li></ul><h4>⚠️ Points of Attention</h4><ul><li><strong>Critical monitoring</strong>: pipeline health determines service quality</li><li><strong>Version management</strong>: naming and rollback strategy to think through from the start</li><li><strong>Single point of failure</strong>: with one Data Scientist, documentation becomes crucial</li><li><strong>Data quality</strong>: with this architecture, the only bugs encountered come from upstream data quality</li></ul><h4>🚀 Future Evolutions</h4><p>Our pre-computation architecture is now ultra-robust and no longer requires major evolutions. But as often in tech, solving one problem opens up new, more interesting ones!</p><p>Today, our focus is on observability: how do we ensure our models continue to serve our users well? Paradoxically, our choice of pre-computation makes the task easier: by having batch data, we can more easily analyze trends and detect anomalies.</p><h3>Conclusion: Scalability Through Simplicity</h3><p>Our approach at Choose demonstrates that it’s not always necessary to complicate things to scale. By choosing pre-computation over real-time, building on our existing stack, and prioritizing architectural simplicity, we’ve managed to maintain an agile team while serving several hundred thousand users.</p><p>The next time you think about your ML architecture, ask yourself this question: do you really need real-time, or could smart pre-computation be your best ally?</p><h3>The Secret Pillar: DBT, The Invisible Orchestrator</h3><p>But I’ve saved the best for last. In everything I’ve just told you, I deliberately omitted mentioning the true conductor of our architecture: <strong>DBT</strong>.</p><p>You might wonder how we transform our raw data into ML-ready features? How do we guarantee the quality of our pipelines? How do we manage dependencies between our different data models?</p><p>The answer comes down to three letters: <strong>DBT</strong>.</p><p>It orchestrates all the magic under BigQuery. It transforms our raw user events into structured ML features, handles automatic quality tests, and allows us to treat our data transformations like code (versioning, tests, documentation).</p><p>This “Analytics Engineering” approach has revolutionized how we work. It deserves its own detailed article, as it represents perhaps the most important evolution of our Data Science stack.</p><p><em>Coming soon on Medium: “From Analytics Engineering to ML Engineering: How DBT Transformed Our Data Team”</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1140e63c8c45" width="1" height="1" alt=""><hr><p><a href="https://medium.com/appchoose/scaling-ml-at-choose-how-we-ship-models-to-production-1140e63c8c45">Scaling ML at Choose: How We Ship Models to Production</a> was originally published in <a href="https://medium.com/appchoose">appchoose</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>