
Alignment-research scaffold (autoresearch-style) for LLM guardrails: search over a single policy.md surface
Open source by Santander AI Lab. An LLM / AI-safety guardrail research library / evaluation harness (autoresearch-style): it searches over a single mutable
policy.mdsurface to minimize attack success rate (ASR) against a fixed evaluation suite, with a benign-pass floor.
Part of Santander AI Open Source — open source AI projects from Banco Santander (santander.com).
autoguardrails is a small alignment research scaffold inspired by Karpathy's autoresearch.
Instead of searching over train.py, this repo searches over policy.md.
The idea is the same:
In this repo, the top-line metric is attack success rate (ASR, lower is better), with a benign-pass floor so the system cannot win by refusing everything.
For day-to-day experimentation, three files matter most:
program.md: the human-owned instructions for the looppolicy.md: the only file you should edit between runsresults.tsv: the append-only run logEverything else is fixed harness code or fixed evaluation data.
policy.mdeval_suite.jsonljudge_prompt.mdautoguardrails/ASR improves and benign pass does not fall by more than 2 percentage pointsIf you want a mental model closer to the original autoresearch, think of autoguardrails/ as the fixed helper layer and policy.md as the single file under search.
Run from the repository root.
python -m autoguardrails baseline --reset --repeat 2 --notes "initial baseline"
Edit only policy.md.
Score the new candidate.
python -m autoguardrails candidate --repeat 2 --notes "cover jailbreak and obfuscation"
python -m autoguardrails status
cat results.tsv
If a candidate is rejected, the harness restores policy.md to the last accepted version automatically.
If you prefer a single entrypoint, use run_autoguardrails.sh:
sh run_autoguardrails.sh status
sh run_autoguardrails.sh evaluate
sh run_autoguardrails.sh baseline "initial baseline" 2
sh run_autoguardrails.sh candidate "cover jailbreak and obfuscation" 2
On Windows, run the wrapper from Git Bash or another POSIX-compatible shell.
The default setup uses a deterministic local stub so the repo works offline. To run real experiments, point the target model and the judge model at OpenAI-compatible endpoints.
Target model variables:
AUTOGUARDRAILS_TARGET_PROVIDER=openai_compatibleAUTOGUARDRAILS_TARGET_MODELAUTOGUARDRAILS_TARGET_API_BASEAUTOGUARDRAILS_TARGET_API_KEYJudge model variables:
AUTOGUARDRAILS_JUDGE_PROVIDER=openai_compatibleAUTOGUARDRAILS_JUDGE_MODELAUTOGUARDRAILS_JUDGE_API_BASEAUTOGUARDRAILS_JUDGE_API_KEYExample:
export AUTOGUARDRAILS_TARGET_PROVIDER=openai_compatible
export AUTOGUARDRAILS_TARGET_MODEL=gpt-4.1-mini
export AUTOGUARDRAILS_TARGET_API_BASE=https://your-endpoint.example/v1
export AUTOGUARDRAILS_TARGET_API_KEY=your-target-key
export AUTOGUARDRAILS_JUDGE_PROVIDER=openai_compatible
export AUTOGUARDRAILS_JUDGE_MODEL=gpt-4.1-mini
export AUTOGUARDRAILS_JUDGE_API_BASE=https://your-endpoint.example/v1
export AUTOGUARDRAILS_JUDGE_API_KEY=your-judge-key
python -m autoguardrails baseline --reset --repeat 2 --notes "real-model baseline"
Use a frozen judge setup during a run series. Do not switch judge prompts or judge models mid-experiment.
A simple offline emulation cycle looks like this:
policy.md.candidate.One example candidate change that improves the bundled stub is to add explicit handling for:
That gives you a realistic first improvement curve without changing the evaluator.
program.md: experiment instructions and constraintspolicy.md: mutable guardrail policy under searchjudge_prompt.md: frozen judge prompteval_suite.jsonl: fixed attack and benign eval casesresults.tsv: run logrun_autoguardrails.sh: convenience wrapper around the CLIautoguardrails/: fixed Python harnesstests/: regression and safety checks for the harnessSee autoguardrails/README.md for the code architecture and tests/README.md for the test strategy.
ruff, black, mypy, pytest, pytest-cov (see CONTRIBUTING.md).AUTOGUARDRAILS_* environment variables described above).Contributions are welcome! Please read our Contributing Guidelines and Code of Conduct before getting started.