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
Document Parsing: Definition and Examples
Document parsing is the process of automatically analyzing and extracting structured data from unstructured or semi-structured documents, such as
Dropout: Definition and Examples
Dropout is a regularization technique used during neural network training that randomly deactivates a fraction of neurons at each iteration to prevent overfitting.
DSPy: Definition and Examples
DSPy is a Python framework developed by Stanford NLP that allows you to program and automatically optimize language model (LLM) pipelines, replacing manual prompt engineering with a declarative, compiled approach.
ElevenLabs: Definition and Examples
ElevenLabs is a company specializing in AI-powered speech synthesis, capable of generating realistic and expressive voices from text.
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.
Emotional Prompting: Definition and Examples
A prompt engineering technique that involves incorporating emotional elements into instructions given to an AI model to improve the quality and
Get new prompts every week
Join our newsletter.