|
1 | | -## Use Cases |
| 1 | +# Zero Shot Classification |
2 | 2 |
|
3 | | -### Sentiment Analysis |
| 3 | +## About the Task |
4 | 4 |
|
5 | | -Zero-shot learning is a variant of machine learning, where a model is trained on a set of data that does not include the target labels, and is able to predict the labels for new data that does not include the target labels. This can be used for sentiment classification by training a model on a dataset of texts that are not labeled for sentiment. The model can then be used to predict the sentiment of new texts that are not labeled for sentiment. |
| 5 | +Zero Shot Classification is the task of predicting a class that wasn't seen by the model during training. This method, which leverages a pre-trained language model, can be thought of as an instance of [transfer learning](https://www.youtube.com/watch?v=BqqfQnyjmgg) which generally refers to using a model trained for one task in a different application than what it was originally trained for. This is particularly useful for situations where the amount of labeled data is small. |
6 | 6 |
|
7 | | -## Task Variants |
| 7 | +In zero shot classification, we provide the model with a prompt and a sequence of text that describes what we want our model to do, in natural language. Zero-shot classification excludes any examples of the desired task being completed. This differs from single or few-shot classification, as these tasks include a single or a few examples of the selected task. |
8 | 8 |
|
9 | | -This place can be filled with variants of this task if there's any. |
| 9 | +Zero, single and few-shot classification seem to be an emergent feature of large language models. This feature seems to come about around model sizes of +100M parameters. The effectiveness of a model at a zero, single or few-shot task seems to scale with model size, meaning that larger models (models with more trainable parameters or layers) generally do better at this task. |
10 | 10 |
|
11 | | -## Inference |
12 | 11 |
|
13 | | -This section should have useful information about how to pull a model from Hugging Face Hub that is a part of a library specialized in a task and use it. |
| 12 | +Here is an example of a zero-shot prompt for classifying the sentiment of a sequence of text: |
| 13 | +``` |
| 14 | +Classify the following input text into one of the following three categories: [positive, negative, neutral] |
14 | 15 |
|
15 | | -## Useful Resources |
| 16 | +Input Text: Hugging Face is awesome for making all of these |
| 17 | +state of the art models available! |
| 18 | +Sentiment: positive |
16 | 19 |
|
17 | | -In this area, you can insert useful resources about how to train or use a model for this task. |
| 20 | +``` |
18 | 21 |
|
| 22 | +One great example of this task with a nice off-the-shelf model is available at the widget of this page, where the user can input a sequence of text and candidate labels to the model. This is a *word level* example of zero shot classification, more elaborate and lengthy generations are available with larger models. Testing these models out and getting a feel for prompt engineering is the best way to learn how to use them. |
19 | 23 |
|
20 | 24 |
|
| 25 | +## Useful Resources |
| 26 | +- [Zero Shot Learning](https://joeddav.github.io/blog/2020/05/29/ZSL.html) |
| 27 | +- [Hugging Face on Transfer Learning](https://huggingface.co/course/en/chapter1/4?fw=pt#transfer-learning) |
| 28 | + |
0 commit comments