Discriminative Model: Definition and Examples
A discriminative model is a type of machine learning model that learns to distinguish and classify data by directly modeling the decision boundary between different classes.
Full definition
A discriminative model (or discriminant model) is an approach in machine learning that focuses on learning the relationship between input data and output labels. Unlike generative models that seek to understand how data is produced, a discriminative model directly learns the conditional probability P(y|x), i.e., the probability that an output y corresponds to a given input x.
Concretely, these models draw decision boundaries in the data space to separate different categories. For example, a discriminative model trained to distinguish spam emails from legitimate ones will learn the characteristics that differentiate these two classes, without trying to model how an email is composed in general. This targeted approach often makes them more performant for pure classification tasks.
Among the most well-known examples of discriminative models are logistic regression, support vector machines (SVMs), classic neural networks used for classification, random forests, and convolutional neural networks (CNNs) for image recognition. These models are ubiquitous in industrial AI applications.
In the context of prompt engineering, understanding the distinction between discriminative and generative models helps to better grasp the capabilities and limitations of large language models (LLMs). LLMs like Claude are fundamentally generative models, but they can perform discriminative tasks (classification, sentiment analysis) when guided properly through well-crafted prompts.
Etymology
The term 'discriminative' comes from the Latin 'discriminare' meaning 'to separate, to distinguish'. In machine learning, it was adopted to describe models that 'discriminate' between classes, i.e., that learn to draw decision boundaries. The formal distinction between discriminative and generative models was popularized by Andrew Ng and Michael Jordan in their 2002 paper comparing the two approaches.
Concrete examples
Sentiment classification with an LLM used in discriminative mode
Analyze the sentiment of the following customer review and classify it as POSITIVE, NEGATIVE, or NEUTRAL. Answer only with the class.
Review: "The product arrived late but the quality is excellent, I am overall satisfied."
Spam detection by leveraging the discriminative capabilities of a generative model
You are an expert spam filter. Examine the following email and determine whether it is SPAM or LEGITIMATE. Explain the 3 main criteria that motivate your decision.
Subject: "Congratulations! You have won €10,000"
Body: "Click here to claim your prize..."
Educational comparison between discriminative and generative approaches
Explain to me like I'm 10 years old the difference between a discriminative model and a generative model in AI. Use an analogy with animals to illustrate your explanation.
Practical usage
In prompt engineering, one leverages the discriminative capabilities of LLMs by formulating clear classification tasks with well-defined categories. To obtain the best results, it is recommended to provide examples of each class (few-shot prompting) and to ask the model to justify its classification before giving the final answer, which improves accuracy through chain-of-thought reasoning.
Related concepts
FAQ
What is the difference between a discriminative model and a generative model?
Are large language models like Claude discriminative models?
What are the most used discriminative models in practice?
See also
How to use this prompt
- Copy the prompt with the button above.
- Paste it into ChatGPT, Claude or your favorite AI assistant.
- 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
Embedding: Definition and Examples
An embedding is a numerical representation of text, image, or other data type as a vector of numbers, enabling AI models to measure semantic similarity between items.
Encoder Decoder: Definition and Examples
Neural network architecture composed of two complementary modules: an encoder that compresses the input into an intermediate representation, and a decoder that generates the output from this representation.
European AI Act: Definition and Examples
The European AI Act is the world's first regulatory framework dedicated to artificial intelligence, adopted by the European Union to govern the development,
Existential AI Risk: Definition and Examples
Existential AI risk refers to the possibility that advanced artificial intelligence could cause human extinction or irreversible degradation
Federated Learning: Definition and Examples
Federated Learning is an AI model training technique where data remains on users' local devices,
Few-Shot Prompting: Definition and Examples
Few-shot prompting provides a few examples in your prompt to guide the AI. Master this fundamental technique.
Get new prompts every week
Join our newsletter.