setfit-few-shot
npx machina-cli add skill a5c-ai/babysitter/setfit-few-shot --openclawFiles (1)
SKILL.md
1.2 KB
SetFit Few-Shot Skill
Capabilities
- Train SetFit models with few examples per class
- Configure contrastive learning settings
- Implement efficient classification pipelines
- Design few-shot training strategies
- Set up model evaluation
- Deploy lightweight classifiers
Target Processes
- intent-classification-system
Implementation Details
SetFit Advantages
- Few Examples: 8-16 examples per class
- No Prompts: No prompt engineering needed
- Fast Training: Minutes vs hours
- Small Models: Sentence transformer base
Training Process
- Contrastive fine-tuning of embeddings
- Classification head training
- Iterative sampling strategies
Configuration Options
- Base sentence transformer model
- Number of training examples
- Contrastive learning epochs
- Classification head architecture
- Evaluation metrics
Best Practices
- Diverse few-shot examples
- Balance class examples
- Use appropriate base model
- Validate on held-out data
Dependencies
- setfit
- sentence-transformers
Source
git clone https://github.com/a5c-ai/babysitter/blob/main/plugins/babysitter/skills/babysit/process/specializations/ai-agents-conversational/skills/setfit-few-shot/SKILL.mdView on GitHub Overview
SetFit few-shot learning enables efficient intent classification with minimal labeled data. It uses contrastive embedding fine-tuning and a lightweight classification head to deliver fast, deployable models without prompts.
How This Skill Works
The approach performs contrastive fine-tuning of sentence embeddings on a small labeled set, then trains a simple classification head on top. It supports configurable base models and training parameters, enabling iterative sampling and evaluation for robust intent detection.
When to Use It
- Bootstrapping a new product's user intents with 8-16 examples per class.
- Rapidly iterating on new or changing intents with limited labeled data.
- Deploying lightweight classifiers on resource-constrained devices or apps.
- Avoiding prompt engineering by using a pure few-shot learning pipeline.
- Evaluating performance on held-out data to validate classification quality.
Quick Start
- Step 1: Select a base sentence transformer model and collect 8-16 diverse examples per class.
- Step 2: Run SetFit fine-tuning with contrastive learning and train the classification head on your labeled data.
- Step 3: Evaluate on held-out data, iterate with sampling adjustments, and deploy the lightweight classifier.
Best Practices
- Provide diverse few-shot examples for each class to cover variations in user intent.
- Balance the number of examples across all classes to prevent bias.
- Choose an appropriate base sentence transformer model for your domain.
- Validate performance on held-out data and adjust sampling strategies as needed.
- Experiment with contrastive epochs and training data size to fit your task.
Example Use Cases
- Routing customer chat queries to the correct support team with minimal labeled data.
- Classifying user intents in a chatbot to trigger appropriate responses.
- Lightweight on-device intent detection for offline mobile apps.
- Rapidly adding new intents after product updates without rewriting prompts.
- Evaluating intent coverage on held-out user interactions to ensure reliability.
Frequently Asked Questions
Add this skill to your agents