Quickstart

Get up and running with SpecAlign in 5 minutes.

Overview

In this quickstart, you will:

  1. Initialize the configuration

  2. Set up your API credentials

  3. Run a simple red-team test

  4. 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 configuration

  • providers.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

seeds.json

Generated seed prompts

episodes.jsonl

Full adversarial episode logs

dpo_dataset.json

DPO preference pairs for training

context_pool.jsonl

Successful attack examples

Next Steps