Promptzl Documentation¶
Turn state-of-the-art LLMs into zero-shot PyTorch classifiers in just a few lines of code.
- Promptzl offers:
🤖 Zero-shot classification with LLMs
🤗 Turning causal and masked LMs into classifiers without any training
📦 Batch processing on your device for efficiency
🚀 Speed-up over calling an online API
🔎 Transparency and accessibility by using the model locally
📈 Distribution over labels
✂️ No need to extract the predictions from the answer.
Links¶
Installation¶
pip install -U promptzl
How does it Work?¶
Language models predict a token given a specific context by calculating a distribution over the vocabulary. When classifying sentences, only a few tokens are relevant for the classification task. Extracting the tokens’ logits and forming a distribution over them allows turning the LLM into a classifier. This is what Promptzl does. A simple example can be found in Tutorial - Basic Usage.