Instructions to use Aravindan/smol-lm2-360-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Aravindan/smol-lm2-360-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Aravindan/smol-lm2-360-instruct")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Aravindan/smol-lm2-360-instruct") model = AutoModelForCausalLM.from_pretrained("Aravindan/smol-lm2-360-instruct") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Aravindan/smol-lm2-360-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Aravindan/smol-lm2-360-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Aravindan/smol-lm2-360-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Aravindan/smol-lm2-360-instruct
- SGLang
How to use Aravindan/smol-lm2-360-instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Aravindan/smol-lm2-360-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Aravindan/smol-lm2-360-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Aravindan/smol-lm2-360-instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Aravindan/smol-lm2-360-instruct", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Aravindan/smol-lm2-360-instruct with Docker Model Runner:
docker model run hf.co/Aravindan/smol-lm2-360-instruct
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
Model tree for Aravindan/smol-lm2-360-instruct
Base model
HuggingFaceTB/SmolLM2-360M