--- language: - en license: apache-2.0 base_model: HuggingFaceTB/SmolLM2-360M pipeline_tag: text-generation tags: - cybersecurity - instruction-tuning - smollm2 - causal-lm - transformers - pytorch - llm - ai-security datasets: - Trendyol/Trendyol-Cybersecurity-Instruction-Tuning-Dataset library_name: transformers --- # smol-lm2-360-instruct smol-lm2-360-instruct is an instruction-tuned language model built by fine-tuning **SmolLM2-360M Base** on a cybersecurity instruction dataset. The objective is to improve the model's ability to answer cybersecurity-related questions while following instruction-style prompts. > **Note:** This is an educational project for learning Instruction Fine-Tuning (IFT) and should not be considered a production-grade security assistant. --- # Model Details | Attribute | Value | |-----------|-------| | Base Model | HuggingFaceTB/SmolLM2-360M | | Model Type | Causal Language Model | | Fine-tuning | Full Parameter Instruction Fine-Tuning | | Domain | Cybersecurity | | Framework | Hugging Face Transformers | | Training Library | Transformers Trainer | | Language | English | --- # Training Objective The model was trained using a supervised instruction-tuning objective. Each training example follows the structure: ```text <|system|> You are a cybersecurity assistant. <|user|> Explain SQL Injection. <|assistant|> SQL Injection is... ``` During training: - The **System** prompt provides behavioral context. - The **User** prompt provides the instruction. - Loss is computed **only on the Assistant response**, while the System and User tokens are masked from the loss. This enables the model to learn instruction following while conditioning on the provided context. --- # Training Configuration | Parameter | Value | |-----------|-------| | Epochs | 4 | | Learning Rate | 2e-4 | | Scheduler | Cosine | | Warmup | 10% | | Batch Size | 2 | | Gradient Accumulation | 8 | | Precision | FP16 | | Optimizer | AdamW | --- # Dataset The model was trained on a cybersecurity instruction dataset consisting of: - System prompts - User instructions - Assistant responses The dataset covers topics such as: - Network Security - Malware Analysis - Threat Intelligence - Secure Coding - Incident Response - Vulnerability Management - Security Best Practices - MITRE ATT&CK - NIST Cybersecurity Framework --- # Example ## Prompt ```text <|system|> You are a cybersecurity expert. <|user|> Explain the difference between symmetric and asymmetric encryption. <|assistant|> ``` ## Output ```text Symmetric encryption uses a single shared key for both encryption and decryption, making it computationally efficient and suitable for encrypting large amounts of data. Asymmetric encryption uses a public/private key pair, enabling secure key exchange and digital signatures but at a higher computational cost. ``` --- # Usage ```python from transformers import AutoTokenizer, AutoModelForCausalLM model_name = "Aravindan/smol-lm2-360-instruct" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained(model_name) prompt = """ <|system|> You are a cybersecurity assistant. <|user|> Explain SQL Injection. <|assistant|> """ inputs = tokenizer(prompt, return_tensors="pt") outputs = model.generate( **inputs, max_new_tokens=200, temperature=0.7 ) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` --- # Limitations This model: - is intended for educational and research purposes - may generate incorrect or outdated cybersecurity advice - has not undergone safety alignment comparable to production LLMs - should not be used as the sole source for security decisions Always verify security recommendations with authoritative sources. --- # Future Improvements - Larger instruction datasets - Multi-turn conversation training - Preference Optimization (DPO/ORPO) - Retrieval-Augmented Generation (RAG) - LoRA and QLoRA fine-tuning - Evaluation on cybersecurity benchmarks --- # Acknowledgements - Hugging Face - SmolLM2 Team - Transformers - Datasets - PyTorch --- # Citation If you use this model in your work, please cite this repository.