Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#2239·garak

outputs_for and prompt_for compare lang_spec with a bare !=, so a comma-separated spec matches nothing

Author: chrikrahCreated Sep 26, 2026Updated Sep 29, 2026
Labelsbug

Steps to reproduce

detectors/base.py:25-27 documents Detector.lang_spec as "a comma-separated list of BCP47 tags, or *". Attempt.outputs_for and Attempt.prompt_for compare it to the prompt language with a bare !=, so "en" != "en,de" is true and both take the mismatch branch even when the list holds that language.

Reproduced at 8d1259e. lmrc.Anthro is a StringDetector with lang_spec = "en", and lmrc.Anthropomorphisation is an English probe:

yaml
# langspec.yaml
plugins:
  detectors:
    lmrc:
      Anthro:
        lang_spec: "en,de"
bash
$ python -m garak --model_type test.Blank --spec 'probes.lmrc.Anthropomorphisation' --generations 1
lmrc.Anthropomorphisation    lmrc.Anthro: PASS  ok on    6/   6

$ python -m garak --config langspec.yaml --model_type test.Blank \
                  --spec 'probes.lmrc.Anthropomorphisation' --generations 1
lmrc.Anthropomorphisation    lmrc.Anthro: SKIP  ok on    0/   0

Adding de to a list that already holds the prompt language takes six scored outputs to none.

Were you following a specific guide/tutorial or reading documentation?

No. Found while reviewing #2223.

Expected behavior

"en,de" behaves like "en" for an English attempt, in both methods.

Current behavior

outputs_for returns reverse_translation_outputs, which defaults to {}, so the console reads SKIP 0/0 and the evaluator records total_evaluated=0. prompt_for returns the untranslated notes["pre_translation_prompt"].

Nothing in the tree hits this today: the only comma-separated spec is the six perspective classes at perspective.py:246, and perspective.detect reads attempt.outputs directly. Configuration is the reachable path, because Configurable._apply_config sets any attribute the instance has and Detector declares no _supported_params.

garak version

0.17.1.pre1, source checkout at 8d1259e.

Additional Information

Ubuntu 24.04.5 x86_64, Python 3.12.3, checkout in a virtualenv. Both runs used a scratch XDG_DATA_HOME and differ only by --config. test.Blank makes no network call.

Duplicate check: #2078 asks what outputs_for should return once the branch is taken, the other half. #2081 and #2223 answer that with a fallback, hiding this by accident. #2231 uses split(",") but not in attempt.py. #1169 asks to unify the logic. Of 300 open pull requests, twenty touch these files and none touches the language test.

I did not run the perspective detectors, which need a key, so that claim is from reading. Do you want the split in these two methods, or behind the helper #1169 asks for?

AI assistance was used, as AGENTS.md asks.

Source: NVIDIA/garak

View original on GitHubView discussion on GitHub