Overview
The sweep API lets you systematically vary hyperparameters across the full abliteration pipeline to find optimal configurations. It generates a Cartesian product of all specified parameter values and runsAbliterationPipeline once per combination, recording quality metrics for comparison.
run_sweep()
(param_config, seed) pair in config.sweep_params × range(config.n_seeds), instantiates an AbliterationPipeline and calls .run(). Results are saved incrementally to {config.output_dir}/sweep_results.json.
SweepConfig
required
Sweep configuration specifying the parameter grid and fixed values.
list[SweepResult] — one entry per (param_config, seed) pair, in grid-product order.
Sweep runs are independent — a failed run records
error in its SweepResult and the sweep continues. Partial results are written to disk after each run.SweepConfig
str
required
HuggingFace model name or local path passed to every
AbliterationPipeline in the sweep.dict[str, list[Any]]
required
Parameters to grid-search. Keys are
AbliterationPipeline constructor argument names; values are lists of candidate values. All combinations are run.dict[str, Any]
default:"{}"
Parameters passed to every run unchanged. Merged with each
sweep_params combination; sweep_params values take precedence on conflict.str
default:"sweep_results"
Root directory for model outputs (
run_000/, run_001/, …) and the aggregated sweep_results.json.int
default:"42"
Base random seed. Each additional seed offset adds
seed + offset.int
default:"1"
How many different random seeds to run each parameter configuration with. Total runs =
len(grid) × n_seeds.SweepResult
dict[str, Any]
The specific sweep parameter values for this run (the swept portion only, not
fixed_params).int
Random seed used.
dict[str, Any]
Quality metrics from the VERIFY stage:
refusal_rate, perplexity, coherence, kl_divergence.dict[str, float]
Wall-clock seconds per stage:
{"summon": ..., "probe": ..., "distill": ..., "excise": ..., "verify": ..., "rebirth": ...}.list[int]
Layer indices modified during excision.
str | None
Error message if this run failed;
None on success.