Skip to content

Commit 2665f12

Browse files
Added in some background information for zero shot text classification + helpful links (#435)
Co-authored-by: Merve Noyan <[email protected]>
1 parent ff1a2d7 commit 2665f12

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed
Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
1-
## Use Cases
1+
# Zero Shot Classification
22

3-
### Sentiment Analysis
3+
## About the Task
44

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.
66

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.
88

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.
1010

11-
## Inference
1211

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]
1415
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
1619
17-
In this area, you can insert useful resources about how to train or use a model for this task.
20+
```
1821

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.
1923

2024

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+
Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
import type { TaskDataCustom } from "../Types";
22

33
const taskData: TaskDataCustom = {
4-
datasets: [],
4+
5+
datasets: [],
56
demo: {
67
inputs: [],
78
outputs: [],
89
},
9-
metrics: [],
10-
11-
models: [],
10+
metrics: [],
11+
models: [
12+
{
13+
description:
14+
"Powerful zero-shot text classification model",
15+
id: "facebook/bart-large-mnli",
16+
},
17+
],
1218
spaces: [],
13-
summary: "Zero-shot text classification is a task in natural language processing (NLP) where a model is trained on a set of labeled examples but is then able to classify new examples from previously unseen classes by transferring knowledge from seen to unseen classes.",
14-
widgetModels: [],
19+
summary: "Zero-shot text classification is a task in natural language processing where a model is trained on a set of labeled examples but is then able to classify new examples from previously unseen classes.",
20+
widgetModels: ["facebook/bart-large-mnli"],
1521
};
1622

1723
export default taskData;

0 commit comments

Comments
 (0)