BUG: LLMGenericTextConverter identifier changes between processes for set-valued template parameters
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
Research direction
Start in _describe_template_value in llm_generic_text_converter.py, around line 67, where set and frozenset values are handled like lists. Run the reproduction script twice with PYTHONHASHSEED set to 1 and to 2 and compare the identifier output. Done when the identifier matches across seeds and template rendering is unchanged, as the issue asks.
Written by the indexing model from the issue text.
Description
Describe the bug
_describe_template_value handles set and frozenset like a list (llm_generic_text_converter.py:67), so the identifier follows set iteration order. That order depends on PYTHONHASHSEED, so the same configuration gets a different hash in each process.
Steps/Code to Reproduce
Run on main at 5fb4fb977, once with PYTHONHASHSEED=1 and once with PYTHONHASHSEED=2.
import asyncio
from pyrit.converter import LLMGenericTextConverter
from pyrit.models import SeedPrompt
from pyrit.prompt_target import OpenAIChatTarget
from pyrit.setup import IN_MEMORY, initialize_pyrit_async
async def main() -> None:
await initialize_pyrit_async(memory_db_type=IN_MEMORY, silent=True)
target = OpenAIChatTarget(endpoint="https://example.invalid/v1", api_key="unused", model_name="model-a")
converter = LLMGenericTextConverter(
converter_target=target,
system_prompt_template=SeedPrompt(value="Use one of these tones: {{ tone }}", parameters=["tone"]),
tone={"alpha", "beta", "gamma", "delta", "epsilon", "zeta"},
)
print(converter.get_identifier().unique_name)
asyncio.run(main())
Expected Results
The same identifier in both runs.
Actual Results
PYTHONHASHSEED=1 LLMGenericTextConverter::34b80fa1
PYTHONHASHSEED=2 LLMGenericTextConverter::9136bd54
Versions
- OS: Windows 11
- Python version: 3.12.0
- PyRIT version: source checkout of
mainat5fb4fb977
System:
python: 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
executable: C:\dev\pyr-main\Scripts\python.exe
machine: Windows-11-10.0.26300-SP0
Python dependencies:
pyrit: 1.2.0.dev0
Cython: None
numpy: 2.4.6
openai: 2.54.0
packaging: 26.3
pip: 23.2.1
scipy: 1.17.1
setuptools: 84.2.1
sqlite3: None
torch: None
transformers: 5.20.2
The rendered prompt moves too when a template prints the set: {{ tone }} gives a different order under each seed. Sorting inside _describe_template_value fixes the identifier. Rendering is a separate call: leave it, or reject sets as template parameters.
- Dominant language
- Python
- Stars
- 4.7k
- Forks
- 1k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 450
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/PyRIT
-
Scenario objective previews can split supplementary Unicode during truncationPossibly taken @Aadithya-kl claimed this today. OpenBug: triage help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
microsoft/PyRIT#3870 · 1 comment ·
Maintainers usually reply within 2 days
-
URLDataTypeSerializer treats mixed-case HTTP(S) schemes as local pathsPossibly taken @akhil9tiet claimed this today. OpenBug: triage help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/PyRIT#3861 · 1 comment ·
Maintainers usually reply within 2 days
-
Parameter required status is lost after wire round-tripPossibly taken @its-amann claimed this today. OpenBug: triage help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/PyRIT#3854 · 1 comment ·
Maintainers usually reply within 2 days
-
BUG: SelfAskGeneral scorers leave their output keys out of the identifierPossibly taken @Hrushikesh-ramilla claimed this 1 day ago. OpenBug: triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
GUI rejects valid empty-string SearchReplaceConverter settings, preventing deletion convertersPossibly taken @Darshika140 claimed this 1 day ago. Openhelp wanted
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
microsoft/PyRIT#3749 · 3 comments · 1 assignee ·
Maintainers usually reply within 2 days
Similar issues
-
HandyModRTransform.deriv3 is wrong for m > 2Possibly taken @SajalDevX claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
read_messages: the first read after subscribe/psubscribe returns no messages even when some are waitingPossibly taken @matheussilvano claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
The-Swarm-Corporation/swarms-framework-docs#399 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
bump patch
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
autowarefoundation/autoware_carla_scenario#1321 ·
Maintainers usually reply within 1 day