0
0
Prompt Engineering / GenAIml~3 mins

Generative vs discriminative models in Prompt Engineering / GenAI - When to Use Which

Choose your learning style9 modes available
The Big Idea

Discover how machines learn to both recognize and create, just like humans!

The Scenario

Imagine you want to sort thousands of photos into categories by hand, like "cats" or "dogs," and also create new photos that look like real animals. Doing this manually means looking at every photo carefully and trying to imagine new ones yourself.

The Problem

Sorting photos by hand is slow and tiring. Trying to create new realistic photos manually is almost impossible and full of mistakes. You can't easily guess what new photos should look like or quickly decide which category a photo belongs to.

The Solution

Generative and discriminative models help computers learn from examples to do these tasks automatically. Discriminative models learn to tell categories apart, like sorting photos quickly. Generative models learn how to create new examples that look real, like making new photos of animals.

Before vs After
Before
if photo_has_cat(photo):
    label = 'cat'
else:
    label = 'dog'
After
label = discriminative_model.predict(photo)
new_photo = generative_model.generate('cat')
What It Enables

These models let machines understand and create data, making tasks like image recognition and content creation fast and accurate.

Real Life Example

Apps that recognize your face to unlock your phone use discriminative models, while apps that create new art or deepfake videos use generative models.

Key Takeaways

Discriminative models focus on telling things apart.

Generative models focus on creating new, realistic data.

Together, they make powerful tools for understanding and generating information.