Most of the machine learning inside a product isn't a chatbot. It's small models making one prediction many times a second: how long a delivery will take, how likely an order is to be fraud, which restaurants to show first. These classical models are cheap to run and fairly easy to train. What makes them hard in production is the data they're fed.
This lesson is about that data: the features a model reads, the two very different paths that compute them, and the bug that appears when those paths disagree.
Features: the model's inputs
Tiffin shows an estimated delivery time on every restaurant card and at checkout. A model predicts it from features like these:
| Feature | Changes | Computed from |
|---|---|---|
| Distance from restaurant to customer | Per request | The two locations, at request time |
| Restaurant's average prep time, last 7 days | Daily | Order history in the warehouse |
| Orders the restaurant is cooking right now | Every few seconds | The live order event stream |
| Free riders within 2 km | Every few seconds | Rider location stream |
| Hour of day, day of week, rain | Per request or hourly | Clock, weather feed |
The model itself is small, maybe a gradient-boosted tree that answers in under a millisecond. The work is in getting five correct numbers to it within the 50 ms the checkout page allows.