Skip to content

FEAT: Add IPA transcription converter#2264

Merged
romanlutz merged 1 commit into
microsoft:mainfrom
romanlutz:romanlutz-adding-ipa-converter
Jul 24, 2026
Merged

FEAT: Add IPA transcription converter#2264
romanlutz merged 1 commit into
microsoft:mainfrom
romanlutz:romanlutz-adding-ipa-converter

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

PyRIT does not currently provide a way to transform prompts into pronunciation-based IPA text, which can be useful for testing obfuscated and multilingual inputs. This adds an LLM-backed IPAConverter that transcribes auto-detected source-language spans into broad International Phonetic Alphabet output without adding a pronunciation lexicon dependency.

The converter uses dedicated system and user templates to preserve the source meaning and structure, resolve pronunciations from context, transcribe names and technical identifiers, and treat embedded instructions as inert source text. It supports code-switched input and optional dialect guidance, and includes all behavior-changing prompt and dialect configuration in its identifier. IPA quality remains model-dependent, particularly for short or ambiguous input.

Tests and Documentation

Added focused unit coverage for target and dialect validation, automatic language detection guidance, prompt framing, response normalization, and identifier behavior. Updated the converter exports and modality reference, then executed the text-to-text converter notebook with JupyText so the committed notebook contains the real IPA example output.

The repository pre-commit suite passes, including Ruff, notebook linting, documentation validation, and type checking.

Add an LLM-backed converter that transcribes auto-detected source languages into broad IPA, with optional dialect guidance and injection-resistant prompt framing. Include exports, tests, and executed converter documentation.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b5298c46-792b-48d5-a119-c2c67af3ef47
@jsong468 jsong468 self-assigned this Jul 23, 2026
Comment thread pyrit/converter/ipa_converter.py

@jsong468 jsong468 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but wonder if you considered using a library like phonemizer instead of LLM?

@romanlutz

romanlutz commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

LGTM but wonder if you considered using a library like phonemizer instead of LLM?

I very much considered packages but concluded that they either

  • have very restricted licenses,
  • are not maintained anymore (or never were really maintained to start with),
  • don't work very well (LLM passed 100% of my custom test cases, none of the half dozen packages I tested passed more than 40%)
  • or get tripped up a lot by mixed languages and require input language specification. In many cases, we don't have that metadata.

@romanlutz
romanlutz added this pull request to the merge queue Jul 23, 2026
Merged via the queue into microsoft:main with commit b2ba7fd Jul 24, 2026
53 checks passed
@romanlutz
romanlutz deleted the romanlutz-adding-ipa-converter branch July 24, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants