Why glitch token testing with garak belongs in an LLM scan plan
Imagine a team about to ship a model or fine-tune built on a specific tokenizer, and the open question is whether unusual inputs make it behave oddly. garak's glitch module answers that question: it sends glitch tokens to the model and reports where the output shows unusual behaviour. Glitch tokens are the inputs to test, and the report is the evidence. The module is one probe family among many in garak, so it is a targeted check rather than a complete scan.
garak, the Generative AI Red-teaming and Assessment Kit, is a command-line tool licensed under Apache 2.0 and developed in the NVIDIA GitHub organization. It is built from plugins in five categories: probes, detectors, evaluators, generators and harnesses. Probes send prompts, detectors score the responses, and the default probewise harness runs each probe with its recommended detectors. The glitch probes are one probe family alongside jailbreak, encoding, prompt injection and data leakage probes, so they are chosen by the same planning logic as the others. The garak user guide explains how probe families and detectors are selected.
For the scan plan, the practical question is when glitch probes belong in the run at all. Tokenizer-specific models and fine-tunes are the strongest case, because their vocabularies and training data differ from the base model in ways the team may not have reviewed. Confirm with your model provider or training team which tokenizer and base model you are running, and whether the fine-tune changed behaviour on rare tokens. Then decide whether glitch probes run in the baseline scan, in a pre-release gate, or on each model update. Record the garak version used, since probe sets change between releases.
How the glitch probe fits into a garak run
The run starts when the garak command line selects the glitch probes from the glitch module. Each probe sends its prompts through a generator, which is either a built-in model connector or a REST generator that calls your endpoint. The responses then pass to the detectors recommended for each probe, and every attempt and its evaluation is written to the JSONL report, while garak.log keeps debugging detail across runs. Check that the generator points at the same model build you intend to test, and that the report records the probe and detector names you expected.
The glitch probes flow through a generator and detectors into the run's report and log.
Glitch probe options and when each fits
This table compares the main setup choices for glitch token testing: a standalone glitch run or a broader scan, the default probewise harness or custom configuration, and a base model or a fine-tune or quantized build. Read each row as a decision with its trade-off, and use the main takeaway to match the setup to the model's tokenizer history and deployment path.
| Choice | Option | Trade-off | When it fits |
|---|---|---|---|
| Scope of run | Glitch probes alone | Fast and focused, but gives no view of other weaknesses in the same model | Checking a tokenizer-specific model or a fine-tune where unusual token behaviour is the main question |
| Scope of run | Glitch probes inside a broader scan | Adds runtime and report volume, but places glitch results beside other probe families | Release gates where glitch behaviour is one of several signals reviewed together |
| Harness | Default probewise harness | Runs each probe with its recommended detectors, so setup is quick and results are comparable with other scans | First pass on a new model, or when comparing against earlier default runs |
| Harness | Custom configuration | Gives control over generations and detectors, but results must be documented so later runs stay comparable | Repeatable scans in CI or where the team has reviewed detector choices for the model |
| Target | Base model | Shows the tokenizer and pretraining behaviour the model shipped with | Establishing a baseline before fine-tuning or quantizing |
| Target | Fine-tune or quantized gguf build | Can change token handling and output, so results may differ from the base model | Confirming that the deployed artifact, not only the upstream model, behaves as expected |
| Generations | Default of 5 generations per prompt | Catches intermittent behaviour, at the cost of more calls to the target | Models where unusual output may appear only sometimes |
How to set up a glitch token scan with garak
This sequence takes a team from a clean Python environment to a completed glitch token probe run with a readable JSONL report. Each step ends with a check so the scan can be trusted before anyone reads its results.
Confirm the Python version and environment
The engineer running the scan confirms the host runs Python 3.11 or newer and creates an isolated virtual environment for garak so its dependencies do not collide with other tooling. garak is developed on Linux and macOS, so the scan host should be one of those. Done means the interpreter version prints 3.11 or higher from inside the new environment. If the host runs a different operating system, confirm support with the garak maintainers before planning the scan there.
Install garak from PyPI
The engineer installs the garak package with pip into the virtual environment and records the exact version used, because report comparisons depend on it. The current release line is documented in the project's GitHub releases, so pin the version your team has reviewed rather than installing whatever is newest. Done means the garak command runs and reports the installed version, and the version is written into the scan record.
Choose the generator for the target model
The engineer selects the generator that matches the model under test: Hugging Face Hub, OpenAI API, AWS Bedrock, LiteLLM, llama.cpp for gguf models, or a REST endpoint described in a short YAML file. Glitch tokens are tokenizer-specific, so the generator must send the model's own tokenizer path, not a convenience wrapper that rewrites input. Done means a single test prompt returns text from the target through the chosen generator, and the model identifier and endpoint are saved in a config file for repeat runs.
Confirm the glitch probe list
The engineer lists the probes available in the installed version and confirms the glitch module is present and which probes it contains. Probe names can change between releases, so the scan plan should cite the exact names from this listing. Done means the glitch probe names appear in the output of the probe listing command, and the names are recorded alongside the garak version.
Run the glitch probe against the target
The engineer runs the selected glitch probe against the target generator with the default probewise harness, so each probe runs with its recommended detectors. The default of 5 generations per prompt applies unless the plan changes it. Done means the run finishes without aborting and the terminal shows a per-probe result line with a pass or fail status for each probe in the run.
Review garak.log for generator errors
Before trusting any result, the engineer opens garak.log, which continues across runs, and searches for generator errors such as failed authentication, rate limit responses, timeouts or empty completions. A probe that returned errors instead of model output does not show the model is safe. Done means the log contains no unexplained generator failures for the run, or the affected prompts are rerun and documented.
Read the JSONL report for each attempt
The engineer opens the JSONL report written by the run and reads the attempts for each glitch probe, including the prompt, the model output and the detector evaluation. A FAIL status with a failure rate means at least one attempt produced output the detector flagged as unusual. Done means each flagged attempt has been read in full, with the failure rate and the number of attempts recorded in the scan notes for comparison in later runs.
How to read glitch probe results before acting on them
A FAIL from a glitch probe is a detector verdict, not a confirmed defect. garak marks a probe as FAIL with a failure rate when any of the default 5 generations per prompt produces output the detector flags, so a single unusual completion can drive the result. Before reporting anything, open the JSONL report and read the attempts themselves. For each flagged attempt, check the prompt, the raw model output and the detector's reasoning. Then classify it as a real defect where the model consistently derails on the glitch token, a detector false positive where the output is ordinary text the detector misread, or an artifact of sampling where one stochastic generation went wrong and the others did not.
Sampling settings are the main source of artifacts. If you changed temperature, top-p, max tokens or the generation count between runs, the failure rate is not comparable to earlier results. Re-run with the same generator configuration and a fixed number of generations, and see whether the same glitch prompts fail again. A glitch that reproduces across repeated runs deserves a closer look than one that appears once. Keep the garak.log file from each run so you can trace the configuration that produced each result.
Compare runs only when the model version, tokenizer, quantization and generator settings match, and record the garak version used for every run. The garak releases page lists changes between versions, and scores can move after an upgrade, so a shift between two runs on different garak releases is not evidence that the model changed. Confirm the garak version with the team that maintains your scan pipeline, store it alongside the report, and re-run a baseline on the new version before treating any difference as meaningful.
Security and operational considerations for glitch scans
Glitch probes send unusual token sequences that often produce strange output, so the scan itself needs the same controls as any other security test. The cards cover where results live, how credentials and paid endpoints are handled, and how test traffic and unusual outputs are kept away from production and people who should not see them.
Keep reports in controlled storage
Each run writes a JSONL report of every attempt and its evaluation. For glitch scans, those attempts contain unusual token sequences and the model's raw replies, which can include fragments of internal prompts or data the model memorised. Store reports in a location your security team controls, with access limited to the people reviewing results, and confirm where the files land on the scan host before the first run.
garak READMEHandle API keys for hosted generators
Hosted generators such as OpenAI API models and AWS Bedrock need credentials on the machine running garak. Load keys from your secrets manager or environment at run time instead of writing them into YAML configuration files that might be committed to version control. Use a key scoped to test use, rotate it on your normal schedule, and confirm that garak logs and reports do not echo the key.
Plan cost and rate limits on paid endpoints
Every glitch prompt sent to a hosted model is billed like any other request, and garak's default of 5 generations per prompt multiplies that volume. Ask the provider for your rate limits and spending caps before the scan, and set a conservative concurrency so a probe run does not exhaust a shared quota that your production application depends on.
Keep test traffic off production
Glitch prompts are deliberately odd, and a model may respond unpredictably to them. Point garak at a staging deployment, a separate API key, or a dedicated model instance, and confirm that test traffic cannot reach customer sessions, shared caches or logging pipelines that feed production analytics. Label test requests so they can be filtered out later.
Retain garak.log across runs
garak.log is continued across runs rather than reset, so it holds a running record of configuration, errors and endpoint behaviour. Keep it alongside the reports it explains, and set a retention period that matches your other test records. When a glitch result is disputed later, the log shows which probes, generators and settings produced it.
Review unusual outputs safely
Some glitch responses may contain offensive text, malformed markup or sequences that could disrupt a terminal or log viewer. Have reviewers open reports in a text viewer rather than rendering them in a browser or terminal, avoid copying raw output into tickets without review, and record which outputs were confirmed as meaningful before sharing findings beyond the test team.
Questions teams ask about glitch token testing with garak
Should glitch token probes run in every garak scan?
No. Glitch probes belong in a scan plan when the model's behaviour depends on its tokenizer or when it has been fine-tuned, because those are the conditions under which unusual token sequences are most likely to trigger odd output. For a general-purpose hosted model accessed through an API, the glitch module is usually a targeted addition rather than a core part of the routine. Include it when you are evaluating a self-hosted model, a fine-tune on a custom vocabulary, or a model whose tokenizer you have changed. Treat a clean glitch run as evidence about those specific behaviours only, not as a general statement about model safety. Your scan plan should state the reason the probe is included so that reviewers can later see why it was run.
What drives the effort and cost of a glitch token test?
The main drivers are the generator you choose, the endpoint you test, and the time a qualified person spends reviewing results. Running garak itself is free under its Apache 2.0 license, so your costs come from compute or hosted inference, from the people who configure the endpoint and interpret the report, and from any outside support you buy. If you call a metered API, every generation is billed, so the default of 5 generations per prompt multiplies your spend. Local models shift cost toward GPU time and hardware. Ask any partner for a quote that separates setup, the run itself, and reviewer time, and that states which items are one-time and which recur on each rescan.
How long does a glitch token run take?
No run duration has been supplied for this topic, so measure it in your own environment before planning. The duration depends on the number of glitch prompts in the probe configuration, the generations per prompt, the latency of your endpoint, any rate limits, and whether you run requests in parallel. A local model on a dedicated GPU will behave differently from a rate-limited hosted API. Run a small subset first, time it, then extrapolate to the full probe set. Record the configuration with the timing so that a later rescan can be compared fairly.
What does my team need to provide for glitch token testing?
You need access to the model or application endpoint, a working configuration that tells garak how to call it, and a named reviewer who understands the model's purpose. For a hosted model, that means an API key with rate limits you are willing to accept. For a self-hosted model, it means a reachable inference endpoint or a local model file that garak can load. For a REST application, it means a short YAML file describing the endpoint, which the garak REST generator reads. The reviewer is needed because a glitch-triggered output still has to be judged as harmful, odd, or irrelevant, and the JSONL report only records attempts and evaluations. Confirm access rules and data handling with the team that owns the endpoint before any prompts are sent.
Can we run glitch token probes ourselves with garak?
Yes, if your team has Python 3.11 or newer, can install garak from PyPI with pip, and has someone who can read a JSONL report. garak is a command-line tool developed on Linux and macOS, so a Linux host or Mac is the straightforward choice. Start by selecting the glitch probes explicitly, running against a non-production endpoint, and keeping the garak.log file, which carries across runs. The harder parts are judgment and repeatability: deciding which failures matter, keeping configuration files under version control, and comparing runs after a garak upgrade. If those skills are in-house, the work is manageable. If they are not, plan time for the learning curve before you commit to a schedule.
When should we bring in outside help for glitch token testing?
Bring in outside help when the results will support a decision that others must trust, or when the setup spans systems your team does not operate. Common triggers include a fine-tuned model going into a regulated workflow, an endpoint behind several layers of gateway and guardrails, an air-gapped environment, or a need to show testing evidence to an auditor. DeployOpen runs security testing of AI systems and prepares evidence for compliance assessments, but it does not issue audit reports or certifications, so independent auditors still make that determination. Most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. Ask for the written scope to name the glitch probes, the endpoints, the reviewer responsibilities and the retest approach.
Do glitch token results change when garak is upgraded?
They can, so record the garak version with every run. garak v0.17.1 was released on 16 October 2026, and each release may change probes, detectors or defaults. A glitch result from one version should not be compared directly with a result from another without checking the release notes. Keep the same configuration file, the same generator settings and the same endpoint model version for baseline runs. When you upgrade, run the baseline again on the new version before reading any trend. The release history is published on the NVIDIA/garak releases page.
When glitch probes belong in a scan plan
Add garak's glitch probes to a scan plan when the tokenizer shapes what the model does with unusual input. The clearest cases are models that ship their own tokenizer, fine-tunes built on a base model's tokenizer, and quantized or converted builds such as gguf files run through llama.cpp, where the weights and vocabulary have been repackaged by someone other than the original trainer. Glitch tokens are strings that sit in the vocabulary but are rarely or never seen in training, so the model's response to them can be erratic. Fine-tuning and conversion can change how those rare entries behave, so a model that was clean upstream may not be clean after your changes. Before the first scan, ask who built the tokenizer, whether the fine-tune changed the vocabulary or embeddings, and which conversion steps touched the files you will test.
The glitch probes matter less where the provider controls the tokenizer and your team cannot change it, as with many hosted API models reached through the OpenAI API or AWS Bedrock. You still cannot inspect those vocabularies, but the provider owns that risk and your scan cannot fix it. In that case, treat glitch probes as an optional check and spend more of the scan budget on the families that match your application, such as prompt injection, data leakage and jailbreaks. The same logic applies when the application only accepts structured input that filters out unusual strings. Whatever you decide, record the reason in the scan plan so a reviewer can see why the glitch probes were included or left out.
Pair glitch probes with the broader families rather than running them alone. A glitch result says the model reacted oddly to a token, not that an attacker can exploit it, so the detectors and any follow-up runs should show whether the odd behavior crosses into unsafe output or policy failure. Confirm the probe set your garak version provides by reading the glitch module in the source before you commit it to a schedule, because probe names and coverage change between releases. Keep the glitch results in the same JSONL report and comparison workflow as the rest of the scan so that a change after a fine-tune or re-conversion shows up as a clear difference.
How DeployOpen scopes and delivers garak glitch testing
DeployOpen plans garak glitch token testing as a written, fixed-scope engagement tied to the models you run and the tokenizers they use. The work covers configuration, test runs, documented results and a handover your team can repeat, with ongoing support available as a retainer.
How we scope
- Inventory each model, fine-tune and tokenizer in scope, including which ones your team has already adapted or retrained.
- Agree in writing which glitch probes run, against which endpoints, and which findings count as failures for your use case.
- Confirm access terms for the target, including whether tests run against a hosted endpoint or a model inside your infrastructure.
How we build
- Install garak from PyPI on a Python 3.11 or newer host you control, and pin the version so results stay comparable across runs.
- Configure the generator for your endpoint with a YAML file, then run the glitch module alongside the probes your scan plan already includes.
- Review the JSONL report and garak.log for each run, and check whether unusual outputs come from the model or from the harness setup.
How we hand over
- Deliver the run configuration, probe selection and the reasoning behind each choice, so your team can rerun the scan without us.
- Document each glitch finding with the prompt, the model response, the detector outcome and a recommended fix or mitigation.
- Walk your engineers through the report format and the steps to repeat the scan after a model, tokenizer or fine-tune change.
How we support
- Rerun the glitch probes after a model update, tokenizer change or new fine-tune, and compare results with the earlier baseline.
- Keep garak and its configuration current through planned upgrades, with release notes reviewed before each change is applied.
- Offer ongoing support and continuous testing as a retainer, with the scope and frequency of reruns agreed in writing.

