SAGE is a framework for generating, simulating, and evaluating conversational data for language model safety research. It supports multi-turn and single-turn experiments, seed generation, user simulation, and automated evaluation of model outputs against safety policies.
Environment
Create a conda environment and install dependencies:
conda create -n sage python=3.10
conda activate sage
pip install -r requirements.txt
Configuration
main-en-aaai.py, main-seeds.py, etc.).constants.py as needed..
├── constants.py # Global constants and configuration
├── eval_aaai.py # Main evaluation script for defect detection
├── eval_aaai_refusal.py # Evaluation script for refusal detection
├── main-en-aaai.py # Main script for multi-turn user simulation
├── main-seeds.py # Script for single-turn seed-based simulation
├── models.py # Model wrappers and utilities
├── process_seed_to_userbot_input.ipynb # Notebook to process seed data for userbot
├── utils_lang.py # Utility functions for language processing
├── data/
│ ├── CollatedData4oRun2.csv # Data from GPT-4o re-run
│ ├── CollatedDataMain.csv # Multi-turn experiment data
│ ├── CollatedDataSeedsExperiment.csv # Single-turn seed experiment data
│ ├── Input/
│ │ ├── fin.tsv # Userbot input (finance)
│ │ ├── med.tsv # Userbot input (medical)
│ │ └── van.tsv # Userbot input (vanilla/general)
│ ├── SeedGenerationInput/
│ │ ├── master.txt # Seed generation input file
│ │ └── seedgeneration.md # Seed generation prompt
│ └── SeedGenerationOut/
│ └── Fin_seeds.csv # Generated seeds output
├── EvalChains/
│ ├── Misinformation.py # Policy chain for misinformation
│ ├── Refusal.py # Policy chain for refusal
│ ├── SexualHarm.py # Policy chain for sexual harm
│ └── Violence.py # Policy chain for violence
├── HumanBots/
│ └── 5PT-Lang.md # User simulator prompt
└── README.md
We have collated the data from all the steps in the pipeline in the /data directory. The data is organized as follows:
CollatedDataMain.csv - This contains the data from the multi-turn main experiment.CollatedDataSeedsExperiment.csv - This contains the data from the single-turn seed generation experiment.CollatedData4oRun2.csv - This contains the data from the re-run of the main experiment (only gpt-4o) for Inter-Run Variance evaluation.All data artifacts are stored in the /data directory:
/data/SeedGenerationInput/ - This contains both the seed generation input file (each row is substituted in the prompt iteratively per generation) and prompt./data/SeedGenerationOutput/ - This contains the generated seeds. ./process_seed_to_userbot_input.ipynb is used to generat the input to the userbot./data/Input/ - This contains the userbot input files per setting (output of seed generation)./main-en-aaai.py - This is the main script that runs the userbot and carries the conversations. It uses the input data from /data/Input/ and generates the output as /data/Conversations. The single-turn experiment is run using /main-seeds.py with the output in /data/ConversationsSeeds./HumanBots/5PT-Lang.md./eval_aaai.py and /eval_aaai_refusal.py for Defect and Refusal respectively. The outputs are stored as /data/Evals* and /data/EvalsRefusal*./EvalChains/.constants.py for experiment-wide configuration.utils_lang.py.models.py./EvalChains/./HumanBots/./data/Input/ or /data/SeedGenerationInput/.SAGE is a framework for generating, simulating, and evaluating conversational data for language model safety research. It supports multi-turn and single-turn experiments, seed generation, user simulation, and automated evaluation of model outputs against safety policies.
Environment
Create a conda environment and install dependencies:
conda create -n sage python=3.10
conda activate sage
pip install -r requirements.txt
Configuration
main-en-aaai.py, main-seeds.py, etc.).constants.py as needed..
├── constants.py # Global constants and configuration
├── eval_aaai.py # Main evaluation script for defect detection
├── eval_aaai_refusal.py # Evaluation script for refusal detection
├── main-en-aaai.py # Main script for multi-turn user simulation
├── main-seeds.py # Script for single-turn seed-based simulation
├── models.py # Model wrappers and utilities
├── process_seed_to_userbot_input.ipynb # Notebook to process seed data for userbot
├── utils_lang.py # Utility functions for language processing
├── data/
│ ├── CollatedData4oRun2.csv # Data from GPT-4o re-run
│ ├── CollatedDataMain.csv # Multi-turn experiment data
│ ├── CollatedDataSeedsExperiment.csv # Single-turn seed experiment data
│ ├── Input/
│ │ ├── fin.tsv # Userbot input (finance)
│ │ ├── med.tsv # Userbot input (medical)
│ │ └── van.tsv # Userbot input (vanilla/general)
│ ├── SeedGenerationInput/
│ │ ├── master.txt # Seed generation input file
│ │ └── seedgeneration.md # Seed generation prompt
│ └── SeedGenerationOut/
│ └── Fin_seeds.csv # Generated seeds output
├── EvalChains/
│ ├── Misinformation.py # Policy chain for misinformation
│ ├── Refusal.py # Policy chain for refusal
│ ├── SexualHarm.py # Policy chain for sexual harm
│ └── Violence.py # Policy chain for violence
├── HumanBots/
│ └── 5PT-Lang.md # User simulator prompt
└── README.md
We have collated the data from all the steps in the pipeline in the /data directory. The data is organized as follows:
CollatedDataMain.csv - This contains the data from the multi-turn main experiment.CollatedDataSeedsExperiment.csv - This contains the data from the single-turn seed generation experiment.CollatedData4oRun2.csv - This contains the data from the re-run of the main experiment (only gpt-4o) for Inter-Run Variance evaluation.All data artifacts are stored in the /data directory:
/data/SeedGenerationInput/ - This contains both the seed generation input file (each row is substituted in the prompt iteratively per generation) and prompt./data/SeedGenerationOutput/ - This contains the generated seeds. ./process_seed_to_userbot_input.ipynb is used to generat the input to the userbot./data/Input/ - This contains the userbot input files per setting (output of seed generation)./main-en-aaai.py - This is the main script that runs the userbot and carries the conversations. It uses the input data from /data/Input/ and generates the output as /data/Conversations. The single-turn experiment is run using /main-seeds.py with the output in /data/ConversationsSeeds./HumanBots/5PT-Lang.md./eval_aaai.py and /eval_aaai_refusal.py for Defect and Refusal respectively. The outputs are stored as /data/Evals* and /data/EvalsRefusal*./EvalChains/.constants.py for experiment-wide configuration.utils_lang.py.models.py./EvalChains/./HumanBots/./data/Input/ or /data/SeedGenerationInput/.