Guides#

TROPT can be used at three levels of customization:

  1. Run an existing recipe from the Recipe Hub: a single function call that runs an end-to-end attack (jailbreak, corpus poisoning, prompt recovery, etc.).

  2. Compose your own recipe: wire a Model + Loss + Optimizer + Input Setup of your choice into a custom function, with optional trackers, token constraints, and FLOP budgets.

  3. Extend TROPT with new components — write a new loss, optimizer, or model backend in your own script. Any new component you build can be simply dropped into an existing recipe.

For an end-to-end notebook walkthrough see the quickstart.ipynb notebook. If you want to contribute a component back to the TROPT package itself, see CONTRIBUTING.md.

Run a Recipe

Call a Recipe Hub entry with one function. Covers the available recipes and what arguments each expects.

Running a Recipe from Recipe Hub
Compose a Recipe

Compose a Model + Loss + Optimizer + Inputs/Targets into a custom recipe.

Composing a Recipe
Add a Loss

Define a new objective.

Building a New Loss
Add an Optimizer

Implement a discrete search algorithm.

Building a New Optimizer
Add a Model

Plug in a new model backend (HF, OpenAI, …).

Adding a New Model
Compatibility Matrix

Auto-generated map of which Optimizer × Loss × Model combinations are valid.

compatibility_matrix