When rescoring stored PyRIT results saves a red team re-run
If your PyRIT memory already holds the target responses you need, you may not need to resend a single attack. Teams often reach this point after a scorer changes: a judge prompt is rewritten for a new policy, a Likert scale is replaced, or a better classifier becomes available. PyRIT's BatchScorer, as described in the scoring documentation, scores responses that are already stored in memory, in parallel, and can select them by conversation, prompt id, memory labels and timestamps. The result is a new set of scores attached to existing conversations, without touching the target system again.
This matters for two reasons. First, re-judging is cheaper than re-attacking, because the costly steps of a red team run are usually the multi-turn attack itself and the calls to the target model, and those stay untouched. Second, it is safer for the target. Resending attacks to a production chatbot or an agent with tools can trigger rate limits, side effects or logging that the owning team did not expect, and a rescore leaves those behaviors out of the picture. Rescoring also keeps the comparison fair, because the old and new verdicts are applied to identical responses.
Teams usually need batch rescoring after a policy change, after adding a second scorer to check the first, or when reviewing a past run for a compliance request. Before relying on it, confirm with the current PyRIT documentation which selection fields your installed version supports, how new scores are stored alongside the originals in memory, and how a failed judge call is recorded. Test on a small labeled subset first, so you can see whether the new scorer agrees with the people who will sign off on the results.
How to select which stored responses to rescore
PyRIT's batch scorer can pick stored responses in four ways: by conversation, by prompt id, by memory labels, and by timestamps. Each one narrows the rescoring job to a different slice of memory, so the choice should follow the question you are answering with the new scorer.
Select by conversation
Pass specific conversation identifiers to rescore only the exchanges you already know matter, such as the transcripts a reviewer flagged or the multi-turn runs behind one finding. This is the narrowest selector and the easiest to verify, because you can list the conversation ids before the job starts. Check that each id returns the number of messages you expect before you trust the aggregate scores.
Select by prompt id
Prompt ids tie a stored response back to the objective or seed prompt that produced it, so this selector fits a question about one behavior across many runs. Use it when a team has rewritten a judge question for a single harm category and wants to see how that category scores across history. Confirm that prompt ids were recorded consistently in earlier runs, since a missing id silently removes responses from the job.
Select by memory labels
Labels attached during an earlier run, such as an operation name or a test tag, let you rescore one campaign without touching the rest of memory. This fits a re-judging job after a red team exercise, where the team wants a single operation's results measured against a stricter policy. Agree on a labeling convention before testing starts, because labels applied inconsistently across operations make the selection incomplete.
Select by timestamps
Time-based selection rescores everything recorded within a window, which suits runs made after a policy change or before a model update. It is the broadest selector, so review the window carefully to avoid mixing responses from a target version you no longer care about. Record the policy revision date alongside the window so an auditor can see which results were judged under which rules.
Batch scoring options and when each fits
This table compares the main choices when rescoring stored PyRIT results: which scorer to run, how narrowly to select responses, and whether to run in one parallel pass or smaller batches. Read each row as a decision point, and confirm exact parameter names in the PyRIT 1.1.0 scoring documentation before you write code.
| Choice | Option | Trade-off | When it fits |
|---|---|---|---|
| Scorer | New or improved scorer | Produces fresh verdicts without touching the target, but the new scorer's accuracy must be checked first | You changed the policy question, switched judge model, or found the original scorer was too lenient or strict |
| Scorer | Original scorer re-run | Confirms results are reproducible, but adds judge calls with no new information | You need to verify a past run or audit how stable a scorer's verdicts are |
| Selection | Narrow selection by conversation or prompt id | Limits judge cost and makes the result easy to trace to specific attacks | You are investigating one objective, one target, or a handful of flagged responses |
| Selection | Broad selection by memory labels or time window | Covers large operations in one pass, but may pull in responses from unrelated test runs | You are rescoring a whole campaign and labels or timestamps are set consistently across runs |
| Execution | Single parallel run | Finishes fastest, but concurrent judge calls can hit provider rate limits and cost spikes | The batch is modest and your judge endpoint has spare capacity |
| Execution | Smaller batches | Slower overall, but failures are easier to isolate and retry without repeating the whole set | The judge endpoint is rate limited, the selection is large, or you need checkpoints for review |
| Verification | Check counts before scoring | Adds a short step, but catches empty or mis-scoped selections before judge spend | Always, especially when selecting by labels or time ranges |
Setting up a batch rescoring run in PyRIT
This sequence takes a team from stored PyRIT conversations to a verified set of new scores, without sending any prompts back to the target. Each step ends with a check so the rescoring run only proceeds on data you have confirmed.
Confirm the memory backend holds the target conversations
Identify which memory backend the original attack used, either SQLite or Azure SQL, and confirm it is the same database you will point PyRIT at for rescoring. Your red team lead or the person who ran the original attack should confirm the file path or connection string. Done when you can open the database and see the conversations from the run you want to rescore. If the results sit in a different database, copy or point to that one before continuing, because BatchScorer can only select what memory can see.
Install PyRIT on a supported Python version
Install the pyrit package from PyPI in a clean virtual environment, using a Python version within the range the PyPI package supports. The PyRIT documentation recommends Python 3.13. Pin the PyRIT version to the one that produced the stored results where you can, so the message and score schemas match. Done when the install completes and importing the package in a Python shell runs without errors.
Configure credentials and settings
Place the credentials for the new scorer's model or service in ~/.pyrit/.env, and set memory and scorer settings in ~/.pyrit/.pyrit_conf. Use the same memory location as step one so the rescoring run reads the right data. Keep the scorer's judge model and endpoint explicit, because a rescoring run with a different judge produces different verdicts. Done when a small test call to the scorer returns a response, and no secret appears in notebook output or logs.
Select the stored responses to rescore
Define the selection that BatchScorer will use: conversation identifiers, prompt identifiers, memory labels or a timestamp window. Start with the narrowest selection that covers the run, such as one operation label. Before scoring, query memory with the same filter and count the matching assistant responses. Compare that count with what you expect from the original run, for example the number of objectives multiplied by the number of attempts. Proceed only when the count matches, and investigate any gap first.
Run the new scorer through BatchScorer
Create the new scorer, pass it to BatchScorer along with the selection from the previous step, and run the batch. BatchScorer scores the selected responses in parallel and writes the scores back to memory without resending any attack to the target. Watch the run for scorer errors, such as rate limit responses or malformed judge output, and record how many items failed. Done when the run finishes and the failure count is either zero or understood.
Verify the new scores in memory
Query memory for the scores attached to the selected responses and confirm that every selected item now has a score from the new scorer. Check a sample of the scored responses by reading the response text next to its score, and confirm the score type and scorer name match the scorer you intended. Compare the distribution of results with the original run's scores so you can explain any large shift before reporting it. Done when every selected item has exactly one score from the new scorer and the sample review raises no unexplained differences.
How BatchScorer avoids resending attacks to the target
BatchScorer reads responses that already exist in PyRIT memory, applies a scorer to them, and writes the results back alongside the original conversations. The target is never contacted in this flow. PyRIT's memory, which stores conversations and results in SQLite or Azure SQL, is the source of the responses, so the attack's original prompts and replies are reused as they were recorded. The scorer is the only component that does new work. Depending on which scorer you choose, that work is either a call to a judge model, a request to Azure AI Content Safety, or local custom logic. Before you run a rescore, confirm which of these your chosen scorer uses, because that determines what the run actually depends on.
That distinction matters for cost and capacity planning. An LLM-based scorer, such as a self-ask judge, sends each selected response to a judge model, so rescoring still incurs model usage charges and counts against the judge deployment's rate limits. Azure AI Content Safety calls are billed and throttled under their own service terms, and custom logic runs on your compute. Ask your team which judge endpoint and quota the rescore will use, and whether it shares capacity with live attacks or scheduled runs. Run a small selection first and check the rate-limit responses and the elapsed time before scaling to the full memory set, since the judge is usually the slowest and most expensive step.
Because the target is untouched, a rescore is safe to repeat against the same data, but the results are only as current as the scorer you ran. Store the scorer's identity and configuration with the new scores, or record the run in your own log, so an auditor can tell which judge model and question produced each verdict. Confirm with your own environment how your PyRIT version records scorer settings in memory before you rely on those records as evidence. The PyRIT scoring documentation describes the BatchScorer's selection options and is the reference to check against your version.
Data flow from PyRIT memory through BatchScorer
The flow starts with conversations and results already stored in PyRIT memory, held in SQLite or Azure SQL. BatchScorer selects a subset by conversation, prompt id, memory labels or timestamps, then sends those stored responses to the new scorer, which may call a judge model or an external service. Scores are written back to memory as new results. The target is shown as not contacted, so check that no attack objects are re-run and that your selection filters match only the records you intended to rescore.
Stored responses are rescored from memory, and the target is not called.
Security and data handling for rescoring runs
A rescoring run reads stored conversations and sends them to a scoring model or service, so it touches credentials, sensitive content and the records you rely on later. The four risks below are where teams most often lose control, and each one has a specific check to run before the first batch.
Scoring credentials in the environment file
PyRIT reads credentials from ~/.pyrit/.env, so the judge or scoring service key used for a batch run sits in a file on the machine that runs the scorer. Confirm who can read that file, whether the key is scoped to scoring only, and whether the same key is reused for attack targets. Use a separate, least-privileged key for batch scoring where your provider allows it, and rotate it on the same schedule as other keys in that environment.
Harmful content in stored memory
Memory holds the prompts and responses from every earlier attack, and many of those responses can contain harmful material by design. Selecting by conversation, label or time does not reduce what the database holds, so anyone who can query the memory store can read it. Restrict access to the SQLite file or Azure SQL database, decide who may view raw responses, and record who ran each batch.
Sensitive transcripts sent to judges
A rescoring run sends each selected response, and often the prompt that produced it, to the judge model or scoring service. If the transcripts contain customer data, internal system prompts or credentials that an attack surfaced, that data leaves the run and reaches the judge. Before running, confirm where the judge is hosted, its data retention terms, and whether it is approved for the data class in the transcripts. A local judge model keeps transcripts inside your boundary.
Audit trail for rescored results
A rescored result replaces the verdict you saw in the first pass, so the record needs to show which scorer, which judge model and which selection criteria produced each new score. Without that, an auditor cannot tell whether a changed pass or fail came from a better scorer or a changed test. Keep the scorer configuration, the selection query, the run date and the operator in your run notes, and keep the original scores rather than overwriting them.
Questions teams ask about rescoring PyRIT memory
What drives the effort and cost of a rescoring run?
The main drivers are the number of stored responses you select, the scorer you choose, and whether that scorer calls a model. A run that uses a self-ask judge makes one judge model call per scored response, so the count of selected responses and the price and latency of the judge model set the bill. A non-LLM scorer such as a classifier or a content safety service has its own per-call charges. Ask for the selection breadth, the scorer type and the expected number of responses before any quote. Setup work such as memory access and scorer configuration is mostly one-time, while repeated runs recur.
Can our own team rescore PyRIT memory without an outside partner?
Yes, if your team already runs PyRIT and can read its memory database. PyRIT's BatchScorer scores responses already in memory in parallel and can select them by conversation, prompt id, memory labels and timestamps, so the core task is a Python script that builds the selection and passes it to the scorer. The hard parts are usually outside the code: deciding which new scorer reflects your policy, validating its verdicts against human labels, and keeping an audit trail of which scorer produced which score. Teams with those skills in-house can do this alone.
What does the team need before starting a batch rescoring run?
Plan for four inputs. First, read access to the PyRIT memory store, which is SQLite or Azure SQL, with the correct environment set up. Second, a chosen scorer with a written question or threshold that matches your policy. Third, credentials for any judge model or scoring service, typically stored in ~/.pyrit/.env rather than in scripts. Fourth, a clear selection rule, such as a conversation set, a label or a time window. Confirm with your platform team where the memory database lives and who may read it, since stored responses can contain sensitive model output.
How long does a rescoring run take?
Duration depends on the number of selected responses, how many can be scored in parallel, and the response time of the scorer. The BatchScorer runs in parallel, so more concurrency shortens wall-clock time but can hit rate limits on a judge model endpoint. Run a small selection first to measure per-response time in your environment, then extrapolate. Ask any outside provider to state the selection size and the throughput assumption behind its timeline, because no general duration applies across memory sizes.
Does rescoring resend attacks to the target model?
No. Batch scoring reads responses already stored in PyRIT memory and sends only the scoring request to the scorer. The target system is not contacted again, so no new attack traffic reaches it. This matters for production systems with rate limits or usage logs, and for keeping results comparable with the original run. The scorer itself may still call a model, so its traffic and its data handling still need review.
How do we know a new scorer's verdicts can be trusted on old results?
Rescoring changes the verdicts on stored data, so treat the new scorer as a new measurement. Before relying on it, score a sample that has human labels, compare the verdicts, and record the scorer identity so the results show which scorer produced each score. PyRIT's scorer metrics support this kind of check. Keep the original scores in memory rather than overwriting them, so reviewers can see what changed and why.
When should we bring in outside help for rescoring?
Consider outside help when the rescoring result will support a decision that others must review, such as a compliance submission, a release gate or a finding reported to executives. DeployOpen plans and runs PyRIT-based AI security testing, including AI agent rollout security review and customer AI security review support, and prepares evidence for compliance assessments. It does not issue audit reports or certifications. Most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts, and a quote follows from that written scope.
How DeployOpen scopes and runs PyRIT rescoring work
DeployOpen scopes a rescoring engagement in a written, fixed-scope agreement before any work starts. The agreement names which conversations are in scope, selected by conversation, memory labels or time window, which scorers will run against them, and which outputs the client receives, such as re-scored results, a comparison against the previous scorer and a record of the selection logic. Because the work reads stored data, the agreement also states that the target system will not be contacted, so the client's application owners and change managers can confirm that no new attack traffic reaches production or a model provider.
The work runs inside the client's own infrastructure. DeployOpen installs PyRIT in an environment the client controls, points it at the memory backend the client already uses (SQLite or Azure SQL, as PyRIT memory supports), and loads the scorer configuration from the client's own secret store rather than from a developer workstation. Selection criteria are written down as code or a versioned query so an auditor can reproduce which records were rescored and why. The client's security or data team should confirm, before the run, where scorer model calls go, whether those endpoints are approved for the conversation content, and who holds access to the memory database.
Optional retainer support covers the cases that recur after the first run: new scorers added to the policy, periodic rescoring when a judge model or policy text changes, and retesting after scorer accuracy checks. Ask any partner for the written list of deliverables, the named roles on each side, how changes to scope are approved, and how long stored results are retained after handover. DeployOpen does not hold any certification or partner status for PyRIT or its scoring models through this work, so the evidence the client relies on should come from its own assessors and from the documentation the run produces.

