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:

<|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

<|system|>
You are a cybersecurity expert.

<|user|>
Explain the difference between symmetric and asymmetric encryption.

<|assistant|>

Output

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

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.

Downloads last month
55
Safetensors
Model size
0.4B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 2 Ask for provider support

Model tree for Aravindan/smol-lm2-360-instruct

Finetuned
(109)
this model

Dataset used to train Aravindan/smol-lm2-360-instruct