garak-contribution-docs

This document describes the current testing workflow for the Misogyny probe and detectors in the Language Model Risk Cards (LMRC) suite.

Overview

The Misogyny feature includes:

Test Commands

Unit Tests

cd /path/to/garak
python -m pip install -e .
python -m pip install pytest pytest-mock
python -m pytest tests/detectors/test_detectors_lmrc.py tests/probes/test_probes_lmrc.py -v

OpenAI

cd /path/to/garak
export OPENAI_API_KEY="your_key_here"
source .venv/bin/activate
python -m pip install .
python -m garak -t litellm -n gpt-5-nano -p lmrc.Misogyny -d lmrc.Misogyny \
--report_prefix gpt-5-nano-misogyny.$(date +%F) --parallel_attempts 16

Local Ollama

Terminal 1

ollama serve
ollama run llama3.2:1b

Terminal 2

cd /path/to/garak
python -m garak -t ollama -n llama3.2:1b -p lmrc.Misogyny -d lmrc.Misogyny \
--report_prefix llama3.2:1b.misogyny.$(date +%F) --parallel_attempts 16

Test Data

Probe prompts (lmrc.Misogyny)

Keyword indicator unit tests (lmrc.MisogynyKeywords)

Detects:

Doesn’t flag:

Test Artifacts

Log and Report Files

File Purpose Raw Link
pytest-2026-01-17.log Pytest output for detector + probe unit tests raw
llama3.2-1b-misogyny-2026-01-17.log llama3.2:1b run log (ollama) raw
llama3.2-1b-misogyny-2026-01-17.report.html llama3.2:1b report (HTML)  
llama3.2-1b-misogyny-2026-01-17.report.jsonl llama3.2:1b report (JSONL) raw
llama3.2-1b-misogyny-2026-01-17.report.json llama3.2:1b report (JSON) raw
gpt-5-nano-misogyny-2026-01-18.log gpt-5-nano run log (litellm) raw
gpt-5-nano-misogyny-2026-01-18.report.html gpt-5-nano report (HTML)  
gpt-5-nano-misogyny-2026-01-18.report.jsonl gpt-5-nano report (JSONL) raw
gpt-5-nano-misogyny-2026-01-18.report.json gpt-5-nano report (JSON) raw

🧪 Test Files

Total: 20 tests Status: ALL PASS ✅ Time: 1.41 seconds

Notes

Contextual detector

The contextual detector uses MilaNLProc/bert-base-uncased-ear-misogyny via Hugging Face. Optional integration tests live in tests/langservice/detectors/test_detectors_misogyny.py and require ~2 GB of storage to download the model.

Success Criteria