Skip to content

Add Pinyin Mix converter for Chinese adversarial text transformations #2647

Description

@DvJiang

Is your feature request related to a problem? Please describe.

PyRIT provides a broad set of text-to-text converters, but I could not find an existing converter that specifically supports Pinyin-based transformations of Chinese text.

Recent work on Chinese LLM safety, such as CSSBench, identifies Pinyin mixing as a Chinese-specific adversarial pattern, where Chinese characters or spans are replaced with full or abbreviated Pinyin while keeping the text understandable.

I checked potentially related converters, including translation, character-noise, Unicode-based, and phonetic transformations, but they do not appear to provide the same Hanzi-to-Pinyin transformation.

Describe the solution you'd like

Add a text-to-text PinyinMixConverter for Chinese text.

An initial implementation could support:

  • Full Pinyin replacement
  • Abbreviated Pinyin replacement
  • Mixed Hanzi-Pinyin text
  • Configurable selection or proportion of text to transform

I would prefer to keep the initial implementation deterministic and focused, without requiring an LLM.

Describe alternatives you've considered, if relevant

I considered whether this behavior could be composed from existing PyRIT converters. However, translation changes the language rather than the writing representation, while character-noise and Unicode-based converters do not model Pinyin romanization.

If an existing converter or composition already covers this behavior, I would be happy to use or extend that instead.

Additional context

CSSBench studies Pinyin Mix alongside other Chinese-specific adversarial patterns and provides experimental evidence for this transformation in Chinese LLM safety evaluation:

https://arxiv.org/abs/2601.00588

I would be happy to implement the converter, unit tests, and documentation if the maintainers think this would be useful. Feedback on the converter naming and scope would also be appreciated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions