Every ML system design decision involves trade-offs. The ability to recognize, articulate, and navigate trade-offs is what separates senior from junior engineers.
| Approach | Accuracy | Latency | Cost |
|---|---|---|---|
| Large deep ensemble (3 models) | Best (AUC 0.96) | ~150ms | 3 GPUs |
| Single XGBoost | Good (AUC 0.93) | ~20ms | 1 CPU |
| Linear model | Moderate (AUC 0.88) | ~2ms | Minimal |
| Rule-based heuristic | Low (AUC 0.80) | ~1ms | None |
How to decide: Let business requirements drive the choice. If a 3% accuracy gain is worth $1M/year in revenue, use the ensemble. If latency SLA is p99 < 50ms, use XGBoost.
| Scenario | Choice | Rationale |
|---|---|---|
| Fraud detection (financial loss on stale data) | Strong consistency | Stale features = wrong fraud decision |
| Content recommendations | Eventual consistency | Stale recommendations still reasonable |
| Real-time bidding (must respond fast) | Available over consistent | Better to serve slightly stale data than miss the bid |
# Trade-off visualization
Simple (Logistic Regression):
✓ Interpretable (coefficients = feature importance)
✓ Fast training and inference
✗ Lower accuracy for complex patterns
Complex (Deep Neural Network):
✓ Highest accuracy
✗ Black box (needs SHAP/LIME for explanation)
✗ Expensive training and inference
Middle ground: Gradient Boosted Trees (XGBoost, LightGBM)
✓ High accuracy
✓ Feature importance available
✓ Reasonably fast