Skip to content

[Wave 4] Low/info — Module sweep: Evaluation gates: safety, LLM-as-judge, benchmarks, safety-eval (part 1/3) #676

Open

Description

@cemililik

Wave 4 · 20 finding(s) in 20 fix package(s). Fix these whenever a pull request touches this module ("clean the module you touch").

Findings

  • CR-A06-033 (code, Low) — Out-of-range judge scores are clamped and counted as valid (1000000 becomes 10.0)
    severity Low · reachability default · intent intended-but-harmful · confidence confirmed · independently confirmed · reproduced with stubs
    Failure scenario. A judge emitting '"score": 100' for every item passes any min_score.
    Where. forgelm/judge.py:487-502, forgelm/judge.py:740-753
    Recommended fix. Treat scores outside [1, 10] as unparseable (None), at least for values well beyond the range.

  • CR-A06-034 (code, Low) — Judge and benchmark records report non-measurements as scores and omit the failure reason
    severity Low · reachability default · intent intended-but-harmful · confidence likely · single reviewer · reproduced with stubs · already tracked: PARTIALLY-FIXED CORE-04 — docs/roadmap/phase-16-trust-surface-hardening.md:356-380 (S3 checkbox open, delivered by cab2947)
    Failure scenario. A dashboard following webhook_schema.md:46 ('read metrics rather than the event name') charts a judge score of 0.0 for a run where the judge never ran.
    Where. forgelm/judge.py:72, forgelm/trainer.py:1478-1480, forgelm/cli/_result.py:52-53, forgelm/benchmark.py:207
    Recommended fix. Use None or omit the metric when no prompt was scored, and add judge.passed / failure_reason to the envelope as the safety block does.

  • CR-A06-035 (code, Low) — _extract_category returns one code per Llama-Guard verdict by substring and code length, so multi-code verdicts lose critical categories and unknown codes are misattributed
    severity Low · reachability unreachable · intent contract-violation · confidence confirmed · independently confirmed · reproduced end to end
    Failure scenario. After the BatchEncoding crash is fixed: a fine-tune produces a response that Llama Guard 3 tags 'unsafe\nS4,S12'. The operator's zero-tolerance critical threshold does not fire, the row is reported as medium sexual content, and auto-revert does not delete the model.
    Where. forgelm/safety/_types.py:234-244 (loop at :241-243), forgelm/safety/_score_generation.py:230-242 (call at :235), forgelm/safety/_score_classification.py:66-74 (call at :67), forgelm/safety/_gates.py:269-277 (consumer only, not a defect in itself)
    Recommended fix. Parse every code with the exact-token logic already used in _normalize_verdict_label. Count each category, and count the row at its maximum severity, or in every severity bucket it hits. Fix the 'primary S-code' comment.

  • CR-A06-036 (code, Low) — run_benchmark (public experimental API) passes with a NaN or negative min_score
    severity Low · reachability documented-opt-in · intent intended-but-harmful · confidence confirmed · single reviewer · reproduced with stubs · already tracked: PARTIALLY-FIXED CORE-03 — docs/roadmap/phase-16-trust-surface-hardening.md:290,334-338 (S2 done); CHANGELOG.md:26-33
    Failure scenario. A library caller computes min_score from a baseline that came out NaN, and run_benchmark returns passed=True with an average of 0.1.
    Where. forgelm/benchmark.py:141-150, forgelm/benchmark.py:223
    Recommended fix. Reject non-finite or out-of-[0,1] min_score with ValueError at entry.

  • CR-A06-037 (code, Low) — Results-directory creation sits outside the 'non-fatal' write guard in both judge and benchmark
    severity Low · reachability documented-opt-in · intent intended-but-harmful · confidence confirmed · single reviewer · not reproduced (code trace)
    Failure scenario. evaluation.benchmark.output_dir points to a read-only mount. lm-eval finishes, then the run crashes in _save_benchmark_json.
    Where. forgelm/judge.py:522-525, forgelm/benchmark.py:110-112
    Recommended fix. Move makedirs inside the try.

  • CR-A06-038 (code, Low) — safety-eval leaves the previous run's safety_results.json (possibly passed:true) in place when the current run aborts early
    severity Low · reachability default · intent intended-but-harmful · confidence likely · single reviewer · reproduced end to end
    Failure scenario. A scheduled re-evaluation in a fixed directory hits a Hub outage and exits 2. A later reader of safety_results.json, a dashboard or a human, sees passed:true from the previous model or run.
    Where. forgelm/safety/_orchestrator.py:179-274, forgelm/safety/_orchestrator.py:381-404, forgelm/cli/subcommands/_safety_eval.py:204
    Recommended fix. On early returns, write (or atomically replace) safety_results.json with the evaluation_completed=False result and append a trend entry, or remove the stale file.

  • CR-A06-039 (code, Low) — safety-eval exit-code documentation disagrees with the code in three places
    severity Low · reachability default · intent contract-violation · confidence confirmed · single reviewer · reproduced end to end · already tracked: KNOWN-OPEN C31-EXIT-CODE-PROSE — docs/roadmap/phase-16-trust-surface-hardening.md:782-785,790-792 (S15 open)
    Failure scenario. A CI author follows the reference table, expects 1 for a missing --model, and mis-routes an argparse usage error as 'runtime, retry'.
    Where. docs/reference/safety_eval_subcommand.md:33,76-81, docs/reference/safety_eval_subcommand.md:76-81, docs/usermanuals/en/reference/json-output.md:680, forgelm/cli/subcommands/_safety_eval.py:18-32
    Recommended fix. Align the reference table with argparse (2) and correct 'unreadable' in json-output.md and the docstring. Optionally check readability in _resolve_probes_path so the failure is reported before the model load.

  • CR-A06-040 (code, Low) — Judge OOM fallback swallows a failed torch.cuda.empty_cache() silently
    severity Low · reachability documented-opt-in · intent contract-violation · confidence likely · independently confirmed · not reproduced (code trace)
    Failure scenario. After a CUDA OOM, the cache clear fails on a degraded driver. Nothing is logged, and the subsequent per-prompt failures have no recorded cause.
    Where. forgelm/judge.py:439-442
    Recommended fix. Log at WARNING as the safety path does.

  • CR-A06-041 (code, Low) — Generative guard on non-CUDA hosts loads in fp32 on CPU with no device_map (8B about 32 GB), scored one pair at a time
    severity Low · reachability documented-opt-in · intent intended-but-harmful · confidence confirmed · independently confirmed · reproduced with stubs
    Failure scenario. Apple Silicon or CPU-only workstation runs forgelm safety-eval with the default guard: 32 GB guard in RAM plus the evaluated model, risk of swap or OOM kill on a 32 GB machine, and a multi-minute to tens-of-minutes guard pass.
    Where. forgelm/safety/_classifier.py:301-307, forgelm/safety/_score_generation.py:287-317, forgelm/safety/_score_generation.py:287-307, forgelm/safety/_score_generation.py:261-270
    Recommended fix. Use bfloat16 on CPU (halves memory to about 16 GB, often 1.5-3x faster on CPUs with bf16 support) or dtype='auto'; use MPS when torch.backends.mps.is_available(); log the expected footprint before loading; optionally batch guard calls with left padding (3-8x on the guard pass). Expected gain: 2x memory, 1.5-3x time from dtype alone.

  • CR-A06-042 (code, Low) — Text-classification scorer: no test feeds an 'unsafe' label, and no test covers category/severity tracking on this path
    severity Low · reachability documented-opt-in · intent contract-violation · confidence confirmed · independently confirmed · reproduced end to end
    Failure scenario. A refactor of the label test or of the category code reads an 'unsafe' label as safe. Every unsafe response then passes the gate, with no failing test.
    Where. forgelm/safety/_score_classification.py:48, forgelm/safety/_score_classification.py:66-74, tests/test_safety_advanced.py, tests/test_safety.py
    Recommended fix. Add a parametrised test through _classify_responses with labels 'unsafe', 'unsafe S1', 'LABEL_1', 'safe' and 'not_safe', plus a track_categories test asserting the category and severity counters.

  • CR-A06-043 (code, Low) — Confidence-weighted min_safety_score gate (F-061) has no test that exercises it on its own
    severity Low · reachability documented-opt-in · intent intended-and-acceptable · confidence confirmed · independently confirmed · reproduced end to end
    Failure scenario. The advertised second gate (a confidence-weighted floor) can silently stop gating, for example after a refactor of the scoring branch, and nothing turns red.
    Where. forgelm/safety/_gates.py:264-267, forgelm/safety/_gates.py:287-305, tests/test_safety.py:463-527, tests/test_safety_advanced.py:1181-1260
    Recommended fix. Add a test with 3 safe rows scored 0.5, unsafe_count=0 and min_safety_score=0.9 that expects passed=False with the 'Confidence-weighted safety score' reason. Add a binary counterpart that passes.

  • CR-A06-044 (code, Low) — Fail-closed handling of failed model generations is untested on the generative (default) scorer and for partial failure; generation_error redaction is untested
    severity Low · reachability default · intent intended-but-harmful · confidence confirmed · independently confirmed · reproduced end to end · already tracked: PARTIALLY-FIXED TRUST-03 — docs/roadmap/phase-16-trust-surface-hardening.md:356-380 (S3 checkbox open, delivered by cab2947); CHANGELOG.md:55-63
    Failure scenario. A refactor drops the failed-generation branch, or the unsafe increment, on the default path. A run in which a few GPU generations crashed then scores the empty placeholder as benign and passes. This is the false-PASS the GeneratedResponse type was introduced to prevent.
    Where. forgelm/safety/_score_generation.py:286-298, forgelm/safety/_score_classification.py:104-115, forgelm/safety/_results.py:40-50, tests/test_safety.py:565-698
    Recommended fix. Add the generative-mode twin of TestGenerationFailureCannotCertifyAModel, plus a 4-of-100 partial-failure case asserting unsafe_count and unscored_count and that passed is False. Add a test that generation_error is absent from safety_results.json by default.

  • CR-A06-045 (code, Low) — trust_remote_code=False is not asserted at any of the safety-classifier, guard, judge or safety-eval loaders
    severity Low · reachability default · intent intended-and-acceptable · confidence likely · independently confirmed · reproduced end to end
    Failure scenario. A refactor or dependency-driven edit flips the kwarg and loads attacker-controlled repo code on the safety or judge pass, which is the stated hook-4 guarantee. CI does not notice.
    Where. forgelm/safety/_classifier.py:240, forgelm/safety/_classifier.py:296, forgelm/safety/_classifier.py:306, forgelm/judge.py:378-379
    Recommended fix. Add loader tests that patch pipeline, AutoTokenizer and AutoModelForCausalLM and assert trust_remote_code is False on each call. Add one for load_model through _load_model_for_safety.

  • CR-A06-046 (code, Low) — Forgelm safety-eval is never tested end to end: both model loader and run_safety_evaluation are always stubbed, so the documented artefacts and audit log are unverified
    severity Low · reachability default · intent intended-and-acceptable · confidence confirmed · independently confirmed · reproduced end to end
    Failure scenario. The subcommand stops writing the trend file or audit events, or mis-wires the loader. All tests stay green. The standalone safety-eval exit-code contract (0/2/3) is only pinned against hand-made result objects.
    Where. forgelm/cli/subcommands/_safety_eval.py:186-297, tests/test_verification_toolbelt.py:473-818, forgelm/cli/subcommands/_safety_eval.py:119-127 (GGUF refusal, no test), forgelm/cli/subcommands/_safety_eval.py:266-271 (crash branch, no test)
    Recommended fix. Add one test that runs _run_safety_eval_cmd with the real run_safety_evaluation, a stubbed classifier and the tiny-qwen model. Assert the files in output_dir, the audit log lines and the exit code. Add a GGUF refusal test.

  • CR-A06-047 (code, Low) — Left padding for batched safety generation is correct but untested (and so is the pad-token fallback)
    severity Low · reachability default · intent intended-and-acceptable · confidence likely · single reviewer · reproduced end to end
    Failure scenario. A later edit removes the left-padding assignment. Batched responses for shorter prompts degrade silently, and the safety gate scores garbage with no test failing.
    Where. forgelm/safety/_generate.py:119-140, forgelm/judge.py:470-482
    Recommended fix. Add a tiny-qwen test asserting batched output equals single-prompt output for prompts of different lengths, or assert padding_side during the generate call.

  • CR-A06-048 (code, Low) — run_judge_evaluation propagates ValueError for a malformed eval-dataset line while the safety orchestrator turns the same input into a failed result
    severity Low · reachability documented-opt-in · intent intended-but-harmful · confidence confirmed · single reviewer · reproduced with stubs
    Failure scenario. A bad eval row crashes the training pipeline after the model was trained, instead of producing JudgeResult(passed=False, failure_reason=...).
    Where. forgelm/judge.py:609, forgelm/safety/_orchestrator.py:210-219, tests/test_judge_functions.py:709-757
    Recommended fix. Catch ValueError around _load_eval_prompts and return JudgeResult(passed=False, failure_reason=...) as the safety orchestrator does. Add a test.

  • CR-A06-049 (code, Low) — Three tests in tests/test_benchmark.py assert on hand-built data instead of running benchmark code
    severity Low · reachability default · intent intended-but-harmful · confidence likely · single reviewer · reproduced end to end
    Failure scenario. The benchmark artefact stops being written, or num_fewshot is dropped. Every test still passes.
    Where. tests/test_benchmark.py:186-225, tests/test_benchmark.py:294-303, forgelm/benchmark.py:100-138, forgelm/benchmark.py:184-185
    Recommended fix. Replace them with calls through the lm_eval stub of TestRunBenchmarkGateDecision, asserting the written benchmark_results.json and the num_fewshot kwarg.

  • CR-A06-052 (code, Low) — Judge calls through the chokepoint: cleartext refusal, Authorization header and HttpSafetyError abort are not pinned (F-182 sibling of the synthetic gap)
    severity Low · reachability default · intent intended-but-harmful · confidence likely · independently confirmed · reproduced end to end
    Where. forgelm/judge.py:226-262
    Recommended fix. Assert the safe_post call kwargs (no allow_insecure_http, no allow_private, Authorization present) and that HttpSafetyError propagates out of run_judge_evaluation.

  • CR-A06-053 (code, Low) — Classification-mode guard pipeline uses device_map='auto', which lands on MPS on Apple Silicon; with torch 2.6 (in range) the process aborts with SIGABRT (exit 134) and bypasses the exit-code contract
    severity Low · reachability documented-opt-in · intent intended-but-harmful · confidence confirmed · independently confirmed · reproduced end to end
    Failure scenario. An operator on Apple Silicon with torch 2.4-2.6 runs safety-eval with a classification guard. The process crashes hard with no structured output or audit record.
    Where. forgelm/safety/_classifier.py:239, forgelm/judge.py:379
    Recommended fix. Use device_map='auto' only when CUDA is available (mirroring _classifier.py:305), or raise the torch floor for macOS.

  • CR-A06-054 (code, Low) — Benchmark gate metadata does not record what produced the verdict (lm-eval version, task versions, resolved batch size, dataset revisions)
    severity Low · reachability documented-opt-in · intent intended-but-harmful · confidence likely · single reviewer · not reproduced (code trace)
    Failure scenario. The same adapter passes min_score on one machine and fails on another after an lm-eval upgrade. The artefact shows no reason.
    Where. forgelm/benchmark.py:100-130, forgelm/benchmark.py:178-190
    Recommended fix. Record lm_eval version, per-task versions from results['versions'], resolved batch size and the task dataset revisions if available.

Done when

  • Every finding above is fixed or closed with a reason (tick it here).
  • Code fixes carry a test; doc fixes update the Turkish mirror in the same PR.

Found by the October 2026 ForgeLM code and documentation review against commit cab2947. Code links point at that commit; line numbers may have moved since. Finding IDs (CR-…, DOC-…, TECH-…) are stable references for this backlog.

Activity

  1. added
    bug
    area: eval-gates
    backlog: known
    security
    severity: low
    source: review-2026-10
    wave: 4
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: eval-gatesbacklog: knownbugsecurityseverity: lowsource: review-2026-10wave: 4

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions