|
105 | 105 | "name": "stderr", |
106 | 106 | "output_type": "stream", |
107 | 107 | "text": [ |
108 | | - "/home/sharifm/students/matanbentov/my_conda/envs/default/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py:2249: UnsupportedFieldAttributeWarning: The 'repr' attribute with value False was provided to the `Field()` function, which has no effect in the context it was used. 'repr' is field-specific metadata, and can only be attached to a model field using `Annotated` metadata or by assignment. This may have happened because an `Annotated` type alias using the `type` statement was used, or if the `Field()` function was attached to a single member of a union type.\n", |
| 108 | + ".../site-packages/pydantic/_internal/_generate_schema.py:2249: UnsupportedFieldAttributeWarning: The 'repr' attribute with value False was provided to the `Field()` function, which has no effect in the context it was used. 'repr' is field-specific metadata, and can only be attached to a model field using `Annotated` metadata or by assignment. This may have happened because an `Annotated` type alias using the `type` statement was used, or if the `Field()` function was attached to a single member of a union type.\n", |
109 | 109 | " warnings.warn(\n", |
110 | | - "/home/sharifm/students/matanbentov/my_conda/envs/default/lib/python3.10/site-packages/pydantic/_internal/_generate_schema.py:2249: UnsupportedFieldAttributeWarning: The 'frozen' attribute with value True was provided to the `Field()` function, which has no effect in the context it was used. 'frozen' is field-specific metadata, and can only be attached to a model field using `Annotated` metadata or by assignment. This may have happened because an `Annotated` type alias using the `type` statement was used, or if the `Field()` function was attached to a single member of a union type.\n", |
| 110 | + ".../site-packages/pydantic/_internal/_generate_schema.py:2249: UnsupportedFieldAttributeWarning: The 'frozen' attribute with value True was provided to the `Field()` function, which has no effect in the context it was used. 'frozen' is field-specific metadata, and can only be attached to a model field using `Annotated` metadata or by assignment. This may have happened because an `Annotated` type alias using the `type` statement was used, or if the `Field()` function was attached to a single member of a union type.\n", |
111 | 111 | " warnings.warn(\n" |
112 | 112 | ] |
113 | 113 | }, |
|
315 | 315 | "### 2b. Multi-instruction optimization\n", |
316 | 316 | "\n", |
317 | 317 | "As another variant of the recipe, which is considered to create more _universal_ jailbreak suffix, you can \n", |
318 | | - "pass multiple templates to optimize a single trigger against them all of them simultaneously." |
| 318 | + "pass multiple templates to optimize a single trigger against all of them simultaneously." |
319 | 319 | ] |
320 | 320 | }, |
321 | 321 | { |
|
457 | 457 | ], |
458 | 458 | "source": [ |
459 | 459 | "# Embed multiple Harry Potter queries and average them into a \"concept\" centroid.\n", |
460 | | - "# A trigger optimized toward this centroid will steer an attacker-controlled\n", |
| 460 | + "# A trigger optimized toward this centroid will steer an attacker-controlled passage toward these queries in retrieval.\n", |
461 | 461 | "hp_queries = [\n", |
462 | 462 | " \"Who is Harry Potter?\",\n", |
463 | 463 | " \"Tell me about the Harry Potter series.\",\n", |
|
845 | 845 | ], |
846 | 846 | "source": [ |
847 | 847 | "# Optimize a trigger appended to an off-topic passage so that its\n", |
848 | | - "# OpenAI embedding aligns with the embedding of `target_text`.\n", |
| 848 | + "# OpenAI embedding aligns with the target centroid (`target_vector`).\n", |
849 | 849 | "loss = SimilarityLoss() # minimizes −cosine_similarity → maximizes alignment\n", |
850 | 850 | "\n", |
851 | 851 | "optimizer = RandomSearchOptimizer(\n", |
|
875 | 875 | "\n", |
876 | 876 | "In TROPT you can also easily customize losses and build new optimizers.\n", |
877 | 877 | "\n", |
878 | | - "Concretely, to create a new loss, you implement its core computation logic, accepting standardized parameters (resolved from `[ModelInput](https://tropt.dev/api/common.html#tropt.common.ModelInput)`, `[ModelOutput](https://tropt.dev/api/common.html#tropt.common.ModelOutput)`, and `[MessageTargets](https://tropt.dev/api/common.html#tropt.common.MessageTargets)`), with no registration required.\n", |
| 878 | + "Concretely, to create a new loss, you implement its core computation logic, accepting standardized parameters (resolved from [`ModelInput`](https://tropt.dev/api/common.html#tropt.common.ModelInput), [`ModelOutput`](https://tropt.dev/api/common.html#tropt.common.ModelOutput), and [`MessageTargets`](https://tropt.dev/api/common.html#tropt.common.MessageTargets)), with no registration required.\n", |
879 | 879 | "Similarly, implementing a new optimizer requires defining its core search algorithm around a compact interface that connects it to TROPT's framework — fitting it with all compatible models, losses, etc.\n", |
880 | 880 | "\n", |
881 | 881 | "Below we define both from scratch and run them against an encoder model.\n", |
|
0 commit comments