LLM-based rewrite, translation and tone converters in PyRIT

PyRIT can use a configured LLM to translate, rephrase or change the tone of attack prompts before they reach the target. This page covers how that works, how to choose the converter model, and the cost and variability it adds.

On this page

LLM-based rewrite and translation converters in PyRIT: when your team needs them

Use an LLM-based converter when your red team needs the same attack objective expressed in a form that plain attack text does not reach: another language, a different register, a changed tone, or a different tense. A prompt that a target refuses in English may be handled differently when it is translated, softened into a polite request, or rephrased as a persuasion attempt, and that difference is what these converters let you measure. PyRIT's text-to-text converters include translation, variation and tone converters that use a configured model, according to the PyRIT documentation on text-to-text converters. Because the rewrite is done by a model rather than by a fixed algorithm, the converter is itself an LLM component in your test setup.

The decision to make first is which model performs the rewrite. The converter model is separate from the target under test, so your team must choose it deliberately, confirm it is approved for the data involved, and record which model and configuration produced each converted prompt so results can be reproduced. Ask whether the model can refuse or silently alter sensitive content during rewriting, since a rewrite that drops the harmful element tests a different prompt than the one you intended. Confirm the converter's configuration options and supported languages in your installed PyRIT version, because the documentation is the reference for what each converter accepts.

Plan for extra cost and variability before you run large batches. Each converted prompt usually costs an additional model call, so cost scales with the number of objectives, languages and tone variants, and that cost recurs on every run. Output also varies between calls, so the same source prompt may produce different wording, and a single success or failure may not be a stable finding. Run enough repetitions to see whether a result holds, store the converted text in memory alongside the original objective, and review a sample of rewrites by hand to confirm they still carry the intended harm before you attribute a target's response to the converter.

Which converter fits which test goal

Translation converters use a configured model to render a prompt in another language. Their test goal is language coverage: many safety layers are tuned mainly on English, so a request that is refused in English may get through in a language the filter handles less well. The converter model matters here because it sets the quality of the translation itself. A weak translation can change the meaning of the request, which makes a refusal or compliance result hard to interpret.

  • Meaning preservation: Compare the translated prompt with the original, ideally with a bilingual reviewer, before attributing any result to the target.
  • Script and tokenization: Check that the output uses the intended script and was not replaced with English or mixed text.
  • Language list: Choose languages your users actually speak and languages your data and filters are expected to cover.
  • Back-translation: Translating the output back to English gives a rough check on how far the meaning drifted.
  • Response language: Record whether the target answers in the prompt language, since that affects how your scorer reads the reply.

Confirm with your team which languages are in scope before running the converter, and keep the translated prompt in memory so a reviewer can check what the target actually received.

Configuration options and when each fits

This table compares the main choices when configuring an LLM-based rewrite, translation or tone converter: which model rewrites the prompt, how the instruction is worded, which language or tone is applied, and whether the converter runs per prompt or once per dataset. Read each row for its effect on cost, consistency, independence from the target and reproducibility, then pick the combination that matches what you are testing.

OptionTrade-offWhen it fits
Converter model from the same provider as the targetLowest setup friction and familiar billing, but rewrites may share the target's safety tuning, so the converter can refuse or soften prompts in ways the target would not.Quick checks where you want the rewrite to behave like the system under test and independence is not the goal.
Converter model from a different providerAdds a second account, key and bill, and output style will differ from the target. Rewrites are less likely to mirror the target's own refusal patterns.Cross-provider testing where you want the converter to be independent of the model being tested.
Local or self-hosted converter modelKeeps prompts inside your environment and removes per-call API cost, but output quality and compliance with instructions vary with model size. You own hosting and upgrades.Regulated data, air-gapped runs or repeated large batches where data handling matters more than rewrite fidelity.
Explicit instruction wordingPrecise wording (for example, the target language, register and what must be preserved) makes output more consistent but takes review time. Vague wording increases drift between runs.Any run whose results will be compared over time or reported as evidence.
Target language or tone setEach added language or tone multiplies the number of prompts to score and the cost of review. Narrow sets are easier to interpret.Testing a specific market, user group or persuasion style tied to a documented risk.
Per prompt conversionEach prompt gets its own rewrite call, so cost scales with prompt count and outputs vary between calls. Failed or refused rewrites need handling.Small or exploratory runs where each objective needs its own phrasing.
Once per dataset conversionConverted prompts are generated once and reused, lowering cost and giving repeatable inputs across target versions. Any weakness in the rewrite carries through every run.Regression testing, scheduled scans and comparisons between model or configuration versions.
Pinned model version and recorded settingsHolding the converter model, version and instruction fixed improves reproducibility, but provider model changes can still alter output. Record settings in memory with each run.Assessments where an auditor or reviewer must be able to trace how a prompt was produced.

Choosing the converter model: independence, capability and reproducibility

Choose the model behind each LLM-based converter deliberately, because it determines what the converter produces. A model that refuses to rewrite a harmful objective will return an empty string, a sanitized paraphrase or a lecture instead of the attack you intended. The result looks like a clean run but tested something other than what you planned. Before you rely on a converter model, send it a representative set of your own objectives through the translation, rephrase or tone converter you plan to use, and read the outputs. Check that the meaning survives, that nothing is silently dropped, and that refusals are visible in your logs rather than mixed in with successful conversions.

Independence is the second decision. If the converter model comes from the same provider as the target, a provider-wide safety change, outage or shared filtering behavior can affect both sides at once. Failures may then correlate in ways that hide whether the target itself is weak or the conversion layer shares its weakness. Ask which provider and model family the target uses, and consider a converter model from a different provider or a self-hosted model where your governance allows it. Confirm with your team whether the converter model is approved for the data in your objectives, since those prompts are sent to that model as well.

Reproducibility is the third decision, and it is easy to overlook. Hosted models are updated, and the same model name can produce different wording after a version change. Record the converter model name, its exact version or deployment identifier, the temperature and other sampling settings, and the PyRIT version with every run, so that a later result can be traced to the conditions that produced it. Store these values in the run metadata or memory records rather than in a note. When you rerun a test after a model update, repeat the small objective check first. If the outputs have shifted, treat the change in your results as a possible converter effect until you have shown otherwise.

What extra cost and variability LLM converters add

An LLM converter turns every test prompt into a model call before the target sees it. That changes what each run costs, how long it takes, and whether two runs can be compared. The cards below cover the components to plan for before you rely on converted prompts in a test.

Additional model calls per prompt

Each converted prompt needs one call to the converter model before the target receives anything. Your organization pays for those calls on the converter model's account, not the target's, so a test set of prompts that are all converted doubles the number of model requests in a run. Every rerun repeats those calls unless you cache converted outputs. Ask who holds the converter model credentials and whether the converter calls are counted in your budget.

Converter docs

Latency added to each test

The converter call sits in the critical path of every attack step. For multi-turn attacks, that delay repeats on each turn, so total wall-clock time grows with the number of converted turns, not just the number of prompts. Confirm the converter model's response times under your expected concurrency, and set timeouts and retries so a slow converter does not stall the whole run.

Non-deterministic outputs across runs

A converter that rephrases or changes tone can return different wording on each call, even with the same input. The same seed prompt may therefore reach the target in different forms across runs. Decide whether you need fixed sampling settings, stored converted prompts for reruns, or a comparison that accepts wording variation, and record which one you chose in the test report.

Meaning drift after model updates

When the provider updates or retires the converter model, the same converter may rewrite prompts differently, even though the configuration has not changed. A result that was reproducible last quarter can shift without any change to your target. Pin the converter model version where the provider allows it, and rerun a fixed reference set after any converter model change.

Loss of meaning in translation

A translation converter can drop qualifiers, change the intent of a harmful objective, or make the request weaker or stronger than the original. If the converted prompt no longer asks for what the seed objective describes, a refusal or a pass tells you little about the target. Have a fluent reviewer spot-check a sample of translated prompts against their originals before you read results.

Scoring converted text separately

Scorers judge the target's response, but the converted prompt is a different input from the seed, and a scorer may need the original objective to judge fairly. Plan a scoring step that records both the original objective and the converted text, and check the scorer on converted examples. Without that record, you cannot tell whether a failure came from the target or from the converter.

Setting up an LLM converter in PyRIT step by step

