# timoschick/pet

This repository contains the code for "Exploiting Cloze Questions for Few-Shot Text Classification and Natural Language Inference"

Repository: https://github.com/timoschick/pet
Canonical: https://ross.abutalabs.com/products/timoschick-pet
Homepage: https://arxiv.org/abs/2001.07676
Language: Python
License: Apache-2.0
License Family: permissive
Topics: nlp, python, machine-learning
Last push: 2023-06-12T21:28:58+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 2339, "days_push": 1178, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1622, forks 281 (observed 2026-08-28T04:05:12.549291+00:00)

## What it is
Official implementation of Pattern-Exploiting Training (PET), a semi-supervised method that reformulates text classification and natural language inference tasks as cloze-style prompts for pretrained language models. It includes the iterative iPET variant and supports training with very few or even zero labeled examples.

## Use cases
- few-shot text classification with pretrained language models
- natural language inference with limited labeled data
- train a classifier with zero labeled examples using iPET
- reproduce GPT-3-level few-shot results with small models
- apply prompt-based semi-supervised training to custom NLP tasks

## When to choose
- you have very few labeled examples for a classification or NLI task
- you want to use small language models instead of massive few-shot models
- you need the reference implementation of the PET/iPET research papers

## When to avoid
- you need modern prompt-tuning support or recent transformer versions
- you want actively maintained tooling rather than research code
- your task is not text classification or natural language inference

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, nlp, llm-training, cli
- domain: machine-learning, large-language-models
- platform: python, cli
- tags: few-shot-learning, prompt-based-training, cloze-questions, semi-supervised, text-classification, natural-language-inference, ipet, research-code, natural-language-processing

## Member repositories
- timoschick/pet (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:12.549291+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:49:02.745520+00:00, confidence not recorded.
  - readme: https://github.com/timoschick/pet (fetched 2026-08-28T04:05:12.549291+00:00, sha f7ae0e86b5b2)
  - homepage: https://arxiv.org/abs/2001.07676 (fetched 2026-08-29T11:21:45.581900+00:00, sha 48effc2d8e6e)
  - site_page: https://info.arxiv.org/about/donate.html (fetched 2026-08-29T11:21:45.584375+00:00, sha cca9c3a11c56)
  - site_page: https://info.arxiv.org/about/ourmembers.html (fetched 2026-08-29T11:21:45.587988+00:00, sha 47cbc55ff1de)
  - site_page: https://info.arxiv.org/about (fetched 2026-08-29T11:21:45.589915+00:00, sha a1f16f915a9a)
  - site_page: https://info.arxiv.org/labs/index.html (fetched 2026-08-29T11:21:45.586359+00:00, sha b14a8d05a0ec)
- Data as of 2026-08-30T08:39:29.467469+00:00.
