Classification
LLMs can classify text into categories you define. This covers sentiment analysis, topic labeling, spam detection, and more — all without any training data.
Prompt
Classify the sentiment of each review as Positive,
Negative, or Neutral:
1. "Absolutely loved this product! Best purchase ever."
2. "It's okay, nothing special but does the job."
3. "Terrible quality. Broke after two days. Want a refund."
4. "Fast shipping, decent packaging."
The model categorizes each item using the labels you provided — no pre-training on your specific data needed.
Response
1. Positive
2. Neutral
3. Negative
4. Positive
You can define your own custom categories too. Here we classify support tickets by urgency.
Prompt
Classify this support ticket into one of: Urgent,
Normal, Low Priority.
"Our entire payment system is down and no customers can
check out. This started 10 minutes ago and is affecting
all regions."
The model picks the most appropriate category and can explain its reasoning if asked.
Response
Classification: Urgent
Reasoning: The issue affects a critical business system
(payments), impacts all customers across all regions,
and is currently active.
Key takeaway: LLMs are zero-shot classifiers — just describe the categories and provide the text. For higher accuracy, combine this with few-shot examples (see the Few-Shot Prompting example).
Tips:
- List all possible categories explicitly
- Ask for confidence: "rate confidence 1-10"
- Ask for reasoning to catch misclassifications
- Batch multiple items in one prompt for efficiency