Downloads · 30 days
10
13% of all-time downloads
whysue/Qwen3-14B-why
Qwen3-14B-why is a text generation model from whysue. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
A penetration-testing decision-planning model based on Qwen3-14B, trained with GRPO (Group Relative Policy Optimization) via the verl framework.
Downloads · 30 days
10
13% of all-time downloads
All-time downloads
79
Public
Parameters
14.8B
29.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors29.5 GB · 100%
From the Hugging Face model README
A penetration-testing decision-planning model based on Qwen3-14B, trained with GRPO (Group Relative Policy Optimization) via the verl framework.
一个基于 Qwen3-14B 的渗透测试决策规划模型,使用 GRPO(Group Relative Policy Optimization) 强化学习方法、通过 verl 框架训练而成。
Given the current state of a penetration-testing engagement (target-machine info, the Penetration Testing Tree / PTT progress, and the previous step and its result), the model outputs a structured next-action decision: a high-level strategy, a concrete step, and the MCP tool tasks to invoke.
给定一次渗透测试过程中的当前状态(目标机器信息、Penetration Testing Tree(PTT) 进展、上一步动作及其结果),模型输出结构化的下一步决策:高层策略、具体步骤,以及需要调用的 MCP 工具任务。
⚠️ Safety & Compliance Notice / 安全与合规声明 EN: This model is intended for authorized security testing, red-teaming, CTF, and research only. Use it exclusively on systems for which you have explicit written authorization. Any unauthorized intrusion, attack, or misuse is illegal; the authors accept no liability. See Bias, Risks, and Limitations. 中文: 本模型面向授权的安全测试、红队演练、CTF 与安全研究场景。仅可在你拥有明确书面授权的系统上使用。任何未授权的入侵、攻击或滥用均属违法,作者不承担任何责任。详见 Bias, Risks, and Limitations。
EN
Qwen/Qwen3-14Bverl.trainer.main_ppo, adv_estimator=grpo)pentest_planning中文
Qwen/Qwen3-14Bverl.trainer.main_ppo,adv_estimator=grpo)pentest_planningTask / 任务
EN: The model relies on a fixed system prompt to constrain its structured output. At inference time, reuse the training system prompt, otherwise the reward-aligned structured output degrades.
中文: 模型使用固定的 system prompt 约束输出结构。推理时请复用训练时的 system prompt,否则奖励对齐的结构化输出会退化。
System prompt:
You are an expert penetration-testing planning agent. Given the current state of an
engagement against a target machine — including the Penetration Testing Tree (PTT) that
tracks completed and pending tasks, and the outcome of the previous step — decide the
single best next action.
Your response MUST strictly use the following XML tags in order:
<think>
[step-by-step reasoning: strategy analysis then step analysis]
</think>
<new_strategy>[a concise high-level strategy]</new_strategy>
<new_step>[the concrete next step to execute]</new_step>
<mcp_tasks>[a JSON object mapping tool -> task, e.g. {"Metasploit": "Exploit CVE-XXXX."}]</mcp_tasks>
User message (state template) / 用户消息(状态模板):
## Target machine
{machine}
## Penetration Testing Tree (current progress)
{ptt}
## Previous strategy
{prev_strategy}
## Previous step
{prev_step}
## Previous step result
{prev_result}
Decide the best next action now.
Expected output (example) / 期望输出(示例):
<think>
...strategy analysis...
...step analysis...
</think>
<new_strategy>Enumerate exposed web service for known CVEs</new_strategy>
<new_step>Run a targeted vulnerability scan against the web port identified in the PTT</new_step>
<mcp_tasks>{"Nmap": "Scan http service for version and known CVEs", "Metasploit": "Search matching exploit modules"}</mcp_tasks>
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "path/to/Qwen3-14B-Pentest-GRPO" # this model dir / 本模型目录
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
SYSTEM = (
"You are an expert penetration-testing planning agent. ..." # full system prompt above / 使用上文完整 system prompt
)
USER = (
"## Target machine\n<machine>\n\n"
"## Penetration Testing Tree (current progress)\n<ptt>\n\n"
"## Previous strategy\n<prev_strategy>\n\n"
"## Previous step\n<prev_step>\n\n"
"## Previous step result\n<prev_result>\n\n"
"Decide the best next action now."
)
messages = [{"role": "system", "content": SYSTEM}, {"role": "user", "content": USER}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=1024, temperature=0.7, top_p=0.95)
print(tok.decode(out[0][inputs.shape[1]:], skip_special_tokens=True))
python -m vllm.entrypoints.openai.api_server \
--model path/to/Qwen3-14B-Pentest-GRPO \
--max-model-len 12288
EN: Trained with
max_prompt_length=6144,max_response_length=4096. The PTT context can be long, so set--max-model-len≥ 10k when serving. 中文: 训练时max_prompt_length=6144、max_response_length=4096。PTT 上下文可能很长,部署时--max-model-len建议 ≥ 10k。
EN: Sourced from a penetration-testing decision CSV where each row is one "decision point" in an engagement. Input columns: Machine, PTT, Previous strategy, Previous step, Previous step result. Reference-decision columns: New strategy, Strategy explanation, New step, Step explanation, MCP_tasks. Converted by convert_to_grpo.py into verl parquet schema (data_source / prompt / ability / reward_model / extra_info); the reference decision is packed as JSON into reward_model.ground_truth.
中文: 来源于渗透测试决策 CSV,每行是一次交战过程中的一个「决策点」。输入列:Machine, PTT, Previous strategy, Previous step, Previous step result;参考决策列:New strategy, Strategy explanation, New step, Step explanation, MCP_tasks。由 convert_to_grpo.py 转为 verl parquet schema(data_source / prompt / ability / reward_model / extra_info),参考决策打包为 JSON 存入 reward_model.ground_truth。
| Split / 划分 | Samples / 样本数 |
|---|---|
| train / 训练 | 1,894 |
| validation (test) / 验证 | 268 |
EN: Raw CSVs have ~27.7k / ~7.4k decision points;
filter_overlong_prompts=True+truncation='error'filtered out samples exceeding 6144 tokens. GRPO needs no (prompt, response) supervised pairs — it samples multiple responses per prompt and estimates advantage from group-relative rewards. 中文: 原始 CSV 约 27.7k / 7.4k 条决策点;filter_overlong_prompts=True+truncation='error'过滤掉超过 6144 token 的样本。GRPO 无需 (prompt, response) 监督对,它对同一 prompt 采样多个回答并用组内相对奖励估计优势。
EN: Rule-based reward (offline, no external LLM), normalized to [0, 1] (see pentest_reward.py).
中文: 规则型奖励(离线、无需外部 LLM),归一化到 [0, 1](见 pentest_reward.py)。
| Dimension / 维度 | Weight / 权重 | Description / 说明 |
|---|---|---|
| Format / 格式分 | 0.4 | All four XML tags present (0.1 each) / 四个 XML 标签是否齐全(每个 0.1) |
| Tool hit / 工具命中 | 0.4 | Predicted <mcp_tasks> tool names vs reference (core signal) / 生成的工具名 vs 参考工具名(核心信号) |
| Strategy sim / 策略相似 | 0.2 | Word-level Jaccard of <new_strategy> vs reference / <new_strategy> 与参考的词级 Jaccard |
EN/中文: Can be replaced with an LLM-as-judge for stronger semantic scoring. / 可替换为 LLM-as-judge 以获得更强的语义判分。
EN: GRPO (adv_estimator=grpo, no critic) on verl + FSDP (full-param) + vLLM async rollout. Rollouts per prompt rollout.n=8; KL regularization use_kl_loss=True, kl_loss_coef=0.001, kl_loss_type=low_var_kl.
中文: GRPO(adv_estimator=grpo,无 critic),基于 verl + FSDP(全参数)+ vLLM 异步 rollout。每 prompt 采样 rollout.n=8;KL 正则 use_kl_loss=True、kl_loss_coef=0.001、kl_loss_type=low_var_kl。
| Item / 项 | Value / 值 |
|---|---|
| learning rate / 学习率 | 1e-6 |
| optimizer / 优化器 | AdamW (betas 0.9/0.999, weight_decay 0.01, clip_grad 1.0) |
| lr scheduler / 学习率调度 | constant |
| train_batch_size | 16 |
| ppo_mini_batch_size | 8 |
| ppo_micro_batch_size_per_gpu | 1 |
| rollout.n | 8 |
| rollout temperature | 1.0 |
| max_prompt_length | 6144 |
| max_response_length | 4096 |
| total_epochs / 总轮数 | 15 (1770 global steps / 全局步) |
| gradient_checkpointing | True |
| use_remove_padding | True |
| Item / 项 | Value / 值 |
|---|---|
| Hardware / 硬件 | 4 × NVIDIA H800 (80GB) |
| vLLM tensor parallel / 张量并行 | TP=2 |
| gpu_memory_utilization | 0.45 (FSDP + vLLM colocate) |
| offload | actor / ref param + optimizer offload = True |
| Wall-clock time / 训练时长 | ≈ 38 hours / 约 38 小时 |
| Precision / 精度 | bf16 |
EN: Evaluated on the validation set (268 samples) using the custom reward reward/mean@4 (mean over 4 samples per prompt).
中文: 在验证集(268 样本)上以自定义奖励 reward/mean@4(每 prompt 4 次采样均值)评估。
| Global Step / 全局步 | val reward/mean@4 |
|---|---|
| 100 | 0.353 |
| 500 | 0.399 |
| 1000 | 0.415 |
| 1500 | ~0.426 |
| 1770 (final / 最终) | 0.425 |
EN — Summary: From a starting point of ≈0.353, validation reward rose to ≈0.426 (~+20% relative gain) and plateaued around step ~1500. Training stayed stable throughout: train/inference probability agreement rollout_actor_probs_pearson_corr ≈ 0.999, pg_clipfrac ≈ 1e-3, no divergence.
中文 — 结论: 相较起点(≈0.353),验证奖励提升到 ≈0.426(约 +20% 相对提升),并在训练中段(~step 1500)趋于饱和。训练全程稳定:训练/推理概率一致性 rollout_actor_probs_pearson_corr ≈ 0.999,pg_clipfrac ≈ 1e-3,无发散。
EN: This metric is a rule-based reward (format compliance + tool-name hit + strategy word overlap), NOT real-world attack success on live targets. Real efficacy must be evaluated separately in a controlled lab. 中文: 该指标由规则型奖励度量(结构合规 + 工具命中 + 策略词重叠),并非真实靶机上的攻击成功率。真实效果需在受控靶场中另行评估。
EN
<mcp_tasks> may be inaccurate or outdated and must be reviewed by a human expert before execution.中文
<mcp_tasks> 中的工具与 CVE 可能不准确或过时,必须由人工安全专家审核后再执行。Qwen/Qwen3-14Bmain_ppo with adv_estimator=grporun_grpo_qwen3_14b.sh, convert_to_grpo.py, pentest_reward.py, GRPO_TRAIN_README.md.run_grpo_qwen3_14b.sh、convert_to_grpo.py、pentest_reward.py、GRPO_TRAIN_README.md。| Component / 组件 | Version / 版本 |
|---|---|
| Python | 3.10 |
| torch | 2.9.0 (cu128) |
| vllm | 0.12.0 |
| flash-attn | 2.8.3 |
| transformers | 4.57.x |
| ray | 2.56.0 |
| verl | (see repo / 见仓库) |
EN/中文: Please also cite Qwen3, verl, and GRPO. / 请同时引用 Qwen3、verl 与 GRPO。
@misc{qwen3,
title = {Qwen3 Technical Report},
author = {Qwen Team},
year = {2025}
}
@article{shao2024deepseekmath,
title = {DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models},
author = {Shao, Zhihong and others},
journal = {arXiv preprint arXiv:2402.03300},
year = {2024},
note = {Introduces GRPO}
}
@misc{verl,
title = {verl: Volcano Engine Reinforcement Learning for LLMs},
author = {ByteDance Seed and verl Community},
url = {https://github.com/volcengine/verl}
}