Repository navigation
FEAT: Add Garak LeakReplay training-data replay scenario - #3689
Open
barkha1research-ai wants to merge 1 commit into
Open
barkha1research-ai wants to merge 1 commit into
barkha1research-ai wants to merge 1 commit into
Conversation
Signed-off-by: Barkha <340367068+barkha1research-ai@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds a
garak.leak_replayscenario that ports garak's leakreplay probes (Chang et al. 2023, "Speak, Memory"). It has two techniques.clozesends a passage with one proper name replaced by[MASK]inside garak's few-shot prompt and asks for the name.completionsends only the text before the mask. Each request carries its masked name as anOutputMatchescondition. Cloze passes when the response contains the name, ignoring case, after<name>tags are removed. Completion passes when the stripped response starts with the name. These are the same checks as garak'sTriggerListDetectorandleakreplay.StartsWith.As mentioned in #3219, the passages are not bundled. Four remote loaders (
garak_leak_replay_literature,_potter,_nyt,_guardian) download the TSVs from the garak commit already pinned inthird_party/garak-provenance.json. They parse each line as one passage. garak's default csv quoting merges 185 lines ofbook_cloze.tsvinto 5 rows (NVIDIA/garak#278), so garak loads 1,239 passages instead of 1,419. The default run samples 20 requests, with at least one per technique and corpus;max_total="all"runs every request, like garak's*Fullprobes. I picked both techniques as the default because garak's active probes run both, but I'm happy to make it Cloze only, as ProPILE does with Twin, if you prefer.Fixes #3219.
Tests and Documentation
I added unit tests for the loaders and the scenario, a LeakReplay section in
doc/scanner/garak.py/.ipynb, the dataset names in1_loading_datasets, and thechang2023speakreference. The notebook output comes from a run against a local Ollama model (llama3.1:8b). I also compared the generated prompts and pass/fail decisions with garak's own probe and detector code at the pinned commit, and they matched.pytest tests/unitpasses apart from onetest_attack_analyticscase that also fails onmain, andpre-commitpasses on the changed files.