citadel-ai / langcheck

Simple, Pythonic building blocks to evaluate LLM applications.
https://langcheck.readthedocs.io/en/latest/index.html
MIT License
184 stars 17 forks source link

More Augmentations #137

Closed liwii closed 1 month ago

liwii commented 2 months ago

Implemented more augmentations that could be useful for adversarial testing.

Discussion

For the jailbreak template augmentation, we introduced the additonal seed parameter, but seemingly for all the other augmentations the seed is given from outside implicitly by calling random.seed(seed). I used this style to add the seed to these new augmentations. Should we change the jailbreak_template or all the other augmentations for consistency?

liwii commented 1 month ago

@yosukehigashi

Ping on this!!

yosukehigashi commented 1 month ago

Wait did I miss this?! I don't remember seeing this before 😨

liwii commented 1 month ago

Ah wait I forgot to assign you as a reviewer... Sorry for the confusion!!

yosukehigashi commented 1 month ago

Haha ok phew 😮‍💨

yosukehigashi commented 1 month ago

For the jailbreak template augmentation, we introduced the additonal seed parameter, but seemingly for all the other augmentations the seed is given from outside implicitly by calling random.seed(seed). I used this style to add the seed to these new augmentations. Should we change the jailbreak_template or all the other augmentations for consistency?

I personally prefer it when the seed is an additional parameter, since it makes it clear that fixing the seed is a valid thing to do. It's also unclear sometimes how a seed should be set when it's from the outside, since it could be random, numpy, or torch's random number generator.

That said, I think we should allow the user to set the seed outside if they want to. So we should also update the code here to be

if seed is not None:
    random.seed(seed)
liwii commented 1 month ago

Your suggestion for seed looks good to me, added the parameter in that way.

Ready for review again!!

liwii commented 1 month ago

Added seed parameters to all the augmentations that use random. Let me merge the change now!!