Why Your Model Performs Like a God Offline, but Crashes on the Leaderboard
If you’ve done any ML competitions or real-world data science projects (for example, stock market prediction), you’ve probably been there. You add a new feature, your local CV score shoots up, you feel like a genius — and then you submit or deploy in production, and shake up. The online score drops significantly.
Here are 3 hard truths I learned from the past.
1. The “Golden Rule” is Validation, not the Model itself
Classic train_test_split or basic K-Fold will almost always fail you in real life. The real data distribution is usually a mess.
- Time-Series Split: If your data has a time dimension, NEVER leak the future into the past. Otherwise, your offline metrics will look beautiful, but online it’s useless.
- GroupKFold: If your data has
user_idorhospital_id, make sure the same ID doesn’t appear in both train and validation sets. You want your model to learn general patterns, not just memorize specific users. Marcos López de Prado also introduced purged K-Fold CV and CPCV on finance data, which reduce overfitting and selection bias to some degree. - Covariate Shift Detection: Train a classifier to see if it can tell your train set and test set apart. Use this to find and drop the drifting features before it’s too late.
2. Feature Engineering Decides Your Upper Limit
In tabular data, features beat models every single time. It’s all about mapping domain knowledge into data.
- Domain hacks: Like creating cross-features for “user clicks in the last 3 days” vs “global item popularity.” In risk, we use features like “how many searches of the application in the last 7 days vs in the last one year.”
- The GenAI tricks: Don’t just stick to tables. Use LLMs to convert unstructured text into high-dimensional embeddings, or let LLMs auto-synthesize features. Feeding these into downstream models feels like a complete cheat code.
3. Stop Overcomplicating Your Models (Occam’s Razor)
Beginners always think deeper networks or zero-regularization trees equal higher scores. Actually, it’s the exact opposite.
- Complex models are just comfortable beds for overfitting. They memorize noise.
- Pros prefer robust, restricted base models (like LightGBM, XGBoost, CatBoost with strictly controlled tree depth) combined with heavy regularization.
- Even in LLM/DL competitions, victory isn’t about adding more layers. It’s about smart fine-tuning (LoRA/PEFT parameters), layer freezing, and picking the right pre-trained weights.
Plus, in production, super complex models are a nightmare to maintain. There is always a trade-off between a 0.001 score lift and the actual engineering cost.
Keep it simple, validate it strictly, and focus on the data.