<?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 Sander Lam on Medium]]></title>
        <description><![CDATA[Stories by Sander Lam on Medium]]></description>
        <link>https://medium.com/@sanderlam?source=rss-491817486785------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*S91YDn-IbUCpFFRUSCEEOA.jpeg</url>
            <title>Stories by Sander Lam on Medium</title>
            <link>https://medium.com/@sanderlam?source=rss-491817486785------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 00:03:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sanderlam/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[I Simulated the World Cup 20,000 Times in 0.3]]></title>
            <link>https://medium.com/@sanderlam/i-simulated-the-world-cup-20-000-times-in-0-3-seconds-and-vibe-coded-the-whole-thing-on-databricks-da1780aa592e?source=rss-491817486785------2</link>
            <guid isPermaLink="false">https://medium.com/p/da1780aa592e</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[world-cup]]></category>
            <category><![CDATA[databricks-genie-code]]></category>
            <category><![CDATA[databricks]]></category>
            <dc:creator><![CDATA[Sander Lam]]></dc:creator>
            <pubDate>Mon, 08 Jun 2026 12:14:50 GMT</pubDate>
            <atom:updated>2026-06-08T20:53:06.167Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Simulated the World Cup 20,000 Times in 0.3 Seconds (and Vibe-Coded the Whole Thing on Databricks)</h3><p><em>How to easily beat your colleagues in the office prediction pool by letting AI build the data pipeline for you.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FJsNko2epPjPgBrGb9gJcg.png" /></figure><p><strong>TL;DR</strong></p><ul><li>My colleague <a href="https://www.linkedin.com/in/onno-van-der-horst/">Onno</a> built an open source World Cup prediction pool. Filling it in meant predicting manually for 100+ matches. Instead, I’ve made Genie Code build a Databricks project to do it properly with statistics, shipping as a Databricks Asset Bundle you can deploy in any workspace.</li><li>The project ingests 150 years of match data, rates every team, and simulates the full 48-team tournament 20,000 times in 0.29 seconds on Databricks serverless compute.</li><li>Back-tested across three past tournaments, it scores about 15% better than random, landing in the quality range of professional forecasters.</li></ul><p>Every big tournament, the same thing happens at work. Someone spins up a prediction pool, everyone fills in their scores, and a leaderboard turns your colleagues into rivals for a few weeks. This year, my colleague Onno built a proper one for the 2026 World Cup: predict every match, pick a champion and a top scorer, and make sure to climb the live leaderboard for some fancy prices. Onno open-sourced it, so any company can run the same pool for their team!</p><p>So, the front end is sorted. This leaves the small matter of filling in the actual results. 104 matches. 48 teams. A champion, a top scorer, and a few novelty prizes (we’re competing with Benelux &amp; Nordics, so predicting Netherlands vs Sweden correctly is of additional importance!).</p><p>But, filling this all in by hand in 2026?<br>No thanks, let’s vibe it up with Genie Code.</p><h3>How did Genie Code help us achieve this result without writing a single line of code?</h3><p>To get my results, I did not sit down and architect a data pipeline. I opened <a href="https://www.databricks.com/blog/introducing-genie-code"><strong>Genie Code</strong></a>, Databricks’ AI coding assistant, described what I wanted (“ingest public football data, build a proper match model, simulate the tournament many times, and write expected results of all matches to Unity Catalog”), and let it build the project. The math, the pipeline, the deployment config, all of it was written without my looking at a single line of code.</p><p>The result is a Databricks project that pulls in every international match ever played, learns how strong each team is, simulates the entire World Cup tens of thousands of times, and hands me a ready-to-copy list of predictions.</p><p>And the headline that still makes me smile: <strong>it simulates 20,000 complete World Cups in 0.29 seconds.</strong> Forty-eight teams, twelve groups, the awkward best-eight-third-place maths, the full knockout bracket through to the final, twenty thousand times over, on serverless.</p><h3>What is actually happening under the hood?</h3><p>Then, I asked Genie Code what it has actually done to create the logic. Because setting this up was super easy, but are the underlying techniques indeed statistically sound?</p><p>Genie Code told me that team strength comes from an <strong>Elo rating</strong> (every international since 1872 weighted, so recent and important matches count more) combined with a <strong>Dixon-Coles goal model</strong>, the standard approach for turning two teams into a realistic spread of scorelines. From there, it is a <strong>Monte Carlo simulation</strong>: play all 104 matches at random according to those probabilities, see who lifts the trophy, repeat 20,000 times.</p><blockquote>Spoiler alert: Argentina won about 16% of my simulated tournaments, with Spain and Brazil close behind.</blockquote><p>And this result is the prediction for which countries are most likely to win the tournament. Btw, all of this runs on free, open data (the martj42/international_results dataset), so there are no API keys and nothing to pay for.</p><h3>Is it any good, or just fast?</h3><p>A fair question to ask is whether it actually worked. By having Genie Code back-test its results on previous tournaments, it compares against random predictions (the worst), all the way up to professional bookmakers (the best predictions in the market).</p><p>To do the back-test, the project trains only on data from before a past tournament, predicts every match, and scores those predictions against what actually happened. Across the 2018 and 2022 World Cups and Euro 2024, it calculates an RPS (a standard forecasting metric; lower is better) around <strong>0.20</strong>, roughly <strong>15% better than naive guessing</strong>, and calls the right outcome 53 to 58% of the time.</p><p>Because back-testing multiple historical tournaments involves many moving parts, I used MLflow tracing to instrument the pipeline, giving me a clear visual breakdown of each simulation run, evaluation step, and logged metric.</p><p>Retrieving the true bookmaker odds for these tournaments was harder than I thought. Genie Code couldn’t find any publicly available data. But, <a href="https://pena.lt/y/2025/07/16/how-accurate-are-soccer-odds/">an analysis of 250 million betting lines</a> puts top bookmakers’ RPS for the major leagues at roughly 0.18 to 0.20, so our 0.20 sits right in that band.</p><p>Conclusion: With a single prompt, I would say we’re getting close to professional bookmakers, comfortably ahead of guessing. Good enough to win an office pool, but perhaps not good enough (yet) to quit my job.</p><h3>How is the project structured?</h3><p>Genie Code created the project as a <strong>Databricks Asset Bundle (DAB)</strong>, which is the default for clean, deployable data projects in Databricks. The output is a classic medallion shape: bronze (raw matches), silver (cleaned data and the 72 games), gold (the answers, like gold_champion_probs and gold_pick_sheet). My result was config-driven, so I could deploy it to any workspace by changing two variables, and the whole pipeline is one serverless job:</p><pre>variables:<br>  catalog: { default: main }<br>  schema: { default: worldcup_2026 }</pre><pre>databricks bundle deploy -t dev<br>databricks bundle run worldcup_predictor -t dev</pre><h3>What do I actually fill in?</h3><p>After the job ran, I could open a single notebook to see all the results: the champion, the top three Golden Boot picks, every group scoreline, and the knockout bracket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VOeGD7Ds7-5tKENQDL198g.png" /><figcaption>Champion probability, golden boot winners, and bonus prizes for Onno his pool</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQFMavcpkoXSQa6_Gq84UA.png" /><figcaption>Ranking of all countries, based on the simulation</figcaption></figure><p>Because the knockouts follow from my group picks, the simulation rolls all the way to a projected final: <strong>Spain 1–1 Argentina, Argentina on penalties.</strong> We will see how that ages..</p><h3>So what is the real point?</h3><p>The football is fun, but the lesson is bigger than winning beautiful prizes against your colleagues. A few years ago, “ingest 150 years of data, fit a statistical model, simulate a tournament 20,000 times, and ship a deployable pipeline” was a couple of weeks of work for someone who already knew what Elo and Dixon-Coles were.</p><p>This time I described the goal (pun intended) in plain language, Genie Code wrote the project on Databricks, and it ran end to end on serverless in minutes. For a task like this, we don’t have to give in on quality while solving them as a conversation instead of a research project.</p><p>So, start your workspace with the <a href="https://www.databricks.com/learn/free-edition">Databricks Free Edition</a> if you don’t have one yet, borrow Onno’s app, point Genie Code at the problem, and stop predicting the World Cup by hand. It is 2026, after all.</p><p>My prompt:</p><pre>Build a World Cup 2026 prediction engine as a Databricks Asset Bundle (a serverless job, catalog/schema<br>as variables, deployable to any workspace).<br>The main goal: proper predictions for an office pool, predicting every match, the champion and the top scorer from free public data.</pre><pre>The pool is Onno&#39;s open-source app (github.com/onno101/worldcup-pool), the predictions have to fit<br>how that app works, including how it projects the knockout bracket from the group scores.</pre><pre>Data: martj42/international_results on GitHub (results, goalscorers with minute, shootouts). Here you find all matches of the World Cup 2026 and 48 teams and it auto-updates, so you can use it as training data and as live feed to let me re-run the job after the group stage.</pre><pre>Model: use the usual statistical methods bookmakers use to rate teams and model match outcomes, then simulate the tournament 20.000 times. Project the knockout bracket from my own group-score picks so it matches how the pool draws it.</pre><pre>Output gold Delta tables and a notebook pick sheet (forecasts, champion/advancement probs, top-3 scorers, knockout bracket, novelty picks).</pre><pre>Back-test on the World Championships of 2018 and 2022, and<br>the European Championships of 2024 (the quality of your model versus random as baseline, log to MLflow).</pre><p><em>Onno’s open-source pool app: </em><a href="https://github.com/onno101/worldcup-pool"><em>github.com/onno101/worldcup-pool</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da1780aa592e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Eyes to Picnic’s Automated Warehouses]]></title>
            <link>https://medium.com/picnic-engineering/adding-eyes-to-picnics-automated-warehouses-8b6c70613e2f?source=rss-491817486785------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b6c70613e2f</guid>
            <category><![CDATA[machine-vision]]></category>
            <category><![CDATA[warehouse-automation]]></category>
            <category><![CDATA[google-gemini]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Sander Lam]]></dc:creator>
            <pubDate>Wed, 11 Jun 2025 07:07:51 GMT</pubDate>
            <atom:updated>2025-06-11T07:07:51.802Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How computer vision can spot problems long before a customer notices</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eyur2Ar2fN3j0ZMOoygbUQ.png" /></figure><p>In Picnic’s fully-automated fulfilment centre in Utrecht thousands of totes move over more than 50 kilometres of conveyor belts every single day. Our in-house control software decides where every tote should go and when. What that software cannot do today is look inside the moving boxes. We only discover the state of the goods when the tote reaches a picking station, a delivery driver or, worst case, a customer.</p><p>That blind spot occasionally hurts. A product can bounce out of the tote, a six-pack can squash a packet of tomatoes or a shopper can accidentally drop the wrong flavour of yoghurt into a bag. Right now we rely on statistical safeguards and clever packing algorithms to make those mistakes rare. Imagine though, if the system could <em>see</em> the problem the moment it happened and nudge the tote to a new destination for getting fixed. That is the promise of adding computer-vision “eyes” to our warehouses.</p><p>In this article we will explain the opportunity, the building blocks and the trade-offs we found while turning that promise into a production project.</p><h3>Why Seeing Matters</h3><p>In our warehouse, we distinguish between different types of totes. For the two most important types in the warehouse, we define the following use cases.</p><p><strong>1. Order totes </strong>are the totes that eventually end up at a customer’s doorstep. Computer vision can:</p><ul><li>Verify that the shopper placed the correct number of items.</li><li>Flag items that landed in the wrong bag (so that someone else’s chocolate doesn’t end up in your delivery).</li><li>Spot obvious product mismatches, such as adding the wrong flavour of crisps to the tote.</li></ul><p><strong>2. Stock totes </strong>feed the order totes. They are periodically counted by shoppers to keep the inventory data accurate. Counting interrupts the picking flow and therefore costs time and money. Vision can:</p><ul><li>Count items automatically and update stock.</li><li>Highlight damaged, expired or incorrect items before they contaminate an order tote.</li><li>Help quality-control teams to find totes that contain bad items, rather than sampling at random or relying on shoppers flagging issues.</li></ul><p>The bottom-line impact is clear: fewer manual recounts, fewer delivery errors, happier customers!</p><figure><img alt="The different use cases of machine vision in Picnic’s automated fulfilment centres." src="https://cdn-images-1.medium.com/max/1024/0*RjanRKIN6Gt7x6mc" /><figcaption><em>The different use cases of machine vision in Picnic’s automated fulfilment centres.</em></figcaption></figure><h3>Every Pixel Counts</h3><p>Good vision AI starts with good visibility.</p><p>Before we can even start thinking about neural networks, we need to get the basics right: capturing the right image, at the right time, with the right metadata. That sounds simple, until you try doing it on a conveyor belt moving at 1.5 meters per second, with reflective packaging, awkward product angles, and totes that don’t always play nice with your lighting setup.</p><p>For a model to make accurate predictions, the raw input, the image in this case, needs to be clean, consistent, and traceable. That means each tote must be perfectly visible, with minimal motion blur, and paired with its unique barcode so we can match the visual contents to our inventory records. No blurry corners. No missed scans. No second chances.</p><p>Getting this right is non-negotiable. If the training data is noisy or the production feed inconsistent, even the best AI model will be guessing at best. Once this foundation is in place, we can confidently start training models that learn to spot squashed tomatoes, count apples, or flag that rogue yoghurt that snuck into the wrong bag.</p><h3>Depth or Detail? Choosing the Right Lens</h3><p>The first hardware decision to make is choosing a camera: do we favour a fast, high-resolution 2D sensor or invest in a depth-aware 3D unit?</p><p>A <strong>2D camera</strong> is budget-friendly, can be installed straight onto the conveyor frame and has the ability to capture colour with great quality. Perfect for reading barcodes and spotting label mismatches. The trade-off is that it depends on the stable, uniform lighting we already engineered above the belt; pile two items on top of each other and a flat image can struggle.</p><p>A <strong>3D camera</strong> adds a second channel of information, the distance to each pixel. That extra dimension separates overlapping products and makes annotation almost trivial, because depth draws a clear border around every object. Unfortunately the upgrade costs two to three times more, eats bandwidth and demands painstaking calibration.</p><p>For our pilot we stayed pragmatic: uniform lighting and reliable barcode readability pushed us toward the <strong>2D route first</strong>, letting us feed sharp frames into whichever model family we test next. If later on we want to push for that last possible bit of accuracy, we already know which lens to reach for.</p><h3>Thinking Locally, Acting Fast</h3><p>An important design choice is deciding where the model should run its inference. Model inference can be done in the <strong>Cloud</strong> or on the <strong>Edge</strong>.</p><p>AWS <a href="https://aws.amazon.com/what-is/edge-computing/?utm_source=chatgpt.com">defines</a> edge computing as “bringing information storage and computing abilities closer to the devices that produce that information and the users who consume it”. Running inference on the edge, right next to the camera, reduces latency and bandwidth. It however also forces us to deploy and maintain more hardware in the warehouse, and development time can be long.</p><p>Thanks to devices such as the Nvidia Jetson we can mount a competent GPU directly inside the camera cabinet. That setup makes sense if the heavyweight part of the workload, the forward pass through the neural network, stays local.</p><p>A traditional baseline for local computer vision is <a href="https://docs.ultralytics.com/"><strong>YOLO</strong></a>, famous for real-time object detection. The latest version at the time of writing, YOLOv10, gives a neat balance between speed and accuracy, while keeping the code easy to tinker with. They are battle-tested and cloud-edge agnostic. The YOLO family however shines when latency is tight, which is not the case here. We are okay with waiting a few seconds before the result comes in, because the tote takes some time to travel to its destination. This gives the AI time to “think” about whether the tote is faulty in some way. If the AI detects something going wrong, action can be taken to adjust the stock inventory data, or sending the tote to a special station where a human can take a look at it. And when there is more time available to get to an answer, other techniques will probably get us a better accuracy.</p><p>One of such models is <a href="https://arxiv.org/pdf/2407.04619v1"><strong>CountGD</strong></a>, a model specialised in counting objects in images. Benchmarks show that it could be a serious model upgrade in comparison to YOLO. It accepts a textual prompt (“apples”) and a visual exemplar, then returns the count. This new, hybrid approach can increase the quality of object counting a lot. The problem with CountGD however is that this model is not capable of doing anything else. It cannot classify damages, meaning we would need to run several models in parallel, where another model would detect defect products and another one would validate the product barcodes it can read.</p><h3>Can Vision Language Models Spot a Squashed Tomato?</h3><p>The alternative to running the model inference on the edge is to run a thin client on the edge that just captures images and sends them to the cloud for inference. Vision Language Models, or VLMs, are a specific type of multi-modal LLMs. Examples include OpenAI’s GPT family and Google’s Gemini models.</p><p>Until a few years ago, both performance and price were the biggest blockers for using these models at such a scale. They have however become <em>way</em> cheaper: the cost of running a VLM has dropped roughly 10× each year, amounting to a 1000× decline in the past three years according to the blog by <a href="https://a16z.com/llmflation-llm-inference-cost/?utm_source=chatgpt.com">Andreessen Horowitz</a>.</p><p>At the same time, they have become <em>way</em> better. How to define better? There are of course benchmarks that have improved tremendously, like <a href="https://mmmu-benchmark.github.io/">MMMU</a> scores that are getting close to a 100% in only two years time. For a “true test”, we can of course also check the blog by <a href="https://simonwillison.net/2024/Oct/25/pelicans-on-a-bicycle/">Simon Willison</a> on how well LLMs can create an SVG drawing a pelican on a bicycle!</p><p>So given that VLMs have become good ánd cheap already (and expectations are clear that the innovations won’t stop yet), betting on the VLM trajectory is tempting. It decouples us from on-premise GPUs and lets us scale model size without bringing in new hardware. Also, it is orders of magnitude faster to implement a VLM strategy than building our own proprietary models. It allows for blazingly fast prototyping and plug and play model upgrades over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lXJljgJsMuGdVEj6" /><figcaption><em>A test image, showing Google Gemini 2.5 Flash being capable of returning bounding boxes for all articles in this tote.</em></figcaption></figure><p>Gemini already shows the shape of things to come: its <a href="https://github.com/google-gemini/cookbook/blob/main/quickstarts/Spatial_understanding.ipynb">spatial-reasoning quick-start notebook</a> turns a single API call into object counts, bounding boxes and relationship descriptions. Feed it an image of a tote and Gemini will provide the bounding boxes of all products in it, including a description of faulty articles. All of this by just writing a simple prompt.</p><p>Of course VLMs are not perfect yet. One downside is that model inference is still pretty slow. During our own testing, Gemini 2.5 Flash took 3 to 4 seconds to respond. Optimising this should be possible with a shorter prompt, compressing images and/or caching. And with companies like <a href="https://groq.com/">Groq</a> focusing purely on making LLMs faster or <a href="https://fastino.ai/">Fastino</a> making blazingly fast LLMs for specific tasks only, faster inference also seems like a matter of time.</p><p>Models can also still hallucinate, and cost can increase quickly if volumes get high or tasks get more complex. It still requires careful development of prompts, forcing it to always return in the same format and making the VLM avoid common mistakes. Also, fine-tuning a VLM by showing it newly labelled training data is very hard and expensive at the time of writing. For text-based LLMs this is already possible for a while, so another example of expected innovation to be excited for.</p><h3>Smarter Totes, Smoother Rides</h3><p>Computer vision lets our automated fulfilment centre in Utrecht ditch blind spots and treat every tote as a data point. Order totes gain real-time checks for counts, bag placement and obvious mismatches, while stock totes get automatic audits that avoid manual stock recounts and detect damages before it spreads. A sharp 2D image plus a barcode is the ground truth our models need, and controlled lighting keeps that image crisp. We start with cost-friendly 2D cameras, where the images can be used in all possible AI solutions.</p><p>We then choose how we will power the AI: Jetson-powered edge boxes for ultra-low latency or a cloud route that rides the plummeting cost of multi-modal LLMs. YOLO could be our fast baseline, CountGD nails pure counting and cloud giants like Google’s Gemini can do it all through their mysterious black box.</p><p>Together these pieces form a pipeline that flags problems early, trims waste and delivers happier customers without slowing a single conveyor belt!</p><p>Stay tuned for part II where we will go in-depth on the implementation of the AI models, comparing current state of the art for counting, and how VLMs can be leveraged to solve this problem. We will challenge CountGD and the Google Gemini model lineup against the same dataset to see which counts products in a tote the best.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b6c70613e2f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/picnic-engineering/adding-eyes-to-picnics-automated-warehouses-8b6c70613e2f">Adding Eyes to Picnic’s Automated Warehouses</a> was originally published in <a href="https://medium.com/picnic-engineering">Picnic Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>