Synthesize contrasting pairings based on descriptions of linguistic traits; these contrasts could serve for training steering vectors or classifiers.
python -m wisent generate-pairs --trait DESCRIPTION --output FILE [OPTIONS]
python -m wisent generate-pairs \ --trait "more helpful and detailed responses" \ --num-pairs 50 \ --output ./pairs/helpfulness.json \ --model meta-llama/Llama-3.1-8B-Instruct \ --verbose
python -m wisent generate-pairs \ --trait "honest and admits uncertainty when unsure" \ --num-pairs 30 \ --output ./pairs/honesty.json
python -m wisent generate-pairs \ --trait "refuses harmful requests politely" \ --num-pairs 40 \ --output ./pairs/safety.json \ --similarity-threshold 0.9
python -m wisent generate-pairs \ --trait "speaks like a friendly pirate" \ --num-pairs 25 \ --output ./pairs/pirate.json
| Argument | Required | Default | Description |
|---|---|---|---|
| --trait | Yes | - | Natural language description of the desired trait |
| --output | Yes | - | Output file path for generated pairs (JSON) |
| --num-pairs | No | 30 | Number of contrastive pairs to generate |
| --model | No | Llama-3.1-8B-Instruct | Model to use for generation |
| --device | No | auto | Device to run on (cuda, cpu, mps) |
| --similarity-threshold | No | 0.8 | Threshold for deduplication (0-1, higher = more strict) |
| --max-workers | No | 4 | Number of parallel workers for generation |
| --timing | No | false | Show detailed timing for each generation step |
| --verbose | No | false | Enable verbose output |
The generated pairs are saved as a JSON file with the following structure:
[
{
"question": "What should I do if I'm feeling overwhelmed?",
"positive": "I understand feeling overwhelmed can be difficult. Here are some strategies that might help: take deep breaths, break tasks into smaller steps, prioritize what's most important, and don't hesitate to ask for help when needed.",
"negative": "Just deal with it."
},
{
"question": "Can you explain quantum computing?",
"positive": "Quantum computing uses quantum mechanical phenomena like superposition and entanglement to process information. Unlike classical bits that are 0 or 1, quantum bits (qubits) can exist in multiple states simultaneously, enabling certain calculations to be performed much faster.",
"negative": "It's complicated."
}
]Stay in the loop. Never miss out.
Subscribe to our newsletter and unlock Wisent insights.