# THUDM/P-tuning-v2

An optimized deep prompt tuning strategy comparable to fine-tuning across scales and tasks

Repository: https://github.com/THUDM/P-tuning-v2
Canonical: https://ross.abutalabs.com/products/p-tuning-v2
Language: Python
License: Apache-2.0
License Family: permissive
Topics: natural-language-processing, prompt-tuning, pretrained-language-model, p-tuning, parameter-efficient-learning
Last push: 2023-11-16T04:38:09+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 1784, "days_push": 1021, "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 2078, forks 212 (observed 2026-08-28T04:06:11.402845+00:00)

## What it is
P-tuning v2 is a Python implementation of deep prompt tuning, applying trainable continuous prompts at every transformer layer so prompt tuning matches full fine-tuning performance on small/medium models and hard tasks like sequence tagging. It accompanies the ACL 2022 paper and includes reproduction scripts, hyperparameter search tooling, and a text retrieval variant.

## Use cases
- fine-tune BERT or RoBERTa with frozen backbone weights using trainable prompts
- adapt pretrained language models to sequence tagging tasks cheaply
- reproduce the P-Tuning v2 paper results on consumer GPUs
- run hyperparameter search for prompt tuning configurations
- train parameter-efficient neural text retrievers
- tune GLM models without full fine-tuning

## When to choose
- you want parameter-efficient tuning comparable to full fine-tuning on small/medium models
- you need to reproduce the ACL 2022 P-Tuning v2 experiments
- GPU memory is limited and freezing the backbone is acceptable
- you work with sequence tagging or SuperGLUE-style NLU tasks

## When to avoid
- you need a maintained production training framework with broad model support
- you want LoRA or other newer PEFT methods with active ecosystem support
- you need full fine-tuning rather than prompt-based adaptation
- you require up-to-date compatibility with recent PyTorch and transformer versions

## Facets
- artifact type: library
- maturity: maintenance
- function: machine-learning, llm-training, nlp
- domain: machine-learning, deep-learning, large-language-models
- platform: python
- tags: prompt-tuning, parameter-efficient-fine-tuning, p-tuning, prefix-tuning, research-code, pytorch, pretrained-language-models, natural-language-processing, linux, gpu

## Member repositories
- THUDM/P-tuning-v2 (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:11.402845+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-30T02:56:05.901864+00:00, confidence not recorded.
  - readme: https://github.com/THUDM/P-tuning-v2 (fetched 2026-08-28T04:06:11.402845+00:00, sha acb936cbbc5b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
