Efficient Few-Shot Learning Without Prompts
Paper • 2209.11055 • Published • 6
How to use cbpuschmann/MiniLM-klimacoder_v0.4 with setfit:
from setfit import SetFitModel
model = SetFitModel.from_pretrained("cbpuschmann/MiniLM-klimacoder_v0.4")How to use cbpuschmann/MiniLM-klimacoder_v0.4 with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("cbpuschmann/MiniLM-klimacoder_v0.4")
sentences = [
"The weather is lovely today.",
"It's so sunny outside!",
"He drove to the stadium."
]
embeddings = model.encode(sentences)
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]This is a SetFit model that can be used for Text Classification. This SetFit model uses sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 as the Sentence Transformer embedding model. A LogisticRegression instance is used for classification.
The model has been trained using an efficient few-shot learning technique that involves:
| Label | Examples |
|---|---|
| supportive |
|
| opposed |
|
| Label | Accuracy |
|---|---|
| all | 1.0 |
First install the SetFit library:
pip install setfit
Then you can load this model and run inference.
from setfit import SetFitModel
# Download from the 🤗 Hub
model = SetFitModel.from_pretrained("cbpuschmann/MiniLM-klimacoder_v0.4")
# Run inference
preds = model("\"Von 'Klimakriegen' zu rechten Schreien in die Menge: Proteste der jungen Aktivisten überfordern die Gesellschaft. Statt produktiven Lösungsansätzen für den Klimawandel, sorgen diese Gruppen lediglich für Aufsehen und Chaos auf Straßen und Plätzen. Es ist höchste Zeit, dass sich die Jugendlichen von solchen Aktionismus distanzieren und sich an tatsächliche politische Gestaltung beteiligen.\"")
| Training set | Min | Median | Max |
|---|---|---|---|
| Word count | 36 | 64.4771 | 98 |
| Label | Training Sample Count |
|---|---|
| opposed | 235 |
| supportive | 245 |
| Epoch | Step | Training Loss | Validation Loss |
|---|---|---|---|
| 0.0003 | 1 | 0.2397 | - |
| 0.0138 | 50 | 0.253 | - |
| 0.0276 | 100 | 0.152 | - |
| 0.0415 | 150 | 0.0264 | - |
| 0.0553 | 200 | 0.0064 | - |
| 0.0691 | 250 | 0.0014 | - |
| 0.0829 | 300 | 0.0007 | - |
| 0.0968 | 350 | 0.0003 | - |
| 0.1106 | 400 | 0.0002 | - |
| 0.1244 | 450 | 0.0002 | - |
| 0.1382 | 500 | 0.0002 | - |
| 0.1521 | 550 | 0.0001 | - |
| 0.1659 | 600 | 0.0001 | - |
| 0.1797 | 650 | 0.0003 | - |
| 0.1935 | 700 | 0.0001 | - |
| 0.2074 | 750 | 0.0001 | - |
| 0.2212 | 800 | 0.0001 | - |
| 0.2350 | 850 | 0.0 | - |
| 0.2488 | 900 | 0.0 | - |
| 0.2626 | 950 | 0.0 | - |
| 0.2765 | 1000 | 0.0 | - |
| 0.2903 | 1050 | 0.0 | - |
| 0.3041 | 1100 | 0.0 | - |
| 0.3179 | 1150 | 0.0 | - |
| 0.3318 | 1200 | 0.0 | - |
| 0.3456 | 1250 | 0.0 | - |
| 0.3594 | 1300 | 0.0 | - |
| 0.3732 | 1350 | 0.0 | - |
| 0.3871 | 1400 | 0.0 | - |
| 0.4009 | 1450 | 0.0 | - |
| 0.4147 | 1500 | 0.0 | - |
| 0.4285 | 1550 | 0.0 | - |
| 0.4424 | 1600 | 0.0 | - |
| 0.4562 | 1650 | 0.0 | - |
| 0.4700 | 1700 | 0.0 | - |
| 0.4838 | 1750 | 0.0 | - |
| 0.4976 | 1800 | 0.0 | - |
| 0.5115 | 1850 | 0.0 | - |
| 0.5253 | 1900 | 0.0 | - |
| 0.5391 | 1950 | 0.0 | - |
| 0.5529 | 2000 | 0.0 | - |
| 0.5668 | 2050 | 0.0 | - |
| 0.5806 | 2100 | 0.0 | - |
| 0.5944 | 2150 | 0.0 | - |
| 0.6082 | 2200 | 0.0 | - |
| 0.6221 | 2250 | 0.0 | - |
| 0.6359 | 2300 | 0.0 | - |
| 0.6497 | 2350 | 0.0 | - |
| 0.6635 | 2400 | 0.0 | - |
| 0.6774 | 2450 | 0.0 | - |
| 0.6912 | 2500 | 0.0 | - |
| 0.7050 | 2550 | 0.0 | - |
| 0.7188 | 2600 | 0.0 | - |
| 0.7327 | 2650 | 0.0 | - |
| 0.7465 | 2700 | 0.0 | - |
| 0.7603 | 2750 | 0.0 | - |
| 0.7741 | 2800 | 0.0 | - |
| 0.7879 | 2850 | 0.0 | - |
| 0.8018 | 2900 | 0.0 | - |
| 0.8156 | 2950 | 0.0 | - |
| 0.8294 | 3000 | 0.0 | - |
| 0.8432 | 3050 | 0.0 | - |
| 0.8571 | 3100 | 0.0 | - |
| 0.8709 | 3150 | 0.0 | - |
| 0.8847 | 3200 | 0.0 | - |
| 0.8985 | 3250 | 0.0 | - |
| 0.9124 | 3300 | 0.0 | - |
| 0.9262 | 3350 | 0.0 | - |
| 0.9400 | 3400 | 0.0 | - |
| 0.9538 | 3450 | 0.0 | - |
| 0.9677 | 3500 | 0.0 | - |
| 0.9815 | 3550 | 0.0 | - |
| 0.9953 | 3600 | 0.0 | - |
@article{https://doi.org/10.48550/arxiv.2209.11055,
doi = {10.48550/ARXIV.2209.11055},
url = {https://arxiv.org/abs/2209.11055},
author = {Tunstall, Lewis and Reimers, Nils and Jo, Unso Eun Seo and Bates, Luke and Korat, Daniel and Wasserblat, Moshe and Pereg, Oren},
keywords = {Computation and Language (cs.CL), FOS: Computer and information sciences, FOS: Computer and information sciences},
title = {Efficient Few-Shot Learning Without Prompts},
publisher = {arXiv},
year = {2022},
copyright = {Creative Commons Attribution 4.0 International}
}