Problem
iFood processes millions of food-delivery orders a day and attracts fraudsters who test stolen or generated cards. Its fraud models score each order and estimate the risk of a later chargeback, so they need fresh features and fast answers. Building and refreshing those features was slow, manual work for data scientists. It added latency, and the feature logic used in training could differ from the logic used at inference (feature skew).
Example from the article: data scientists often need several versions of one feature that differ only in the window, such as the number of orders in the last 7, 30 and 60 days.
Solution in brief
iFood built an internal Feature Platform with three layers. A Feature Engine computes aggregations in two steps. A Feature Store keeps features in Redis for online serving and in a Delta table for history. Feature Management handles monitoring, lifecycle and versioning. Scientists define what a feature is; the platform handles how.
Questions this case answers
- How to serve model features at low latency while guaranteeing that training and serving use the same feature logic
- How to compute many window sizes of the same aggregation cheaply on one stream by reusing partial results
- How to retrieve historical feature values as of a given moment so a training set contains no future information
- How to serve fraud-model features in real time with low latency and without training-serving skew?
Tools and methods
- Two Step Aggregator — stores small-step partial results and sums them into any larger window in one Spark query
- Delta table on S3 — transaction-style log of every feature update, also the offline store with time travel
- Redis — online store with the latest value per feature
- Materializers — jobs that read the Delta table and write to each store
- Apache Spark, Apache Kafka, Kubernetes — Spark and Kafka named without detail; Kubernetes autoscales serving
Google or a one-time email code. No password.