This project implements a technique to measure and extrapolate model compliance rates by interpolating between safe and unsafe prompt distributions for studying rare model behaviors that are difficult to observe directly. By computing L_α = α * L_P + (1 - α) * L_Q at the logit level, we can:
# Clone the repository
git clone https://github.com/yourusername/logit_diff_amp.git
cd logit_diff_amp
make install
python main.py \
--prompt-p "Your safe prompt" \
--prompt-q "Your unsafe prompt" \
--n-samples 25 \
--alpha-steps 11 \
--output-dir output
| Argument | Short | Default | Description |
|---|---|---|---|
--prompt-p | -p | required | Safe prompt P |
--prompt-q | -q | required | Unsafe prompt Q |
--n-samples | -n | 25 | Samples per alpha value |
--alpha-start | 0.0 | Alpha range start | |
--alpha-end | 1.0 | Alpha range end | |
--alpha-steps | 11 | Number of alpha steps | |
--batch-size | 30 | Batch size for generation | |
--output-dir | -o | output | Output directory |
To run on a SLURM cluster:
sbatch run.batch
Edit run.batch to customize job parameters and prompts.
The script generates:
CSV file (output/results.csv): Raw experimental data with columns:
alpha: interpolation coefficientresponse: model-generated textclassification: "compliance" or "refusal"Plot (output/compliance_vs_alpha_fitted.png): Compliance rate vs α with:
Console output: Summary statistics and sigmoid fit parameters
MIT License - see LICENSE file for details.
1 commits
Python
89.0%
Makefile
7.0%
Shell
4.0%
This project implements a technique to measure and extrapolate model compliance rates by interpolating between safe and unsafe prompt distributions for studying rare model behaviors that are difficult to observe directly. By computing L_α = α * L_P + (1 - α) * L_Q at the logit level, we can:
# Clone the repository
git clone https://github.com/yourusername/logit_diff_amp.git
cd logit_diff_amp
make install
python main.py \
--prompt-p "Your safe prompt" \
--prompt-q "Your unsafe prompt" \
--n-samples 25 \
--alpha-steps 11 \
--output-dir output
| Argument | Short | Default | Description |
|---|---|---|---|
--prompt-p | -p | required | Safe prompt P |
--prompt-q | -q | required | Unsafe prompt Q |
--n-samples | -n | 25 | Samples per alpha value |
--alpha-start | 0.0 | Alpha range start | |
--alpha-end | 1.0 | Alpha range end | |
--alpha-steps | 11 | Number of alpha steps | |
--batch-size | 30 | Batch size for generation | |
--output-dir | -o | output | Output directory |
To run on a SLURM cluster:
sbatch run.batch
Edit run.batch to customize job parameters and prompts.
The script generates:
CSV file (output/results.csv): Raw experimental data with columns:
alpha: interpolation coefficientresponse: model-generated textclassification: "compliance" or "refusal"Plot (output/compliance_vs_alpha_fitted.png): Compliance rate vs α with:
Console output: Summary statistics and sigmoid fit parameters
MIT License - see LICENSE file for details.
1 commits
Python
89.0%
Makefile
7.0%
Shell
4.0%