AI Glossary: Underfitting

Underfitting occurs when a machine learning model is too simple to capture the underlying patterns in the data. It's the opposite of overfitting—and often the first problem beginners encounter when building models.

What is Underfitting?

Underfitting occurs when a machine learning model is too simple to capture the underlying patterns and relationships in the training data. The model fails to learn the structure of the data, resulting in poor performance on both the training data and any new data it encounters. It's like trying to describe a complex curve with a straight line—the line simply can't capture the shape of the data.

Underfitting is the opposite of overfitting. While an overfit model is too complex and memorizes noise, an underfit model is too simple and misses the signal entirely. Both result in poor generalization, but for different reasons.

Core Problem

The model lacks the capacity or flexibility to learn the true relationships between inputs and outputs.

Key Symptom

Poor performance on both training and validation data—the model can't even fit the data it was trained on.

Mathematical Cause

High bias: the model's assumptions are too restrictive to represent the true data-generating function.

Why Underfitting Matters

Underfitting is often the starting point for beginners. When you train your first model and it performs poorly, you're likely experiencing underfitting. The good news is that underfitting is usually easier to diagnose and fix than overfitting. The bad news is that the fixes (more complexity, more training) can push you into overfitting territory if you're not careful.

How to Detect Underfitting

Underfitting is relatively straightforward to detect because it affects both training and validation performance:

Underfitting Detection: Learning Curves Epochs → Loss Training Loss Validation Loss ⚠ Both training and validation loss are high—the model can't learn the data High bias = underfitting

Underfitting is characterized by both training and validation loss plateauing at a high value. The model simply can't learn the data.

Key signs of underfitting:

  • High training error — The model performs poorly even on the data it was trained on
  • Similar training and validation error — Both are high, indicating the model hasn't learned much
  • Plateauing learning curves — Both curves flatten out quickly at a high error level
  • Systematic errors — The model consistently makes the same kinds of mistakes because it can't capture the necessary patterns

Common Causes of Underfitting

1. Model Too Simple

The most common cause. Using a linear model for non-linear data, a shallow neural network for complex patterns, or a model with too few parameters. The model simply doesn't have the capacity to represent the true relationship.

2. Insufficient Training

Not training for enough epochs, or using too low a learning rate so the model converges slowly. The model hasn't had enough time to learn the patterns.

3. Excessive Regularization

Too much L1/L2 regularization, too high dropout rates, or too aggressive early stopping. These are designed to prevent overfitting, but overdoing them prevents the model from learning anything.

4. Poor Feature Engineering

Using features that don't contain enough information to solve the problem. The model can't learn what isn't in the data.

5. Wrong Model Architecture

Using a model type that's fundamentally unsuitable for the data. For example, using a feedforward network for sequential data when an RNN or Transformer would be more appropriate.

How to Fix Underfitting

Increase Model Complexity

  • Add more layers to your neural network
  • Increase the number of neurons per layer
  • Use a more powerful model architecture (e.g., switch from linear regression to a neural network, or from a simple CNN to ResNet)
  • Add more features or use feature crosses to capture interactions

Train Longer

  • Increase the number of training epochs
  • Increase the learning rate if the model is converging too slowly
  • Use learning rate scheduling to help the model converge

Reduce Regularization

  • Lower the L1/L2 regularization strength
  • Reduce dropout rates
  • Disable or loosen early stopping criteria

Improve Data Quality

  • Add more relevant features
  • Engineer better features that capture the underlying patterns
  • Ensure data is properly normalized and preprocessed
  • Remove irrelevant features that add noise

Practical Approach

Start with the simplest model and gradually increase complexity. The goal is to find the point where training error drops to an acceptable level without the validation error starting to increase. This iterative approach—increase complexity, check for overfitting, then adjust—is the core workflow of machine learning model development.

Underfitting vs Overfitting: Quick Reference

IndicatorUnderfittingGood FitOverfitting
Training ErrorHighLowVery Low
Validation ErrorHighLowHigh
BiasHighLowLow
VarianceLowLowHigh
FixMore complexityMore data/regularization

Frequently Asked Questions

Can a model underfit and overfit at the same time?

Not in the classical sense, but a model can have both issues across different parts of the data. For example, a model might underfit the overall trend (high bias) while overfitting to specific outliers (high variance). This is sometimes called "localized overfitting." The solution is typically to use a more flexible model with appropriate regularization.

How do I know if my model is underfitting or just needs more training?

If the training loss is still decreasing steadily (not plateauing), your model may just need more training time. If the training loss has plateaued at a high value, your model is underfitting and needs more capacity—not more training. A good diagnostic: try training for significantly more epochs. If the loss doesn't improve, you need a more complex model.

Is underfitting more common in deep learning or traditional ML?

Underfitting is more common in traditional machine learning (linear models, decision trees with limited depth) because these models have inherently limited capacity. In deep learning, overfitting is more common because neural networks have enormous capacity. However, underfitting can still occur in deep learning if the network is too shallow, the learning rate is too low, or the regularization is too strong.

How does data preprocessing affect underfitting?

Poor data preprocessing can directly cause underfitting. If data isn't properly normalized or scaled, the model may struggle to learn meaningful patterns. Missing values, unencoded categorical variables, or raw text without tokenization can all prevent the model from learning. Always ensure your data is properly cleaned, normalized, and encoded before training.

What's the relationship between underfitting and model capacity?

Model capacity is the model's ability to fit a wide variety of functions. Higher capacity = more flexibility. Underfitting occurs when model capacity is too low for the complexity of the data. The universal approximation theorem tells us that a sufficiently large neural network can approximate any function, but "sufficiently large" depends on the function's complexity. If your network is too small, it will underfit.

Continue your AI learning journey

Next, explore Gradient Descent—the fundamental optimization algorithm that makes machine learning possible.

Read Next: Gradient Descent →