Downloads · 30 days
13
29% of all-time downloads
Vjeong/qwen3-4b-instruct-apparmor-log-to-rules-lora
qwen3-4b-instruct-apparmor-log-to-rules-lora is a machine learning model from Vjeong. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
LoRA adapter for Qwen/Qwen3-4B-Instruct-2507 that reads AppArmor audit log denials and suggests the policy rules needed to allow the required access. Trained on real-world AppArmor profiles, covering both exact-path a…
Downloads · 30 days
13
29% of all-time downloads
All-time downloads
45
Public
Repo size
58.6 MB
Likes
0
Public
Click a slice to open those files.
.safetensors47.2 MB · 81%
From the Hugging Face model README
LoRA adapter for Qwen/Qwen3-4B-Instruct-2507 that reads AppArmor audit log denials and suggests the policy rules needed to allow the required access. Trained on real-world AppArmor profiles, covering both exact-path and generalized rules. Generated rules are a draft for human review -- verify them before applying to an enforced security policy, since overly permissive rules can weaken security. Apply with peft.PeftModel on the base model, or merge for standalone use.
Qwen/Qwen3-4B-Instruct-2507transformers / peft / trl)/root/.cache/huggingface/hub/datasets--Vjeong--apparmor-audit-to-rules/snapshots/e9638a9019ebd2ca0fd530a4827c919ddcc271a0/data/train.jsonl)73a2945{
"train_runtime": 3276.5012,
"train_samples_per_second": 3.097,
"train_steps_per_second": 0.194,
"total_flos": 1.9053299486872166e+17,
"train_loss": 0.1660708155740732,
"epoch": 2.0,
"acceptance": {
"gates": {
"G1_rule_f1": "PASS",
"G2_coverage": "PASS",
"G3_syntax": "PASS",
"G4_no_regression": "PASS"
},
"overall": "PASS",
"measurements": {
"before": {
"rule_f1_concrete": 0.3821428571428572,
"rule_f1_all": 0.2600976430976431,
"precision": 0.2768703703703704,
"recall": 0.253,
"coverage_recall": 0.4577777777777778,
"syntax_rate": 0.74
},
"after": {
"rule_f1_concrete": 0.8537280701754387,
"rule_f1_all": 0.7661989121989122,
"precision": 0.7663174603174603,
"recall": 0.7662222222222222,
"coverage_recall": 0.8968888888888888,
"syntax_rate": 0.9933333333333333
},
"general_acc_before": 0.49666666666666665,
"general_acc_after": 0.5,
"general_acc_drop_pp": -0.3333333333333355,
"trainable_pct": 0.2924071978366944
}
}
}
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-Instruct-2507", torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(base, "Vjeong/qwen3-4b-instruct-apparmor-log-to-rules-lora")
tokenizer = AutoTokenizer.from_pretrained("Vjeong/qwen3-4b-instruct-apparmor-log-to-rules-lora")
messages = [{"role": "user", "content": "Hello!"}]
inputs = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
prompt_len = inputs["input_ids"].shape[-1]
print(tokenizer.decode(outputs[0][prompt_len:], skip_special_tokens=True))
apache-2.0