MikroTik RouterOS v0.1 — Qwen2.5-Coder-7B fine-tune
A 7B-parameter LLM specialized for MikroTik RouterOS networking. Runs locally via Jan, llama.cpp, or Ollama. Fine-tuned from Qwen/Qwen2.5-Coder-7B-Instruct on a hand-curated Q&A dataset derived from the official MikroTik Confluence documentation.
This is the GGUF distribution — the merged model in Q4_K_M quantization (4.4 GB) plus the original LoRA adapter for those who want to retrain or merge differently.
Model details
| Base model | Qwen/Qwen2.5-Coder-7B-Instruct |
| Fine-tuning method | LoRA (Unsloth), rank r=16, alpha 16, dropout 0.0 |
| Quantization | Q4_K_M (4.4 GB on disk) — F16 weights also available on request |
| Sequence length | 2048 |
| Training framework | Unsloth + TRL SFTTrainer |
| Hardware | NVIDIA RTX 5070 Ti (16 GB) |
Files in this repo:
| Path | Size | Notes |
|---|---|---|
mikrotik-routeros-v01.Q4_K_M.gguf | 4.4 GB | The model to actually run |
lora/adapter_model.safetensors | 78 MB | Raw LoRA adapter (for retraining/merging) |
lora/adapter_config.json | — | Adapter config |
lora/tokenizer.json, tokenizer_config.json, chat_template.jinja | — | Tokenizer assets |
Training data
zilalzihar/mikrotik-routeros-qa-dataset
- 1,672 instruction/response pairs
- 215 unique source pages from the official MikroTik Confluence documentation
- Stratified 95/5 train/val split (1,590 train, 82 val)
- 93 completion-style pairs (with
inputfield) mixed in with chat-style pairs
Training stats
| Epochs | 2 |
| Effective batch size | 8 (per-device 2 × grad-accum 4) |
| Optimizer / LR | AdamW, peak LR 2e-4, cosine schedule, 10 warmup steps |
| Train rows | 1,590 |
| Val rows | 82 |
| Train time | 10.1 min on RTX 5070 Ti |
| Peak VRAM | 6.3 GB |
| Train loss | 2.55 → 1.38 (final mean 1.59) |
| Val loss | 1.61 |
Recommended prompt format (Alpaca)
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{prompt}
### Response:
Recommended sampling
temperature: 0.7top_p: 0.9repetition_penalty: 1.1
How to use
Option A — Jan (recommended for desktop use)
mkdir -p ~/.local/share/Jan/data/llamacpp/models/mikrotik-routeros-v01
# Download the GGUF and place it at the path below
cp mikrotik-routeros-v01.Q4_K_M.gguf \
~/.local/share/Jan/data/llamacpp/models/mikrotik-routeros-v01/model.gguf
# Restart Jan; the model appears in the model picker.
Option B — llama.cpp (CLI)
./llama-cli \
-m mikrotik-routeros-v01.Q4_K_M.gguf \
--temp 0.7 --top-p 0.9 --repeat-penalty 1.1 \
-p "Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
How do I add a static route to 10.0.0.0/24 via 192.168.1.1?
### Response:
"
Option C — Ollama
Save as Modelfile:
FROM ./mikrotik-routeros-v01.Q4_K_M.gguf
TEMPLATE """Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{{ .Prompt }}
### Response:
"""
PARAMETER temperature 0.7
PARAMETER top_p 0.9
PARAMETER repeat_penalty 1.1
PARAMETER stop "### Instruction:"
Then:
ollama create mikrotik-routeros-v01 -f Modelfile
ollama run mikrotik-routeros-v01
Strengths
- Single-topic RouterOS questions — firewall rules, IPsec phase-1/2, wireless interface config, OSPF/BGP basics, DHCP server/client, NAT, bridging, VLANs, queues.
- Syntax correctness — produces valid RouterOS CLI invocations (
/ip firewall filter add ...,/interface wireless ..., etc.) far more reliably than the vanilla base model. - Troubleshooting prompts — gives reasonable first-pass diagnostic steps for common failure modes (no internet, IPsec not establishing, routing loop, etc.).
- Broad coverage — 215 documentation pages span firewall, IPsec, wireless, routing (OSPF/BGP/RIP), DHCP, NAT, bridging, queues, scripting, tools.
Limitations (honest list, from real testing)
- Multi-feature integration questions are weak. Asking it to design something that touches firewall + IPsec + routing-marks together often produces a single-domain answer.
- Modern crypto defaults can be outdated. It will sometimes suggest older proposal sets (e.g., 3DES/SHA1) because the source docs span many RouterOS versions. Always verify against current best practice.
- Multi-WAN with routing marks is weak. Mangle/connection-mark recipes are inconsistent.
- QoS depth is limited. Simple queues are fine; complex queue trees / HTB hierarchies tend to be surface-level.
- Not a replacement for the docs. It's a fast lookup and first-draft generator, not an authoritative source.
Comparison
| vs | Difference |
|---|---|
Vanilla Qwen/Qwen2.5-Coder-7B-Instruct | Dramatically more RouterOS-specific. The base model often hallucinates Linux/iptables syntax instead of RouterOS syntax. |
vivek-dodia/Deepseek-R1-8B-MikroTik-Distilled-GGUF | This one actually loads in Jan out of the box. Different base, different distillation philosophy. |
Reproducibility
- Dataset:
zilalzihar/mikrotik-routeros-qa-dataset - Method: Unsloth
FastLanguageModel+ LoRA (r=16, alpha=16) + TRLSFTTrainer, 2 epochs, cosine LR schedule - Merge → GGUF: standard
llama.cppconvert_hf_to_gguf.py→llama-quantizetoQ4_K_M - LoRA adapter is included in
lora/so anyone can re-merge against a different base checkpoint or re-quantize.
Ethical notes
- Training data is derived from MikroTik's publicly available official Confluence documentation. Q&A pairs were generated with Anthropic Claude Opus 4.7 (via Claude Code), grounded in the source pages.
- This model is not affiliated with or endorsed by MikroTikls SIA. "MikroTik" and "RouterOS" are trademarks of their respective owner.
- Outputs may be wrong. Treat as a draft, not as production configuration.
Citation
@misc{mikrotik_routeros_v01_2026,
title = {MikroTik RouterOS v0.1 — Qwen2.5-Coder-7B fine-tune},
author = {zilalzihar},
year = {2026},
howpublished = {\url{https://huggingface.co/zilalzihar/mikrotik-routeros-v01-GGUF}},
note = {Fine-tuned from Qwen/Qwen2.5-Coder-7B-Instruct via LoRA on the mikrotik-routeros-qa-dataset.}
}
Disclaimer
This is an independent, unofficial project with no affiliation to or endorsement by MikroTikls SIA. "MikroTik" and "RouterOS" are registered trademarks of MikroTikls SIA.
This project is for educational and research purposes. Outputs from this model are AI-generated and may be inaccurate. Always verify configurations against official MikroTik documentation at https://help.mikrotik.com before applying them to production systems.
If you are MikroTikls SIA and have concerns about this project, please contact me via [dubpkcfc5@mozmail.com] and I will respond promptly.