Quest 01 / 03 · Quick build
Test local system prompts against injection attacks
- prompt security
- Promptfoo
- Ollama
- Python
Why now Gray Swan published its Frontier Hazard Tracker across 17 safety categories, where TechCrunch reported weak prompt-injection results for some models. Separately, Scale reported post-training tests on Nemotron that raised refusals for inappropriate profiling requests. Scale's own tests do not prove those gains hold in other setups, so testing your own prompt locally matters.
Build it Build a local Promptfoo test suite against a small Ollama model using the 116 labeled prompts in the deepset test split. Your setup compares a plain assistant instruction against a hardened system prompt so you can measure blocked attacks alongside false refusals on benign requests.
From the news
Tools
- Ollama
Ollama's runtime uses the MIT license, while model weights have their own licenses. Local execution has no Ollama usage charge; optional cloud inference uses metered credits, subscriptions and enterprise terms.
- Promptfoo
Promptfoo's open-source code is MIT licensed. Its Community plan is free with stated probe allowances; commercial Enterprise and on-premise offerings add features under separate service terms. Model-provider charges and additional enterprise probes can be separate costs.
Data
- deepset/prompt-injections Hugging Face
Supplies the 116-row labeled test split of 60 prompt-injection attempts and 56 benign inputs for measuring block and false-refusal rates.
Steps
- Install Ollama locally and pull one small instruction-tuned model suitable for your laptop memory.
- Export the 116 rows from the deepset/prompt-injections test split into a local CSV keeping the verified text and label columns.
- Write a Promptfoo configuration targeting your local Ollama endpoint with two system prompts: one plain baseline instruction and one hardened refusal rule.
- Run promptfoo eval on all 116 prompts for both variants, then summarize label-1 blocks and label-0 false refusals with a short Python script.
Done when
- Running promptfoo eval finishes all 116 test prompts for both system-prompt variants against your local Ollama model and saves a JSON results file.
- Your Python summary prints block counts on the 60 injection rows and false-refusal counts on the 56 benign rows for each variant.
- The script exports a CSV listing every missed injection and over-refused benign prompt, or confirms zero failures when none occur.
Stretch goals
- Add a second local Ollama model to the same Promptfoo file and compare refusal rates on the non-English prompts inside the test split.
