Testing training data replay with garak's leakreplay probes

garak's leakreplay probes check whether a model reproduces literature and news text it may have been trained on, and a hit raises data governance questions you need to answer before release.

On this page

How garak's leakreplay probes test training data replay

If your team hosts or fine-tunes a model and must show whether it reproduces copyrighted or sensitive training text, garak's leakreplay probes give you a repeatable first check. They ask the model to replay excerpts from the kinds of text it may have seen during training, and they report whether the output matches the source. A hit is evidence that the model can regurgitate that material, not proof of how it was trained. The leakreplay source describes cloze and completion variants built on literature, New York Times, Guardian and Harry Potter excerpts, so the probes cover a small set of well-known sources rather than your own corpus.

garak is released under the Apache 2.0 license, and you install it from PyPI with pip on Python 3.11 or newer. The leakreplay probes belong to the data leakage family in the garak user guide, which means they sit alongside the other probes that test whether a model discloses information it should not. Before you run them, confirm which generator you will use (a hosted API, a local model, or your own REST endpoint), because the replay behavior depends on the exact model and decoding settings you deploy. Record those settings with the run so that a later rescan can be compared against the same configuration.

Plan the governance decision before the first scan. A hit on a public novel or newspaper article raises a different question from a hit on a document your organization licensed or holds under confidentiality, so agree in advance who reviews results, which sources count as sensitive for your organization, and what evidence the legal and data governance teams need. Because the probes use a fixed set of excerpts, a clean result does not show that a model never saw other protected material. Ask your legal team and model provider what they can confirm about the training data, and treat garak output as one input to that review rather than the final answer.

Which leakreplay settings fit which review goal

This table compares four settings decisions: probe scope, generations per prompt, hosted versus local target, and routine versus one-off runs. Read each row for what the choice answers and what it adds to run time and report size, since garak writes a JSONL record of every attempt. The main takeaway is that a broad scope with default generations gives the most evidence but the largest report, so match the setting to the question you need answered.

DecisionWhat it answersRun time and report size
All leakreplay probesWhether any covered source family (literature, NYT, Guardian, Harry Potter) is replayedLongest run. Largest JSONL report because every family adds attempts
Single source familyWhether one corpus, such as news text, is reproduced, for a targeted reviewShorter run and smaller report. Misses replay of other families
Default 5 generations per promptWhether any of five attempts reproduces an excerpt, which suits evidence collectionHighest per-prompt cost. Five records per prompt in the report
Fewer generations for a quick checkWhether the model shows obvious replay, as an early signal before a full runFaster and smaller. A clean result is weaker evidence because fewer attempts were made
Hosted endpointWhether the deployed service, with its own system prompt and filters, replays training textDepends on provider rate limits and network latency. Confirm limits and costs with the provider
Local modelWhether the weights themselves reproduce text, with no hosted filters in the pathDepends on your hardware and model size. Needs capacity planning before scheduling
Routine scanWhether replay changes after a model update, using the same settings each timeRepeatable and scheduled. Store reports so runs can be compared over time
One-off evidence runWhether a specific model version meets a documented review question, with full settings recordedRun once with complete settings, full report kept as review evidence. Confirm retention needs with your compliance team

Running a leakreplay scan step by step

This sequence takes a team from a clean Python environment to a leakreplay run against one model, with a checked generator and a readable JSONL report. Each step ends with a check so that a failure is caught before the scan spends time on prompts that cannot succeed.

  1. Install garak in a Python 3.11 environment

    Create a virtual environment on Linux or macOS running Python 3.11 or newer, then install garak from PyPI with pip. Garak is a command-line tool, so the installation is done once per scanning host, and the same environment should be reused for every later run so results stay comparable. The step is complete when python -m garak --help prints the command options without errors.

  2. Confirm the installed garak version

    Record the installed version before any scan runs, because probe content and detectors can change between releases and a score shift may come from the tool rather than the model. Check the version against the release notes on the NVIDIA/garak GitHub releases page. The step is complete when the version is written into your scan notes alongside the date and the Python version used.

  3. Configure the generator for the target model

    Choose the generator that matches where the model runs: Hugging Face Hub, OpenAI, AWS Bedrock, LiteLLM, llama.cpp for gguf files, or a REST endpoint described in a short YAML file. Provide credentials through environment variables rather than inline values, and confirm that the target is the model variant your organization actually deploys. The step is complete when a one-prompt test call returns a response from the target, and the generator name and model identifier are recorded.

  4. List the leakreplay probes before scanning

    Run garak's probe listing and filter for the leakreplay family so you can see exactly which probes will execute. The leakreplay probes cover literature, NYT, Guardian and Harry Potter text with cloze and completion variants, and the list shows each one by name. Save the listing with the scan notes. The step is complete when the count of listed probes matches the number of leakreplay probes you intended to select, and any mismatch is investigated before the run.

  5. Run the leakreplay scan against the target

    Start the scan with the generator configuration and the selected leakreplay probes, keeping the default harness unless you have a documented reason to change it. By default garak makes 5 generations per prompt and marks a probe as FAIL when any attempt produces undesirable output, so keep that setting unchanged for a baseline. The step is complete when the run finishes without generator errors and the console reports the probes that were executed.

  6. Check the generator responded to every attempt

    Before reading any result, scan the log for failed generator calls, timeouts, rate-limit responses or empty outputs. Empty or error responses can look like passes, so a clean-looking result set is not evidence of a clean model until these errors are ruled out. The step is complete when the attempt count in the report matches the probes multiplied by the generations per prompt, with no unexplained gaps.

  7. Inspect the JSONL report and garak.log

    Open the JSONL report written by the run, which holds every attempt and its evaluation, and locate the leakreplay entries with their prompts, outputs and verdicts. Then read garak.log, which is continued across runs, to confirm the run's own entries are separated from earlier ones. The step is complete when each flagged attempt can be traced to its prompt, its output and the probe that produced it, and the log shows no unresolved errors for this run.

What a leakreplay hit means for data governance

A leakreplay hit is a signal about one model and one text, not a verdict on how the model was built. The cards below separate what a hit shows from what it does not, and set out the records and reviews a governance team should attach to it before deciding on any fix.

A hit shows reproduction, not unlawful training

A leakreplay hit means the model completed a specific excerpt closely enough that the detector judged it a match. It shows the model can reproduce that passage. It does not show how the passage entered the training data, whether it was copied without permission, or whether any licence was breached. Record the exact prompt, the model output and the detector result, and avoid describing the finding as proof of infringement in internal or external documents.

leakreplay probe source

Check corpus provenance against licence records

Once a hit is confirmed, trace the matching text back to the training corpus. Ask the model provider or your fine-tuning team which datasets were used, and whether each source carries a licence, a terms-of-use permission or a documented consent basis. Where that record is missing, the hit becomes a provenance gap to close, not only a model behaviour issue.

Text category drives legal review

Literature, news and other copyrighted categories carry different legal exposure, and the leakreplay probes target exactly those categories. A replayed news article or book chapter should go to counsel with the provenance record attached. Low-risk public domain text may only need an engineering note. Let the category of the reproduced text decide which reviewer sees the finding first.

Evaluate mitigations as options

Deduplication of the training corpus, content filtering before training, and unlearning methods after training are all possible responses. Each has a different cost and a different proof burden, and none is guaranteed to remove a specific passage. Ask the team to state which option they are evaluating, what re-test would show it worked, and who approves the trade-off against model quality.

Log repeated hits in the governance file

A single hit is a finding. The same passage reproduced across several runs, model versions or sampling settings is a pattern that governance should track. Record each run's date, the garak version used, the probe set and the outcome in the governance file, so that a later review can see whether a mitigation changed the result. garak writes a JSONL report for each run that can be filed alongside these notes.

How a leakreplay scan flows from probe to governance review

The scan starts with the operator running the garak command-line tool, which loads the leakreplay probes and sends their cloze and completion prompts through a generator to the model endpoint. The model's replies return to garak, where the probe's detectors score each attempt. The results land in a JSONL report and the garak.log file, and those files are what the data governance and legal reviewers receive. The trust boundary covers the model endpoint and the report storage, because both can hold text drawn from the training corpus. Check who can read the report and how long it is kept before it leaves the scanning environment.

