-
A task, five examples and a pair of weights go in
The writer can start from a task description and a few worked examples, both optional, and its template says it will be given a pair of weights (the paper does not print the starting values). In the paper’s runs it gets 5 examples that are kept apart from the validation and test questions.
Sections 3.2.1 and 4.3, Appendix A.1
-
The writer drafts three candidates, guardrails included
The Prompt Generation Agent writes k = 3 candidate prompts a round. Its own instructions tell it to put refusal wording and worked examples into every candidate, from the first round on. From round 2 it also sees the best earlier prompts and the critic’s instructions. We follow one candidate.
Section 3.2.1, Appendix A.1, Section 4.3
-
The security check puts the candidate in front of adversarial requests
The candidate is paired with each adversarial request in a validation sample of 80 drawn from HarmBench, a standardized red-teaming benchmark, and sent to the target model. A judge model marks each reply 1 if the model safely refuses or deflects, 0 if not. The security score S is the share marked 1. This page shows no request and no reply.
Sections 3.2.2, 4.1 and 4.3
-
The performance check asks the task’s own questions
The same candidate is run on the task’s validation questions. A judge marks each answer 1 if correct and complete, 0 otherwise, and K is the share marked 1. The paper notes that this agent can use a user-defined tool or a deterministic script in place of the LLM judge when a task allows it.
Sections 3.2.3 and 4.3
-
The critic turns two scores into a ranking, a repair note and new weights
The Critic Agent computes Score = w1 x K + w2 x S for every candidate, ranks them, writes instructions for the next draft, and chooses the next pair of weights. If candidates keep scoring low on security it raises w2; if the floor is met comfortably it shifts weight back to performance. In the paper this is a language model’s judgement, not a formula.
Sections 3.1 and 3.2.4, Appendix A.4
-
The gate: clear the floor and the bar, or go round again
The loop stops as soon as any candidate has S of at least γ and Score of at least τ. In the paper’s runs γ = 0.75 and τ = 0.50, with at most 5 rounds and so at most 15 candidates. If nothing ever clears both, the best-scoring candidate is returned anyway.
Sections 3.3 and 4.3
-
What leaves the loop meets the held-out test
What leaves the loop is scored on questions and adversarial requests it has never been tuned on: 20% of each task’s 100 samples and 20 benchmark requests. Those test scores are what the evidence section shows. The paper’s example of a finished prompt has two parts: task instructions with a worked example, and refusal wording such as refuse to assume additional information
.
Section 4.3 says the top 5 prompts by validation score are run on the test set; Section 3.3 says the one that cleared the gate. The paper does not say how one reported number is chosen from five. See the measured results.
Sections 3.3, 4.1, 4.3 and 5.4
Select any part of the drawing to read what it is in the paper. Arrow keys move between parts.
Task description, few-shot examples, seed prompts
- Where
- Sections 3.2.1 and 4.3
- In
- whatever the user supplies
- Out
- a first brief for the writer
All of it is optional. With none of it, the paper says, the writer is still able to generate prompts
. In the paper’s runs it receives 5 few-shot examples, disjoint from the validation and test sets.
Not in the paper: the starting weights.
Central orchestrator
- Where
- Section 3.2
- In
- every agent’s output
- Out
- the next call, or stop
It invokes agents in sequence, collects their outputs, and determines whether convergence criteria are satisfied
, for at most 5 iterations. The caption of the paper’s Figure 1 says the two checks run in parallel, Section 3.2 says in sequence; this page only says that both checks see every candidate.
Not in the paper: how many iterations the reported runs used.
Prompt Generation Agent (PGA)
- Where
- Section 3.2.1, Appendix A.1
- In
- task, examples, the critic’s instructions and weights, the best earlier prompts
- Out
- k = 3 candidate prompts
The paper’s aim for it: diverse candidates that explore different regions of the prompt space
. Its template asks for refusal wording and worked examples in every candidate. It runs at temperature 0.7.
Not in the paper: which model runs the four agents.
Candidate prompts p1 to pk
- Where
- Sections 3.2.1 and 4.3
- In
- one call of the writer
- Out
- 3 prompts a round, at most 15 in all
Every candidate goes to both checks. In the toy a candidate is a point with two made-up knobs, task detail and guardrail language.
Not in the paper: any candidate from a real run, other than the finished example in Figure 4.
HarmBench sample
- Where
- Section 4.1
- In
- a benchmark of 510 curated behaviours
- Out
- 100 sampled requests: 80 for SAPO’s validation, 20 for testing every method
The benchmark spans categories such as harassment and misinformation. This page shows none of its content: the store is a box, and a score is a row of neutral tiles.
Not in the paper: how the 100 were sampled and which categories they cover.
Security Check Agent (SCA)
- Where
- Section 3.2.2
- In
- one candidate prompt
- Out
- a security score S from 0 to 1
Candidates under the floor are flagged and excluded from initial selection, unless no prompts meet the minimum threshold
. The benchmark is static today; the paper names dynamic red-teaming as future work.
Not in the paper: any validation score of any candidate.
Target model
- Where
- Section 4.2
- In
- a candidate prompt plus one request or one question
- Out
- a reply for a judge to mark
GPT-4o, deployed through Azure AI Foundry with pre-defined content filters disabled to ensure unfiltered capture of model outputs for safety evaluation
. It is drawn once because it is the same model in both lanes, and the only target model in the paper.
Not in the paper: the model version.
LLM Security Judge
- Where
- Section 4.3, Appendix A.2
- In
- one request and one reply
- Out
- 1 or 0
GPT-4o at temperature 0. It gives 1 if the model safely refuses or deflects the harmful query
and 0 otherwise. S is the proportion marked 1.
Not in the paper: any check of this judge against human labels.
Performance Evaluation Agent (PEA)
- Where
- Section 3.2.3
- In
- one candidate prompt
- Out
- a performance score K from 0 to 1
It tests each candidate on a validation subset of the task’s data. The paper says it is designed to be modular and can seamlessly integrate user-defined evaluation tools or deterministic scripts
.
Not in the paper: any validation score of any candidate.
Task data
- Where
- Sections 3.3, 4.1 and 4.3
- In
- 100 samples per task
- Out
- 5 few-shot examples, 80% for validation, 20% for testing
Six tasks: three from Instruction Induction and three from BIG-Bench Hard. The validation split feeds the loop. The test split is used only after the loop ends (Section 3.3); Section 4.3 says the top 5 prompts are run on it.
Not in the paper: what five of the six tasks ask. Only Colored Objects has a printed example.
LLM Judge
- Where
- Section 4.3, Appendix A.5
- In
- a question, the reply, a reference answer
- Out
- 1 or 0
GPT-4o at temperature 0, the same model as the target. It gives 1 if the response is correct and complete
, and its template says You should not base your assessment on the exact match
. So accuracy here is judged correctness.
Not in the paper: any check of this judge against human labels.
Critic Agent (CA)
- Where
- Section 3.2.4, Appendix A.4
- In
- both scores for every candidate, the old weights
- Out
- a ranking, written instructions, new weights
The paper calls it the central intelligence of the optimization loop
. It runs at temperature 0.7. The paper’s Figure 1 labels this box “PCA: Prompt Critic Agent”; the text says Critic Agent.
Not in the paper: any critique text from a real run.
Adaptive weights w1 and w2
- Where
- Section 3.1
- In
- how this round’s scores fell
- Out
- w1 and w2 for the next round, adding to 1
The paper says the two weights are not fixed hyperparameters: the critic updates them every iteration. Low security scores raise w2; a floor met comfortably shifts weight back to performance. There is no formula: a language model picks the values.
Not in the paper: starting values, or any trace of the weights over iterations.
Model Migration Extension
- Where
- Section 3.4, Equation 4
- In
- performance on the old model as a third weighted term
- Out
- a prompt for the new model, same security floor
Drawn dashed because it is a formulation only. The paper: empirical validation of this extension across model families is left to future work
.
Not in the paper: any result for this objective.
The two constraints, as a stopping rule
- Where
- Equation 2, Sections 3.3 and 4.3
- In
- S and Score of every candidate
- Out
- stop with a prompt, or go round again
Floor γ = 0.75, bar τ = 0.50. If nothing clears both in 5 rounds the top candidate by overall score is returned anyway. The paper’s own description: This rule is transparent and auditable.
Not in the paper: how often the stop rule or the fallback fired.
Held-out test set
- Where
- Sections 3.3, 4.1 and 4.3
- In
- the prompt that left the loop
- Out
- a test accuracy and a test security score
20% of each task’s 100 samples, and 20 benchmark requests. With test sets this small, one question moves a task’s accuracy by about five points (this page’s arithmetic from Section 4.1).
Not in the paper: how one reported number is chosen from the top 5 prompts tested.
The optimized prompt
- Where
- Section 5.4, Figure 4
- In
- the returned candidate
- Out
- a prompt with its two test scores
The printed example has two components: task instructions with a worked example and strict formatting, then refusal wording such as align with ethical considerations
. It is one example, which the paper calls qualitative evidence.
Not in the paper: the finished prompts for the other five tasks.