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.

Discriminative and generative AI models are types of neural networks that you can use to perform two different functions. You can utilize a discriminative model to classify data into categories and generative AI models to create new data that resembles data the model sees in training. Each has its benefits and drawbacks, and each can be useful in differing scenarios. However, you can also use them together in a powerful generative AI model called a generative adversarial network (GAN). 

Explore discriminative versus generative models, how the two types of AI differ, and how you can use them together in a GAN model. 

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, while 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 the image belongs to. 

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. 

  • Fraud detection: AI models can analyze the patterns of transactions, such as credit card purchases, and detect when transactions are likely fraudulent. 

  • Customer segmentation: You can use AI to identify customer behavior patterns and predict what they will do next. Using that insight, you can segment your customer base into groups to provide personalized marketing strategies. 

  • 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 whether someone applying for credit is likely to pay you back. 

Advantages and disadvantages of discriminative models

One of the biggest 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. By understanding customer sentiment and behavior, for example, it 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, but 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 developing new ways to use generative AI all the time, 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 make predictions about 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 that the model provides you: an image of a tree that looks realistic. A GAN model is an effective way to use both generative and discriminative models to create a better final output. 

Explore generative AI on Coursera

You can use generative and discriminative AI in many ways, including together in the form of a GAN model. If you want to learn more about generative AI, you can find programs to help you learn new skills, no matter your career goals. For example, you can find courses, Specializations, and Professional Certificates on Coursera based on applying generative AI principles to different careers. Depending on your career goals, you could enroll in the Generative AI Fundamentals Specialization offered by IBM, the Generative AI with Large Language Models offered by AWS and Deep Learning.AI.

Keep reading

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.