JD-LLM-V3 是一个面向端到端源代码漏洞检测的生成式大语言模型。输入为完整或函数级源代码,输出为漏洞上下文、候选漏洞行、CWE 类别和漏洞原因等结构化标签线索。
| 目录或文件 | 格式 | 说明 |
|---|---|---|
| OtterD/JD-LLM-V3 | GGUF BF16 | 原始精度 BF16 分卷在独立仓库发布 |
| OtterD/JD-LLM-V3 | GGUF Q8_0 | 8-bit 量化版本,分卷在独立仓库发布 |
| model/ | 模型文件 | model-config.yaml 与 gguf/Q4/;后者为 Q4_K_M 量化权重的 19 个分卷,按顺序合并后使用 |
| data/README.md | 数据集说明 | 训练数据来源、构造、统计与复现说明 |
BF16 权重已迁移至独立仓库:OtterD/JD-LLM-V3。下载该仓库的 gguf/BF16/ 全部 62 个分卷后重组:
git clone https://atomgit.com/OtterD/JD-LLM-V3.git
cd JD-LLM-V3
git lfs pull
cat gguf/BF16/JD-LLM-V3-BF16.gguf.part-* > JD-LLM-V3-BF16.gguf请使用与微调一致的模板。不要在输入中提供 CVE 编号、CWE 标签、修复 diff 或其他答案泄露信息。
Task: Given the source code, detect any vulnerabilities.
tips: file_type = code_before if vulnerable, code_after otherwise
Source Code:
<待检测的完整或函数级源代码>
Detection Results:模型输出是生成文本,不保证始终为合法 JSON。消费端应执行 JSON/schema 解析、CWE 格式校验和“预测代码行必须存在于输入”校验。
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "HUST-AI/JD-LLM-OpenSource"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
source_code = """int main() { char a[2]; a[3] = 0; }"""
prompt = f"""Task: Given the source code, detect any vulnerabilities.
tips: file_type = code_before if vulnerable, code_after otherwise
Source Code:
{source_code}
Detection Results:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))undefined本模型基于 DeepSeek-R1-Distill-Qwen-32B 构建;该基座模型在其模型卡片中以 MIT 许可证发布。
@misc{jd_llm_v3_2026,
title={JD-LLM-V3: A Fine-Tuned Language Model for End-to-End Source-Code Vulnerability Detection},
author={JD-LLM Contributors},
year={2026},
howpublished={AtomGit Models}
}在 Linux 或 macOS 中,将同一精度的分卷置于同一目录后重组:
# 其他可用精度:BF16
cat JD-LLM-V3-Q8_0.gguf.part-* > JD-LLM-V3-Q8_0.gguf
cat JD-LLM-V3-BF16.gguf.part-* > JD-LLM-V3-BF16.gguf
# 清单中的原始路径来自构建服务器;下载后先转为文件名,再校验。
sed "s#.*\/##" SHA256SUMS > SHA256SUMS.local
sha256sum -c SHA256SUMS.local使用重组后的 .gguf 文件时,请选用支持 GGUF 的推理框架(例如 llama.cpp),并按框架说明设置 GPU 层数、上下文长度和生成参数。