Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT Adding retry functionality to PromptSendingOrchestrator #467

Open
wants to merge 43 commits into
base: main
Choose a base branch
from

Conversation

blakebullwinkel
Copy link
Contributor

@blakebullwinkel blakebullwinkel commented Oct 14, 2024

Description

This PR adds the option in PromptSendingOrchestrator to re-send prompts based on the result of a scorer. For now, this is implemented using a SelfAskRefusalScorer, but in the future we may want to replace this with a generic Scorer and implement more general retry logic. We expose this functionality by adding one new arguments to the send_normalizer_requests_async method: max_retries. The example below shows how to retry until all responses are scored as False (i.e., non-refusal), up to a maximum of 5 retries.

send_prompts_async( 
        prompt_list=prompt_list,
        max_retries=5,
)

Thanks @rlundeen2 for the design and @romanlutz for the help with implementation!

Tests and Documentation

This change is documented in the GCG suffix demo in 1_auxiliary_attacks.ipynb but I have not written tests for it yet.

"""
first_prompt = prompt_list[0]
text_idx = None
for idx, prompt_piece in enumerate(first_prompt.request_pieces):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs unit tests added

Copy link
Contributor

@rlundeen2 rlundeen2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just re-worked PromptSendingOrchestrator so this may need some changes.

I think we should probably make this a subclass of PromptSendingOrchestrator, or make retrying a separate function. I think that would simplify things. So this could be PromptSendingWithRetriesOrchestrator.

The logic can stay the same for the most part, but you'd overwright/call PromptSendingOrchestrator.send_prompts_async and just do the retries in the parent function

Copy link

@corporate87 corporate87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...¿∆ΠΩμ*?.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...¿∆ΠΩμ*?.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...¿∆ΠΩμ*?.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...¿∆ΠΩμ*?.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...¿∆ΠΩμ*?.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants