← All Projects
ML Engineer · 2025

Olist Logistics AI

Multi-task delivery & satisfaction prediction with MMoE

PyTorchMMoEDuckDBONNXFastAPIMLflow

The Problem

In Brazilian e-commerce, delivery delays and customer dissatisfaction are deeply correlated — yet predicting them requires fundamentally different mathematical representations. A single model either overfits to the regression task or ignores the noisy classification signal entirely.

Approach

Built a Multi-gate Mixture-of-Experts (MMoE) architecture with 5 shared experts and task-specific gating networks. The pipeline starts from 8 raw CSVs ingested into a DuckDB analytical warehouse, validated through Pydantic data contracts, and transformed via a sklearn ColumnTransformer (11 numeric + 3 categorical + 6 cyclic temporal features). Training uses learned uncertainty-weighted multi-task loss, WeightedRandomSampler for 5:1 class imbalance, and StandardScaler normalization of delivery targets. 37 experiments tracked in MLflow. Model exported to ONNX Runtime and served via FastAPI on Render.

Results

  • Delivery MAE: 4.24 days, RMSE: 5.26 days
  • Satisfaction: 62.5% balanced accuracy, 85.9% F1 (vs 50% baseline)
  • SHAP explainability reveals task-specific feature routing — geography dominates delivery, seller reputation dominates satisfaction
  • 37 experiments tracked end-to-end in MLflow with model registry

Live Demo

Pick a product category, click the map to place a customer, and watch the model predict delivery time and satisfaction in real-time.

1 Pick a Product Category
2 Click the Map to Place a Customer

Click anywhere in Brazil to set the delivery destination.

Order Details
1x
0 km

Prediction Results

Warming up the inference server...