Discriminative vs. Generative Models: What’s the Difference?

Written by Coursera Staff • Updated on

You can use discriminative models to classify data into categories and generative models to generate new images, text, or other data. Explore the differences between discriminative and generative models.

[Feature Image] A learner meets with their teaching assistant to review discriminative vs. generative models and gain a deeper understanding of the differences.

Key takeaways

Discriminative and generative AI models are types of neural networks that can perform two different functions.

  • You can use a discriminative model to classify data into categories and generative AI models to generate new data that resembles the data the model sees during training.

  • Choose a discriminative AI model to find patterns in your data and make better decisions, and use generative models to generate new outputs, such as business documents, marketing materials, or software development code.

Explore discriminative versus generative models, how the two types of AI differ, and how you can use them together in a GAN model. If you’re ready to explore how you can use the capabilities of AI to enhance your work and daily life, enroll in the Generative AI Fundamentals Specialization. In as little as four weeks, you’ll have the opportunity to learn about the limitations and ethical concerns of generative AI, apply prompt engineering techniques, and discover ways you can use AI to enhance your career.

Discriminative vs. generative models

Discriminative and generative AI models describe two different types of AI models. Generative models can generate new data that looks like the materials they saw in training. In contrast, discriminative models can discriminate whether an item belongs to one class of objects or another. Both models use neural networks to understand the patterns within data, but they each do so to accomplish a different task. For example, you could use a discriminative model to determine whether an image contains a dog or a cat, while you could use generative AI to create pictures that include a dog or a cat.

What is a discriminative model?

A discriminative model is an AI model that can determine how to classify objects. Using supervised learning, an AI model learns that items within a labeled data set have similar characteristics and underlying patterns. The model uses those patterns to predict whether new inputs belong to one labeled class or another. For example, you could use an AI model to identify species of plants by uploading an image of the specimen you’re looking at. The AI model would consider what underlying characteristics define the image and compare that to other images it learned about in training to predict which class it belongs to.

Learn more: Object Detection vs. Image Classification: What Is the Difference?

What are discriminative models used for?

Discriminative models are helpful tools for classification and regression tasks. They are flexible, and you can apply them to various data sets. Three applications of discriminative models include risk assessment, fraud detection, and customer segmentation.

  • Customer segmentation: AI can identify customer behavior patterns and predict their next actions. You can segment your customer base into groups and provide personalized marketing strategies using that insight.

 

  • Risk assessment: You can use AI to create a risk assessment model to help you make informed decisions. For example, you could use AI to evaluate whether an investment fits into your portfolio or if someone applying for credit will likely pay you back. 

What is an example of a discriminative model?

Examples of discriminative models include logistic regression, support vector machines (SVMs), and decision trees. Consider how you might use each:

Logistic regression: used in medical diagnosis

• SVMs: used for email spam detection

• Decision trees: used to represent and understand decision-making

When to use discriminative vs. generative models: Advantages and disadvantages of discriminative models

One of the most significant advantages of discriminative models is the insight they offer to help you make better decisions. Discriminative AI can help you find patterns in your data and improve your processes in many ways. For example, understanding customer sentiment and behavior can offer you personalized marketing outreach or forecast demand for the coming quarter. This can lead to better outcomes in nearly every aspect of business. 

Discriminative models can be very effective, but they cannot accomplish what a generative model can: creating new data using the underlying predictions and patterns of training materials. 

What is a generative model?

A generative model is a type of AI model that can create new items that look similar and follow the same patterns and characteristics of material the model saw during training. A generative AI model requires a lot of training materials. Still, once training is complete, the model can use what it learned to create realistic-looking text, images, videos, audio, or code based on prompts you write in natural language. For example, you could ask a generative model to write a one-act play about a character wearing a banana suit at a job interview. 

The model would consider what patterns and characteristics it knows about the words in your prompt (like “one-act play,” “banana suit,” and “job interview”) and predict what arrangement of words is most likely to satisfy your prompt.

What are generative models used for?

You can use generative AI models to create outputs that look like humans created them, including text, images, video, audio, and code. The uses for generative AI are vast, including both personal day-to-day use, business applications, and even medical and biotech research. Just a few uses of generative AI models include: 

  • Generating business documents like memos, reports, or meeting summaries

  • Creating marketing materials, including text, images, and animations

  • Optimizing code for software development

  • Forming synthetic data to train other AI models 

  • Translating from one language to another

 

Advantages and disadvantages of generative models

One of the main advantages of generative AI models is that they are versatile. You can apply them to many different types of situations. Professionals and everyday people are constantly developing new ways to use generative AI, especially as new products using generative AI technology become available to consumers. 

However, generative AI also offers unique challenges, such as the tendency for AI models to “hallucinate” or to give inaccurate information. Generative AI models predict the most appropriate words for a given response and don't consistently demonstrate the logic to rule out disinformation or nonsense answers. 

Generative vs. discriminative models: Generative adversarial network models

Comparing generative and discriminative models, one of the significant differences you’ll find is that generative models have to accomplish a more complex task than discriminative models. Generative models require enough training materials to understand more complex relationships. 

For example, a discriminative model may need to understand the difference between a dog and a cat without considering the complexities of what makes up a dog. A generative model not only has to understand the difference between a dog and a cat, but also the relationship between where a dog’s nose is located compared to its eyes and how a dog’s tail can vary between breeds of dogs. 

While each model has advantages and limitations, you can get the best of both models with a GAN. This is a type of AI model that includes two neural networks: one called the generator and one called the discriminator. As you may guess, the generator tries to create realistic-looking “fake” data using its training materials. The discriminator attempts to detect the fake and categorize it as such. 

You can use a GAN to generate data like an image or a short paragraph. If you ask for an image of a tree, the two neural network models work as though playing a game. The generator creates an image using what it knows about trees, and the discriminator classifies it as fake using what it knows about the patterns in images of trees from the training data. 

The generator uses its mistakes to learn and refine its output and will try again. The discriminator learns from the generator and classifies it as fake again. The two go back and forth until the generator creates an image that the discriminator cannot detect as fake, thus “winning” the game. This winning attempt becomes the output the model provides you: an image of a realistic tree. A GAN model is an effective way to use both generative and discriminative models to create a better final output. 

Explore our free AI resources

If you’re interested in expert guidance and no-fluff tips to help you build your skills, subscribe to our YouTube channel. You can also explore free career resources to learn new topics, explore emerging industries, and discover new opportunities:

Whether you want to develop a new skill, get a feel for trends in your industry, or stay updated on career-related news, a Coursera Plus subscription can provide guidance. You’ll get access to over 10,000 flexible courses.

Updated on
Written by:

Editorial Team

Coursera’s editorial team is comprised of highly experienced professional editors, writers, and fact...

This content has been made available for informational purposes only. Learners are advised to conduct additional research to ensure that courses and other credentials pursued meet their personal, professional, and financial goals.