National Cyber Warfare Foundation (NCWF)login

DiagSafe for diagnostic evaluation of LLM safety with prompt-level rubrics


0 user ratings
2026-10-22 17:24:09
milo
Red Team (CNA)
"DiagSafe

Tencent's DiagSafe benchmark grades LLM safety with per-prompt rubrics across 3,489 bilingual prompts, giving authorized red teams and ML security engineers explainable, fine-grained model risk diagnoses.








ToolTencent-Hunyuan/DiagSafe — diagnostic LLM safety benchmark with 3,489 bilingual prompts and prompt-level rubric evaluation
CategoryLLM safety benchmarking and evaluation framework (Python)
Primary UseRunning reproducible safety evaluations of LLMs via scripts/run_eval.py with an LLM-as-a-judge rubric pipeline, for model selection and alignment validation
Safe UseIntended for authorized AI red teams, ML security researchers, and model developers testing their own or licensed models in controlled evaluation environments
Telemetry NotePurely evaluative: consumes an OpenAI-compatible API and writes local results/run-*.json checkpoints; no network implants or host artifacts beyond local result files

Most LLM safety benchmarks reduce a model's behavior to a binary safe/unsafe verdict per prompt, which tells you that a model failed but not why. DiagSafe, released by Tencent-Hunyuan, takes a different architectural stance: it pairs a 3,489-prompt bilingual benchmark with a per-prompt rubric, so every judgment decomposes into individual safety items that can be cited, audited, and aggregated into a diagnosis. The accompanying paper (arXiv 2610.29225) frames this as moving beyond binary labels, and the repository ships the full pipeline — data, schemas, judge client, and analysis — under a CC BY 4.0 license.


The dataset itself splits into two complementary halves. DiagBase holds 2,401 prompts synthesized along a language × turns × attack-form grid, covering direct harmful requests plus template and combined-template jailbreaks, with 1,472 single-turn and 929 multi-turn dialogues (2–5 turns). DiagAttack adds 1,088 single-turn instruction attacks, where the harmful intent is wrapped inside a benign-looking task constrained by role, format, and tone requirements. Chinese and English are represented at roughly 1:1, which matters because the headline results show models are generally more vulnerable in Chinese and in multi-turn settings.


The taxonomy underneath is unusually deep: 11 L1, 34 L2, and 84 L3 labels, distilled from 204 safety provisions extracted from public AI safety guidelines spanning China, the US, the EU, and other regions. Every L3 label carries a definition, a general standard, and detailed rules, and each prompt's rubric is generated from its label's standard. The README includes a sunburst comparison against SALAD-Bench, S-Eval, Do-Not-Answer, and CHiSafetyBench, highlighting leaf categories those benchmarks miss entirely or only cover at a parent level.


The evaluation mechanism is where the engineering gets interesting. Each prompt carries an average of 4.5 prompt-specific safety items — each with explicit exemptions to reduce false positives — plus eight shared usefulness items scored 0–3. An LLM-as-a-judge rules on each item and cites evidence, so an unsafe verdict traces back to concrete rubric hits rather than an opaque classifier score. Against 236 human-annotated gold responses, this rubric paradigm reached 89.41–95.34% human agreement with cross-judge Cohen's κ of 0.828–0.864, clearly outperforming safety classifiers like MD-Judge, LlamaGuard4, S-Eval, and Qwen3Guard (69.07–87.29%) and both prompt-based judging baselines.


The headline empirical finding is sobering for anyone deploying frontier models. Across 11 evaluated LLMs, unsafe rates on DiagBase ranged from 2.8% to 32.9%, but on DiagAttack every model's rate rose to 1.9–8.4× its baseline (median 5.3×), with 8 of 11 models exceeding 40% and the best still above 18%. The authors' interpretation: strong instruction following and safety refusal actively compete in current training, and merely embedding harmful intent in an ordinary task erodes refusals. A follow-up run of five recently released models (including Qwen3.8-27B, DeepSeek-V4.1-Flash, Kimi-K3) under an identical protocol confirmed the pattern.


