Quickstart
Get up and running with SpecAlign in 5 minutes.
Overview
In this quickstart, you will:
Initialize the configuration
Set up your API credentials
Run a simple red-team test
View the generated results
Prerequisites
SpecAlign installed (see Installation)
OpenAI API key or compatible provider
Step 1: Initialize Configuration
Create default configuration files:
specalign config init
This creates two files:
config.json- Main configurationproviders.json- API provider settings
Step 2: Set API Credentials
Option A: Environment Variable
export SPECALIGN_OPENAI_API_KEY="sk-your-api-key"
Option B: Edit providers.json
{
"providers": {
"openai": {
"base_url": "https://api.openai.com/v1",
"api_key": "sk-your-api-key"
}
}
}
Step 3: Run the Pipeline
Run the complete SpecAlign pipeline:
specalign run --config config.json
Expected Output
You should see progress output similar to:
SpecAlign Pipeline
==================
Phase 1: Specification Generation
---------------------------------
✓ Loading rules from data/Stage_classified.md
✓ Generated 10 specifications
✓ Generated 100 seed prompts
Phase 2: Red Team Testing
-------------------------
Processing seeds: 100%|██████████| 100/100 [05:23<00:00]
✓ Completed 100 episodes
✓ Found 42 successful attacks
✓ Generated 42 DPO pairs
Results saved to:
- output/episodes.jsonl
- output/dpo_dataset.json
- output/context_pool.jsonl
Step 4: View Results
Analyze the generated data:
specalign analyze output/
Output Files
File |
Description |
|---|---|
|
Generated seed prompts |
|
Full adversarial episode logs |
|
DPO preference pairs for training |
|
Successful attack examples |
Next Steps
First Experiment - Deep dive into red-team testing
Red Team Pipeline - Complete pipeline tutorial
Configuration Reference - Configuration reference