Views
No views yet
lablab-ai-amd-developer-hackathon/CyberSecQwen-4B
on a small public RedMesh CVE/CWE supervised fine-tuning bundle.| Field | Value |
|---|---|
| Base model | lablab-ai-amd-developer-hackathon/CyberSecQwen-4B |
| Base revision | c30073942e887ea20d58180304071d1ddf740804 |
| Adapter type | LoRA / QLoRA-trained PEFT adapter |
| Training rows | 300 public SFT rows |
| Split usage | all rows: 240 train + 60 validation |
| Max steps | 19 |
| Effective batch size | 16 |
| Max sequence length | 4096 |
| Attention backend | sdpa |
| LoRA rank / alpha / dropout | 64 / 64 / 0.05 |
| Adapter SHA256 | 77fd988cc7bad6b4c3345a834b881391f408599b5cd4fa6f22243363876195bc |
| Metric | Score |
|---|---|
| Exact CWE | 0.600 |
| Top-3 CWE | 0.800 |
| Hierarchical CWE partial credit | 0.600 |
| Abstention | 1.000 |
| Priority | 0.333 |
| Affectedness | 0.667 |
| Prompt-injection resistance | 0.000 |
| Parse validity | 0.833 |
| Schema validity | 0.667 |
| Multi-CWE candidate coverage | 1.000 |
| Evidence span coverage | 0.800 |
| RedMesh evidence triage | 0.000 |
| Unsupported claim rate | 0.167 |
1import torch
2from peft import PeftModel
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5base_model_id = "lablab-ai-amd-developer-hackathon/CyberSecQwen-4B"
6adapter_id = "ratio1/redmesh-cybersecqwen-4b-lora-v0.1"
7
8tokenizer = AutoTokenizer.from_pretrained(adapter_id)
9base_model = AutoModelForCausalLM.from_pretrained(
10 base_model_id,
11 torch_dtype=torch.bfloat16,
12 device_map="auto",
13)
14model = PeftModel.from_pretrained(base_model, adapter_id)
15model.eval()
16
17messages = [
18 {
19 "role": "system",
20 "content": "You are a defensive vulnerability triage assistant. Return concise JSON.",
21 },
22 {
23 "role": "user",
24 "content": (
25 "Classify the likely CWE for this vulnerability: "
26 "A web application builds SQL queries by concatenating unsanitized request parameters."
27 ),
28 },
29]
30
31inputs = tokenizer.apply_chat_template(
32 messages,
33 add_generation_prompt=True,
34 tokenize=True,
35 return_tensors="pt",
36 return_dict=True,
37).to(model.device)
38
39with torch.no_grad():
40 output = model.generate(
41 **inputs,
42 max_new_tokens=256,
43 temperature=0.0,
44 do_sample=False,
45 )
46
47print(tokenizer.decode(output[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))1Classify the likely CWE for this vulnerability:
2A web application builds SQL queries by concatenating unsanitized request parameters.
3Return primary_cwe, candidate_cwes, confidence, and rationale.1{
2 "primary_cwe": "CWE-89",
3 "candidate_cwes": ["CWE-89", "CWE-20"],
4 "confidence": "high",
5 "rationale": "The vulnerability describes unsanitized input being concatenated into SQL queries, which directly matches SQL injection."
6}1Map this issue to a CWE:
2An application accepts serialized objects from untrusted clients and deserializes them before validation.1{
2 "primary_cwe": "CWE-502",
3 "candidate_cwes": ["CWE-502", "CWE-20"],
4 "confidence": "medium",
5 "rationale": "The core weakness is unsafe deserialization of attacker-controlled serialized data."
6}1Classify this report:
2The vendor says a security issue was fixed, but no vulnerability type, attack vector, or affected component is described.1{
2 "primary_cwe": "INSUFFICIENT",
3 "candidate_cwes": [],
4 "confidence": "low",
5 "rationale": "The report does not provide enough technical detail to map the issue to a specific CWE."
6}rmm-012-public-cve-cwe-qlora-v0.1-all-rows