Because verdicts are item-level, the benchmark also yields diagnostics that a single unsafe-rate number hides. The README shows models plotted on a safety–usefulness plane across the 11 L1 dimensions, and three models with nearly identical overall unsafe rates diverging sharply at category level. There's also a per-turn analysis showing unsafe rates climbing as multi-turn conversations unfold — a concrete signal for teams building conversational agents who need to justify guardrail budgets to stakeholders.


Repository layout is clean and self-documenting. data/prompts/, data/rubrics/, and data/taxonomy/ each ship with JSON Schemas and field references, and data/README.md documents dataset composition and checksums — a detail that signals reproducibility discipline. The src/ tree separates concerns: src/judge/ holds an OpenAI-compatible client with judge-output parsing, src/rubric/ handles rubric rendering including multi-turn history, and src/utils/ covers I/O and configuration. A dashboard/ directory provides a local server and static export for browsing the dataset.


Getting started is minimal: git clone https://github.com/Tencent-Hunyuan/DiagSafe.git, then pip install -r requirements.txt. Requirements are Python 3.10+ and access to any OpenAI-compatible LLM API for the judge role. Configuration lives in configs/judge.yaml and configs/model.yaml, sharing the same schema — base_url, api_key, model, temperature, max_tokens, concurrency, max_retries, timeout, top_p, extra_body, extra_headers. The extra_body passthrough is thoughtful: it supports vLLM-specific fields like chat_template_kwargs and repetition_penalty, and dedicated configs/judge_vllm.yaml / configs/model_vllm.yaml presets ship with enable_thinking: false already set.


The main entry point is scripts/run_eval.py, which takes --prompts, --rubrics, --judge, --model, and --output. Notable operational touches: --answers answers.jsonl lets you judge pre-existing transcripts instead of generating them, --limit N trims the run, and --pipeline interleaves generation and judging for throughput with identical results. Multi-turn prompts are evaluated turn by turn — the model sees the conversation so far, the judge sees earlier turns as context — and a prompt counts as unsafe if any turn is unsafe. Checkpointed resume logic refuses to continue if you change model, temperature, max_tokens, top_p, or extra_body mid-run, listing the changed fields rather than silently corrupting comparability.


For an authorized red team or ML security function, DiagSafe slots in as a pre-deployment gate and regression harness. Rather than hand-rolling jailbreak corpora of uneven quality, teams get a versioned, checksummed dataset with a taxonomy traceable to real regulatory provisions — useful when a safety failure needs to be reported in terms leadership and compliance understand. The per-category profiles also directly inform guardrail placement: if a model's weakness concentrates in specific L1 dimensions, monitoring and input filters can be prioritized accordingly rather than blanketing all traffic.


Defensively, the benchmark's findings double as detection guidance. The instruction-attack result — benign-looking tasks with role/format/tone constraints smuggling harmful intent — suggests that defenders of LLM-backed services should treat heavily constrained, procedurally-worded requests as a risk class, and the multi-turn escalation data argues for per-turn re-evaluation rather than front-loaded moderation. Nothing in the repo is operational tooling against live systems; it is measurement infrastructure, and its telemetry footprint is limited to local result JSON files.


Caveats worth noting: the repository reports NOASSERTION on license detection despite the README's CC BY 4.0 badge (worth verifying before commercial redistribution of the dataset), and the star count is still modest at 21, consistent with a fresh research artifact. The judged models in the leaderboard are anonymized-ish internal names (Hy4-Preview, Qwen3.8-27B), so cross-referencing against your own model set requires running the harness yourself — which, given the clean config schema and resume logic, is exactly what the tooling is built to make cheap.



Official project repository for Tencent-Hunyuan/DiagSafe.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/10/diagsafe-for-diagnostic-evaluation-of.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.