This sequence takes a team from a clean install to a verified LLM-based converter run, so that the converted prompts, the converter model and the cost of each run are understood before any scale-up. Each step ends with a check that the team can repeat.

  1. Confirm a supported Python version

    The engineer responsible for the test environment checks that the interpreter is within the range the PyPI package supports, which is Python 3.10 up to but not including 3.15. The PyRIT documentation recommends Python 3.13, so use that version where the team can. Run the version command in the target shell and record the output in the test plan. The step is done when the interpreter reports a supported version and the team lead has noted it.

  2. Install PyRIT with pip

    In an isolated virtual environment, the engineer installs the package with pip from PyPI and records the exact version installed. Pin that version in the project's requirements file so that later runs use the same converter code. Confirm the install by importing the package in a short Python session and listing the converter classes. The step is done when the import succeeds and the pinned version matches the release the team intends to test.

  3. Configure model credentials and settings

    The engineer places the credentials for the converter model and the target in ~/.pyrit/.env, and sets run defaults in ~/.pyrit/.pyrit_conf. Keep these files out of version control and restrict their file permissions to the engineer running the tests. Confirm that PyRIT loads the configuration by running a single-prompt test against the model endpoint with a harmless input. The step is done when the test returns a response and no credential appears in the logs or the terminal history.

  4. Select and record the converter model

    Choose the model that will perform the rewrite, translation or tone change, and set it explicitly in the converter configuration rather than relying on a default. Record the model name, provider and version in the test plan, because the converter model changes the output and is part of the evidence. Ask the model provider which version is served behind the name and whether it changes without notice. The step is done when the converter instance names a specific model and that name is written in the plan.

  5. Run a small sample of objectives

    Load a small, fixed set of objectives, for example a handful of prompts written for the test, and pass them through the converter to the target. Keep the sample small enough to read every converted prompt by hand. Check that each converted text is in the language or tone the converter was configured to produce. Illustrative check: a translation converter set to French should return French text for every sample, and any prompt that comes back in English or unchanged should be logged as a converter failure. The step is done when every sample has been read and failures are listed.

  6. Inspect converted outputs in memory

    Open the PyRIT memory store, which keeps conversations and results in SQLite or Azure SQL, and query the stored entries for the sample run. Confirm that each original objective, its converted form, the target response and the converter model are recorded together. A missing converter model entry or a missing original prompt means the record cannot support a later review, so fix the configuration before continuing. The step is done when every sample run can be traced from the original objective to the target reply.

  7. Scale up with a cost and variability check

    Increase the number of objectives in stages, and after each stage repeat the language, tone and model checks on a sample. LLM-based converters add a model call for every prompt, so estimate the extra calls against the provider's pricing and ask the provider to confirm how usage is billed. Because the same input can produce different rewrites, run each set more than once where results will be compared. The step is done when the larger run finishes, the conversion checks still pass on the sample, and the team has the call count and the billing figure in its record.

How the converter model sits between the dataset and the target

The flow starts with seed objectives from a PyRIT dataset. Each objective passes to an LLM converter, which calls its own configured model with its own credentials, so the converter's model and the target under test are separate trust boundaries. The rewritten prompt, not the original, is what reaches the target. The target's response then goes to scorers, and memory records the original objective, the converted prompt, the response and the scores. Check that the converter model is not the target and that its data handling is acceptable before the first run.

Converter model, target and memory form separate records in each PyRIT test run.

Security and operational considerations for converter models

An LLM-based converter sends your prompt text to a model before the target sees it, so it adds a second model, a second set of credentials and a second place where data and records live. The cards below cover the controls to check in your own environment before running these converters on sensitive objectives.

Keep converter credentials out of version control

Converter models are configured with the same kind of API keys and endpoints as targets, usually read from ~/.pyrit/.env. Those files sit outside the project repository by default, but copies of notebooks, scripts and shell history can still expose keys. Check that no key appears in committed code, CI logs or pasted examples, and rotate any key that has been shared. Confirm which key scopes the converter model actually needs.

Converter docs

Review third-party model data handling

When the converter model is hosted by a vendor outside your environment, every objective you rewrite is sent to that vendor. Harmful test prompts can contain sensitive or regulated content, so the sending path itself is a data flow to document. Read the provider's data retention, training and logging terms for the API you use, and confirm them in writing. A local or self-hosted converter model keeps this data inside your boundary.

Plan retention for converted harmful text

The converted text is stored with the conversation in PyRIT memory, so a rewritten or translated harmful prompt persists after the run ends. Decide how long memory records are kept, where the SQLite or Azure SQL database lives and who can export it. Ask whether deletion of converted text is possible without removing scoring results you need for evidence. Document the retention rule before the first run.

Control access to CoPyRIT and shared memory

Tone and persuasion converters produce material that a reviewer may read, so anyone who can open CoPyRIT or the shared memory database can see both the original objective and its converted variants. Restrict access to named reviewers, separate team instances where possible and review group membership on a schedule. Confirm how your chosen deployment handles authentication before you add the team.

Log converter inputs for audit

An auditor who asks how a converted prompt was produced needs the original input, the converter type, the model and version used, and the output. Confirm that your memory setup records these fields for each converter step and not only the final prompt sent to the target. Store logs with the same access controls as memory, and test that a sample run can be traced end to end.

Questions teams ask before running LLM converters in PyRIT

How much effort does setting up LLM converters in PyRIT take?

Effort depends mostly on whether the team already runs PyRIT and has a model it can call. The converters themselves are configured in Python, so the work is choosing a converter model, storing its credentials, and wiring the converter into an attack. Teams that already use PyRIT with a target model usually find the extra step small. Teams starting from scratch also need to install PyRIT with a supported Python version, which the PyRIT documentation describes, and to set up credentials in ~/.pyrit/.env. Ask your engineers to confirm which environment they will use before estimating the work.

Can our team run LLM converters in PyRIT without outside help?

Yes, if the team has Python engineers who can read PyRIT's documentation and access to a model for the converter role. The open-source framework is free to use under the MIT license, so the main cost is staff time. Outside help is most useful when the team needs a repeatable test design, reviewers who read the languages being tested, or a review of how the converter output affects the target's responses. DeployOpen can plan and run that work as a fixed-scope engagement in infrastructure you control, with the scope agreed in writing before work starts.

What costs are one-time and what recurs with LLM converter calls?

The one-time costs are setup, configuration and the design of the test set. The recurring costs come from each run, because every converted prompt is a call to the converter model, and that model is usually billed per use by its provider. Each run also needs the target model calls, which add their own cost. Costs rise with the number of prompts, the number of converters chained together, and how many times the team repeats a run to check variability. Ask the team to estimate call volume per run and get the model provider's pricing before committing to a schedule.

How long does a first useful LLM converter run take?

The first useful run takes as long as it takes to get a working converter model, a small seed set, and a reviewer who can read the converted output. The duration is driven by credential setup, the size of the dataset, and how long the review of translated or rephrased prompts takes. A small illustrative run with a handful of prompts can be finished in a short session once the environment works. A full test with multiple languages and tones depends on review capacity more than on compute. No fixed duration is supplied for this work, so confirm the timeline with your team against your own dataset size.

What does the team need to provide for LLM converter testing?

Three things matter most. First, access to a converter model and a target model, with credentials stored where PyRIT can read them. Second, a dataset of seed prompts that reflects the harms you need to test, with the languages and tones you care about. Third, a reviewer who reads each language in the test set, because a converter can change meaning, drop detail, or fail to translate at all. Without that reviewer, the results cannot be trusted. Write these needs down before the run so the reviewer and the model owner agree on what a useful output looks like.

How should we choose the model used as the LLM converter?

Choose the converter model by its ability to produce faithful output in the languages and tones you test, and by whether your data may be sent to it. Compare candidate models on a small sample: check meaning preservation, consistency across repeated runs, and whether the model refuses to rewrite certain prompts, since refusals change what the test measures. Also record the model version, because a provider update can change output and make results hard to compare. Confirm the data handling terms with the provider and your security team before sending sensitive test prompts to any hosted model.

How DeployOpen scopes and delivers PyRIT converter testing

DeployOpen treats LLM-based rewrite, translation and tone converters as a testing method with its own cost, variability and evidence needs, not as a switch to flip. We agree the converter model, the languages and transformations in scope, and the scoring approach in writing before any test runs.

How we scope

  • Written scope lists which converters, target systems and harm categories the LLM-based converter testing covers.
  • Scope names the converter model, its provider and the data it may receive, agreed with your security team.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.

How we build

  • We configure PyRIT's translation, variation and tone converters against the model you approve.
  • We run repeated trials on each converted prompt, because LLM rewrites vary between runs.
  • We record converter settings, model versions and prompts in PyRIT memory so each result can be reproduced.

How we hand over

  • Findings report covers which transformations bypassed target defenses and how consistently they did.
  • Documentation includes converter configuration, model choice, cost drivers and the steps to rerun the tests.
  • We walk your team through the runbook so internal staff can repeat the tests after handover.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer for PyRIT deployments.
  • Retainers can cover re-running converter tests after target model changes or PyRIT upgrades.
  • Confirm with your team how converter model costs and usage limits will be tracked and approved over time.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.