microsoft / microsoft/PyRIT

GUI advertises TokenBijectionConverter without its required tokenizer

Open
#2,507 2 comments 0 reactions 1 assignee View on GitHub

@akshay-babbar is already working on this.

Since Sep 8, 2026.

Bug: triage
Dominant language
Python
Stars
4.5k
Forks
893
Avg merge
3d 50m
Merged PRs (30d)
165

Description

#### Describe the bug

The frontend converter picker advertises `TokenBijectionConverter`, but the GUI/API construction path cannot provide its required keyword-only `tokenizer`. The UI exposes only the optional `seed` parameter, so every preview attempt returns HTTP 500 and the converter cannot complete its primary GUI workflow.

`TokenBijectionConverter.__init__` requires a tokenizer with `get_vocab()`, while the converter catalog exposes only string-coercible parameters. The required tokenizer is therefore omitted from the catalog response before the frontend renders the form:

- [`converter_service.py` catalog projection](https://github.com/microsoft/PyRIT/blob/e9277c45ab136b39f9aca12745bb45746f7d9963/pyrit/backend/services/converter_service.py#L85-L108)
- [`converter_service.py` instance creation](https://github.com/microsoft/PyRIT/blob/e9277c45ab136b39f9aca12745bb45746f7d9963/pyrit/backend/services/converter_service.py#L131-L156)
- [`TokenBijectionConverter` constructor](https://github.com/microsoft/PyRIT/blob/e9277c45ab136b39f9aca12745bb45746f7d9963/pyrit/converter/bijection_converter.py#L337-L369)

**Recommended direction:** exclude or clearly disable this converter in the GUI for now rather than silently selecting a fixed tokenizer. The converter is documented as using the target model's tokenizer vocabulary, and the GUI supports heterogeneous targets without a serializable tokenizer configuration. A hard-coded tokenizer could therefore be incorrect or misleading for the active target and may also introduce an implicit model download.

A durable GUI implementation should make tokenizer choice explicit and backend-managed, for example through a supported tokenizer identifier/catalog with validation and a clear relationship to the active target. Until that exists, the catalog/UI should generically identify converters with required non-GUI-constructible parameters and avoid offering an action that can only fail.

#### Steps/Code to Reproduce

1. Activate any writable text target.
2. Open Chat and enter a prompt.
3. Open the converter panel and select `TokenBijectionConverter`.
4. Expand Parameters; observe that only `seed` is available.
5. Choose Preview.

Equivalent API behavior:

```text
POST /api/converters
{"type":"TokenBijectionConverter","params":{}}

HTTP 500
Failed to create converter: TokenBijectionConverter.__init__() missing 1 required keyword-only argument: 'tokenizer'
```

#### Expected Results

The GUI should never present an impossible converter workflow. Until supported tokenizer selection exists, `TokenBijectionConverter` should be excluded or shown as unavailable with an actionable explanation, and Preview should not issue a request that can only fail.

If GUI tokenizer support is added, the user should select a supported backend-managed tokenizer identifier, incompatible or unavailable choices should fail validation before creation, and a valid selection should preview successfully without an implicit arbitrary default.

#### Actual Results

The converter appears selectable and looks ready to use, but Preview makes two failed create attempts and reports:

```text
Failed to create converter: TokenBijectionConverter.__init__() missing 1 required keyword-only argument: 'tokenizer'
```

Digit and Letter Bijection converters preview and apply successfully in the same workflow, isolating the failure to Token Bijection construction.

#### Screenshots

N/A. The exact visible error and API response are included above.

#### Versions

- OS: Windows_NT
- Browser: Playwright Chromium (`@playwright/test` 1.62.1)
- Python: 3.14.4
- PyRIT: `1.1.0.dev0`, `main` at `e9277c45ab136b39f9aca12745bb45746f7d9963`
- Python package versions: repository `uv.lock` at the tested commit

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.