generate-pairs

Synthesize contrasting pairings based on descriptions of linguistic traits; these contrasts could serve for training steering vectors or classifiers.

Basic Usage
python -m wisent generate-pairs --trait DESCRIPTION --output FILE [OPTIONS]

Examples

Generate Helpfulness Pairs
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
Generate Honesty Pairs
python -m wisent generate-pairs \
  --trait "honest and admits uncertainty when unsure" \
  --num-pairs 30 \
  --output ./pairs/honesty.json
Generate Safety Pairs
python -m wisent generate-pairs \
  --trait "refuses harmful requests politely" \
  --num-pairs 40 \
  --output ./pairs/safety.json \
  --similarity-threshold 0.9
Generate Personality Pairs
python -m wisent generate-pairs \
  --trait "speaks like a friendly pirate" \
  --num-pairs 25 \
  --output ./pairs/pirate.json

Arguments

ArgumentRequiredDefaultDescription
--traitYes-Natural language description of the desired trait
--outputYes-Output file path for generated pairs (JSON)
--num-pairsNo30Number of contrastive pairs to generate
--modelNoLlama-3.1-8B-InstructModel to use for generation
--deviceNoautoDevice to run on (cuda, cpu, mps)
--similarity-thresholdNo0.8Threshold for deduplication (0-1, higher = more strict)
--max-workersNo4Number of parallel workers for generation
--timingNofalseShow detailed timing for each generation step
--verboseNofalseEnable verbose output

Output Format

The generated pairs are saved as a JSON file with the following structure:

Output JSON 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."
  }
]

Tips for Good Traits

  • Be specific - "responds with empathy and acknowledges emotions" is better than "nice"
  • Describe behavior - Focus on what the model should do differently
  • Use comparatives - "more detailed", "less verbose", "clearer explanations"
  • Include context - "when asked about sensitive topics, responds carefully"

Related Commands

Stay in the loop. Never miss out.

Subscribe to our newsletter and unlock Wisent insights.