P

Underfitting: Definition and Examples

Underfitting occurs when an artificial intelligence model is too simple to capture the patterns in the training data, resulting in poor performance on both training and new data.

Full definition

Underfitting is a fundamental problem in machine learning that occurs when a model fails to properly learn the relationships and structures present in the training data. Unlike overfitting, where the model memorizes the data, an underfitting model simply does not have the capacity or resources to understand the underlying patterns.

This phenomenon can have several causes: an overly simple model (e.g., using linear regression for non-linear data), an insufficient number of parameters, too short training, or excessive regularization that overly constrains the model. The result is a model that produces imprecise and generic predictions, unable to distinguish nuances in the data.

In prompt engineering, the concept of underfitting translates into how you formulate your instructions. An overly vague or generic prompt can be seen as a form of underfitting: it does not provide enough context or constraints for the language model to produce a precise and tailored response. Just like an undertrained model, an underspecified prompt generates superficial results that do not meet expectations.

To detect underfitting, one typically observes high error on both the training set and the test set. The solution involves increasing model complexity, enriching features, extending training, or reducing regularization. In prompt engineering, this translates to enriching your prompts with examples, context, and more detailed instructions.

Etymology

The term "underfitting" comes from English, composed of the prefix "under-" (insufficient) and "fitting" (adjustment). Literally, it means "under-adjustment," i.e., the model does not adjust enough to the data. This term became established in machine learning vocabulary in the 1990s, in direct opposition to "overfitting."

Concrete examples

Image classification with an overly simple model

Imagine you use a simple logistic regression to distinguish cats and dogs in photos. Explain why this model is likely to suffer from underfitting and which architectures would be more suitable.

Overly vague prompt generating a generic response

Compare these two prompts: 1) 'Tell me about marketing' vs 2) 'Describe 3 digital marketing strategies for a B2B SaaS startup in the launch phase, with a budget limited to €5000/month'. Explain why the first prompt is a form of underfitting.

Time series forecasting with too few variables

A sales forecasting model uses only the day of the week as a variable. It achieves 45% accuracy on the training data. Diagnose the problem and suggest additional variables to resolve underfitting.

Practical usage

In prompt engineering, avoiding underfitting involves providing sufficient context, examples, and constraints in your prompts to obtain precise responses. If a language model gives you overly generic or off-topic responses, enrich your prompt with specific details, a defined role, and explicit quality criteria. Think of your prompts as models: the more tailored they are to your need, the better the results.

Related concepts

OverfittingBias-Variance TradeoffRegularizationModel Complexity

FAQ

How can I tell if my model suffers from underfitting?
The main sign is high error on both the training data and the test data. If your model performs poorly even on data it has already seen, it is likely too simple to capture the patterns. In prompt engineering, the equivalent is a consistently vague or off-topic response, regardless of the number of attempts.
What is the difference between underfitting and overfitting?
Underfitting and overfitting are two opposite extremes. Underfitting means the model is too simple and does not capture patterns (poor performance everywhere). Overfitting means the model is too complex and memorizes the training data instead of generalizing (excellent training performance, poor on new data). The goal is to find the right balance between the two.
How to fix underfitting in my prompts?
Add specificity: specify the model's role, expected output format, tone, target audience, and give concrete examples of what you expect (few-shot prompting). Break down complex tasks into steps (chain-of-thought). If the response remains too generic, it is often because your prompt lacks sufficient constraints or context to guide the model.

See also

How to use this prompt

  1. Copy the prompt with the button above.
  2. Paste it into ChatGPT, Claude or your favorite AI assistant.
  3. Replace the bracketed variables with your details, then refine the result.

About Prompt Guide

Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.

More definitions

Get new prompts every week

Join our newsletter.