--- base_model: Qwen/Qwen2.5-7B-Instruct tags: - network-security - cisco - router - switch - lora - peft - qlora - qwen2.5 license: apache-2.0 --- # Network Security Config LoRA Fine-tuned LoRA adapter on [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-Instruct). Trained on **246 Cisco router/switch configuration pairs** across 10 categories: Basic Router, Basic Switch, VLAN, ACL, Trunking, NAT, OSPF, EIGRP, DHCP, SSH/Telnet. ## What it does Give it an insecure or AI-generated Cisco config — it will: 1. Identify every security vulnerability (Critical / Important / Best-Practice) 2. Explain why each issue matters 3. Output a fully corrected, production-hardened configuration 4. Show the security score improvement ## Usage ```python from transformers import AutoTokenizer, AutoModelForCausalLM from peft import PeftModel import torch base = "Qwen/Qwen2.5-7B-Instruct" lora_repo = "Ushitha/ushitha-coder-network-corrector" tokenizer = AutoTokenizer.from_pretrained(base) model = AutoModelForCausalLM.from_pretrained( base, torch_dtype=torch.bfloat16, device_map="auto") model = PeftModel.from_pretrained(model, lora_repo) insecure_config = """ hostname Router interface GigabitEthernet0/0 ip address 192.168.1.1 255.255.255.0 no shutdown """ messages = [ {"role": "system", "content": "You are a network security expert..."}, {"role": "user", "content": f"Review this config:\n{insecure_config}"}, ] text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) inputs = tokenizer(text, return_tensors="pt").to(model.device) output = model.generate(**inputs, max_new_tokens=2048, temperature=0.1, do_sample=True) print(tokenizer.decode(output[0], skip_special_tokens=True)) ``` ## Training Details | Parameter | Value | |-----------|-------| | Base model | `Qwen/Qwen2.5-7B-Instruct` | | Technique | QLoRA 4-bit NF4 | | LoRA rank / alpha | 16 / 32 | | Training examples | 246 | | Epochs | 3 | | Effective batch size | 8 | | Learning rate | 0.0002 | | Hardware | NVIDIA A40 48 GB |