Eugene Yan
Eugene Yan

@eugeneyan

7 Tweets Apr 17, 2023
What are some design patterns in machine learning systems?
Here are a few I've seen:
1. Cascade: Break a complex problem into simpler problems. Each subsequent model focuses on more difficult or specific problems.
Stack Exchange has a cascade of defenses against spam:…
2. Reframing: Redefine the original problem, target, or input to make the problem easier to solve.
Sequential recsys reframed the paradigm from co-occurrence (matrix factorization) to predict-the-next-event (e.g., transformers).
Alibaba's BST: arxiv.org
3. Human-in-the-loop: Collect labels from users, annotation services, or domain experts.
Stack Exchange lets users flag spam, and LinkedIn lets users report messages as harassment: engineering.linkedin.com
Recently, LLMs are used in labeling too:
4. Data Augmentation: Synthetically increase the size and diversity of training data to improve model generalization and reduce overfitting.
DoorDash varied sentence order and randomly removed information such as menu category: doordash.engineering
5. Data flywheel: Positive feedback loop where more data improves ML models, which leads to more users and data.
Tesla collects data via cars, finds and labels errors, retrains models, and then deploys to their cars which gather more data.
6. Business Rules: Adding logic or constraints based on domain knowledge and/or business requirements to augment or adjust the output of ML models
Twitter has various hand-tuned weights when predicting engagement probabilities: github.com
A few more that I'll cover in a write-up:
β€’ Aggregate raw data once: To reduce compute cost
β€’ Evaluate before deploy: For safety and reliability
β€’Β Hard mining: To better learn difficult instances
What other patterns or industry examples are there? Please share! πŸ™

Loading suggestions...