Data path for a leakreplay scan, with trust boundaries around the model and stored reports.

Handling the excerpts and reports safely

A leakreplay scan sends literary and news excerpts to a model and writes the model's replies to disk, so the same evidence can carry copyrighted text, sensitive output and credentials. The cards below cover what to protect, where to keep it, and how long to keep it.

Replayed copyrighted text

The leakreplay prompts quote passages from books and newspapers, and a model that completes them may return long verbatim stretches. Treat both the prompts and any completions as copyrighted material that your team has copied into its own systems. Ask counsel how your organization's copyright position applies to storing excerpts for testing, and limit who can open the raw attempts that contain them.

Reports and log contents

The JSONL report records every attempt along with the model output and its evaluation, and garak.log is continued across runs for debugging. Both can therefore hold model output that is sensitive in its own right, even when the probe itself is benign. Store them in a restricted location with access limited to the people who review results, and do not paste them into tickets or chat channels.

garak README

API keys in generator configs

A generator configuration for a hosted model or a REST endpoint usually contains an API key or token. Keep keys out of configuration files committed to source control, supply them through environment variables or your secrets manager, and rotate them after any shared scan. Confirm in the user guide how garak reads credentials before you decide where to store them.

garak user guide

Air-gapped and self-hosted targets

If the model under test is a self-hosted or air-gapped model, prompts and completions never leave your boundary, which keeps the replayed excerpts and any recalled passages inside your own network. Confirm that the generator you choose can reach your endpoint without an outbound internet connection, and that any package or model download happens on a controlled path before the scan begins.

Retention of scan evidence

A scan result is evidence that a model did or did not reproduce training text, so it may need to be kept for review. Decide before the first run how long reports and logs are kept, who approves deletion, and whether raw completions are kept or only the evaluation summary. Write those rules into your data governance policy so that the retention period is not chosen after a hit has already been found.

Questions teams ask before running leakreplay

How much effort does a first leakreplay scan take?

The scan itself is short once the model endpoint is reachable, because garak is a command-line tool installed from PyPI with pip and it requires Python 3.11 or newer. Most of the effort sits elsewhere: hosting or reaching the model, agreeing which generator configuration represents production, and reviewing the hits. The work drivers are:

  • Model hosting: a local model needs compute, while a hosted API needs keys and rate-limit planning.
  • Endpoint access: a REST endpoint needs a short YAML description, which an engineer who knows the API can write.
  • Review time: each hit needs someone to check whether the text is a true replay and whether it matters.

Ask for the effort split in any quote so you can see which part is fixed and which part grows with the number of models.

Can an internal team run leakreplay without outside help?

Yes, for the mechanics. Your engineers can install garak, point it at the model, run the leakreplay probes and read the JSONL report that each run writes. Interpreting the result is harder. Deciding whether a replayed passage is a copyright problem, a confidentiality problem or a harmless quotation requires legal input, and deciding what the model owner must do next requires data governance input. Many teams keep the scan in-house and bring in counsel and a data owner for the review step. DeployOpen can run the scan and prepare the findings for that review as part of a fixed-scope engagement.

What do we need to provide before the scan starts?

Three inputs make the scan useful:

  • Model access: an endpoint or local copy of the exact model and version you plan to use, with the settings your users see.
  • A named data owner: someone who knows what the model was trained on or fine-tuned with, and who can accept or reject the findings.
  • Legal input: a contact who can say which documents are sensitive, which licenses apply and what a hit should trigger.

If the training corpus is unknown to you, say so early. The findings then describe replay of public literature and news text, not your own data.

How often should we rerun leakreplay?

Rerun it whenever the model changes in a way that could alter what it memorized. That includes a new base model version, a fine-tune, a change in quantization or serving configuration, or a switch to a different provider for the same model name. Scheduled reruns are a sensible addition for models that change often, but the trigger should be the model change itself. Keep the same probe set and generator settings between runs so the results are comparable, and note that garak upgrades can shift scores on their own.

