Cyber Models
Collection
Cybersecurity specialised models. • 2 items • Updated
How to use Akahsizrr/Cyber-Prime-1-2.6B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Akahsizrr/Cyber-Prime-1-2.6B")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Akahsizrr/Cyber-Prime-1-2.6B")
model = AutoModelForCausalLM.from_pretrained("Akahsizrr/Cyber-Prime-1-2.6B", device_map="auto")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use Akahsizrr/Cyber-Prime-1-2.6B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Akahsizrr/Cyber-Prime-1-2.6B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Akahsizrr/Cyber-Prime-1-2.6B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Akahsizrr/Cyber-Prime-1-2.6B
How to use Akahsizrr/Cyber-Prime-1-2.6B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Akahsizrr/Cyber-Prime-1-2.6B" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Akahsizrr/Cyber-Prime-1-2.6B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "Akahsizrr/Cyber-Prime-1-2.6B" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Akahsizrr/Cyber-Prime-1-2.6B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Akahsizrr/Cyber-Prime-1-2.6B with Docker Model Runner:
docker model run hf.co/Akahsizrr/Cyber-Prime-1-2.6B
A fine-tuned cybersecurity specialist built on LiquidAI/LFM2-2.6B. Despite having only 2.6 billion parameters, Cyber-Prime 1 outperforms Llama-2-7B on every CyberBench task and beats GPT-3.5-Turbo on named entity recognition and threat intelligence summarization.
Cyber-Prime 1 is a surgical fine-tune of the LFM2.5-2.6B base model, trained on a curated mix of:
The model uses two distinct modes:
Evaluated on CyberBench (Liu et al., AAAI-24 AICS Workshop).
| Dataset | Metric | GPT-4 | GPT-3.5 Turbo | Mistral-7B Instruct | Llama-2-7B | Cyber-Prime 1 (2.6B) |
|---|---|---|---|---|---|---|
| CyNER | F1 | 0.554 | 0.334 | 0.323 | 0.263 | 0.382 |
| APTNER | F1 | 0.500 | 0.409 | 0.262 | 0.280 | 0.413 |
| CyNews | ROUGE-1 | 0.275 | 0.271 | 0.217 | 0.003 | 0.354 |
| SecMMLU | Accuracy | 0.830 | 0.780 | 0.720 | 0.630 | 0.580 |
| CyQuiz | Accuracy | 0.810 | 0.830 | 0.690 | 0.620 | 0.570 |
| F1 | 0.939 | 0.789 | 0.889 | 0.942 | 0.728 | |
| HTTP | F1 | 0.841 | 0.831 | 0.472 | 0.428 | 0.483 |
| Average | — | 0.721 | 0.609 | 0.511 | 0.451 | 0.501 |
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"Akahsizrr/Cyber-Prime-1-2.6B",
torch_dtype="auto",
device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained("Akahsizrr/Cyber-Prime-1-2.6B")
# NER extraction (Alpaca format)
prompt = """### Instruction:
Extract cybersecurity entities from the given text.
### Input:
APT29 used WELLMAIL to compromise Microsoft Exchange servers via CVE-2021-26855.
### Response:
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=200, do_sample=False)
print(tokenizer.decode(output[0], skip_special_tokens=True))
@misc{cyberprime1,
title={Cyber-Prime 1: A Small Cybersecurity Language Model},
author={Akahsizrr},
year={2025},
url={https://huggingface.co/Akahsizrr/Cyber-Prime-1-2.6B}
}
@misc{liu2024cyberbench,
title={Cyberbench: A multi-task benchmark for evaluating large language models in cybersecurity},
author={Liu, Zefang and Shi, Jialei and Buford, John F},
howpublished={AAAI-24 Workshop on Artificial Intelligence for Cyber Security (AICS)},
year={2024}
}