Skip to main content

Menu

LEVEL 0
0/5 XP
HomeAboutTopicsPricingMy VaultStatsPractice TestsCertifications

Categories

🎓 Certifications
🤖 Artificial Intelligence
☁️ Cloud and Infrastructure
💾 Data and Databases
💼 Professional Skills
🎯 Programming and Development
🔒 Security and Networking
📚 Specialized Topics
CheatGrid
HomeAboutTopicsPricingMy VaultStatsPractice TestsCertifications
LVLEVEL 0
0/5 XP
GitHub
© 2026 CheatGrid™. All rights reserved.
Privacy PolicyTerms of UseAboutContact

Loss Functions in Deep Learning Cheat Sheet

Loss Functions in Deep Learning Cheat Sheet

Back to AI and Machine Learning
Updated 2026-05-02
Next Topic: Machine Learning Core Cheat Sheet

Loss functions are the fundamental optimization objectives that guide neural network training by quantifying the discrepancy between predicted and target outputs. The choice of loss function profoundly impacts model convergence, generalization performance, and the specific behaviors the network learns — different tasks demand different mathematical formulations to properly align gradient signals with the desired outcomes. Beyond standard regression and classification losses, modern deep learning employs specialized losses for metric learning, self-supervised pretraining, imbalanced datasets, multi-task scenarios, and probabilistic modeling. Understanding when to use MSE versus Huber, cross-entropy versus focal loss, or contrastive versus triplet losses — and how to implement custom differentiable objectives — is essential for achieving state-of-the-art results across computer vision, NLP, and other domains.

What This Cheat Sheet Covers

This topic spans 14 focused tables and 91 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.

Table 1: Regression Losses — BasicTable 2: Regression Losses — Robust and SpecializedTable 3: Classification Losses — BinaryTable 4: Classification Losses — MulticlassTable 5: Classification Losses — Imbalanced DataTable 6: Metric Learning and Contrastive LossesTable 7: Self-Supervised and Contrastive Learning LossesTable 8: Probabilistic and Generative Model LossesTable 9: Multi-Task and Auxiliary LossesTable 10: Segmentation and Detection LossesTable 11: Ranking and Recommendation LossesTable 12: Custom Loss Design and ImplementationTable 13: Loss Landscape and OptimizationTable 14: Loss Function Selection Guidelines

Table 1: Regression Losses — Basic

The starting point for any continuous-value prediction. The central tension here is how each loss treats large errors: MSE squares them and so chases outliers hard, while MAE penalizes uniformly and stays robust. RMSE just brings MSE back to the target's original units for interpretability, and MSLE and MAPE shift the focus to relative rather than absolute error — handy when your targets span many orders of magnitude.

LossExampleDescription
Mean Squared Error (MSE)
loss = torch.nn.MSELoss()
L = ((y_pred - y)**2).mean()
• L2 loss that heavily penalizes large errors due to squaring
• sensitive to outliers and commonly used for continuous value prediction
Mean Absolute Error (MAE)
loss = torch.nn.L1Loss()
L = (y_pred - y).abs().mean()
• L1 loss providing uniform penalty across all error magnitudes
• more robust to outliers than MSE and produces median-like predictions
Root Mean Squared Error (RMSE)
L = torch.sqrt(((y_pred - y)**2).mean())
• Square root of MSE that returns error in the original scale of the target variable
• mathematically equivalent to MSE for optimization but more interpretable

More in AI and Machine Learning

  • LightGBM Cheat Sheet
  • Machine Learning Core Cheat Sheet
  • AI Bias & Fairness Cheat Sheet
  • Edge AI and TinyML Cheat Sheet
  • MLflow Cheat Sheet
  • PyTorch Cheat Sheet
View all 83 topics in AI and Machine Learning