Does garak itself carry a license or subscription cost?

garak is licensed under Apache 2.0 and the maintainers describe it as a free tool, so the software itself carries no license fee. The costs you should expect are compute, meaning the GPU or hosted API calls used to generate replays, and the staff time to configure runs, review hits and act on them. Hosted API usage is billed by the provider, so ask your team to estimate the number of prompts and generations before running the full set. Any consultancy fee depends on the written scope and is quoted separately.

What does a leakreplay hit actually prove?

A hit shows that the model reproduced text from a supplied excerpt when given a cloze or completion prompt. It is evidence that the text may have been memorized, but it does not prove how the text entered training or whether the output is distributed to users. Engineers should check the matched passage, the number of generations that produced it and whether the same text appears in other runs. Legal and data owners then decide whether it is a concern under copyright, contract or confidentiality rules. The garak source for the probe lists the literature, NYT, Guardian and Harry Potter variants used.

Can leakreplay results be used as compliance evidence?

A scan result is testing evidence of what the model reproduced on the day you ran it. It is not an audit opinion, and DeployOpen does not issue audit reports or certifications. An independent auditor decides whether the evidence satisfies a given framework. Ask your auditor early which records they expect, such as the scan configuration, the model version, the JSONL report and the review decisions, and keep those together for each run.

When to bring in outside help for training data replay

Run leakreplay in-house when two conditions hold: your team has direct model access, and a named governance owner can decide what a hit means for the model and the data behind it. In that setup, the team can run the probes against the model, read the JSONL report that garak writes for each run, and keep the garak.log file across runs so results stay traceable. The owner then decides whether a reproduced passage is a documentation gap, a licensing question, or a reason to hold a release. Most teams in this position can start with a scan and a short review meeting, without outside support.

Bring in a partner when the findings must feed a formal file or a gate. Typical triggers include a model release checklist that requires documented testing before sign-off, an assessor who asks how a training data claim was verified, or a board-level risk register that needs repeatable scope and evidence. In these cases the work changes from running probes to defining scope in writing: which models and endpoints are covered, which leakreplay variants and source texts are included, how the runs are configured and repeated, how results are retained, and who signs off on remediation. DeployOpen plans and delivers this kind of fixed-scope engagement, and it does not issue audit reports or attestations. Confirm with your assessor which evidence format they accept before work starts.

How DeployOpen scopes a training data replay review

A DeployOpen review of training data replay starts from a written scope and ends with findings, fixes and a retest. The cards below cover what gets agreed up front, what the testing covers, and what the output can and cannot be used for.

Written scope before testing

Engagements are fixed-scope, so the models, endpoints, document corpora and time window are agreed in writing before any prompts are sent. For leakreplay work, the scope should name which models and versions are in play, which text families are tested (literature, news or other), and whether the target is a bare model or an application with a system prompt. Ask for the scope document and check it matches the systems you actually run.

Testing of the AI system itself

Security testing of AI systems is a DeployOpen service, so the replay probes run against the deployed model or application in your environment, with the generator configured to match how users reach it. Testing a bare model and testing the production endpoint can give different results, because filters and system prompts sit between the model and the user. Confirm which path the review will cover.

Findings, fixes and retest

Each finding is delivered with the evidence needed to act on it, along with recommended fixes. For a replay hit, fixes may involve data handling changes, output filtering, model selection or a documented risk acceptance. Retesting after the fixes is part of the scope, so you can show the same probes no longer reproduce the flagged text.

Evidence for compliance reviews

DeployOpen prepares systems, controls and evidence for compliance assessments, including the records a data governance team needs to explain how training data was checked. DeployOpen does not issue audit reports, attestations or certifications. Independent auditors and certification bodies make those determinations, so confirm early which evidence your assessor will accept.

Pricing from the written scope

DeployOpen does not publish a price list. A quote follows from the written scope, so the inputs that move cost are the number of models, the depth of retesting and whether the work is one-time or an ongoing retainer. Ask for the quote to list each deliverable and each retest separately so you can compare it with the effort of running garak in-house.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.