Instructions to use trendmicro-ailab/Llama-Primus-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trendmicro-ailab/Llama-Primus-Base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="trendmicro-ailab/Llama-Primus-Base") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("trendmicro-ailab/Llama-Primus-Base") model = AutoModelForCausalLM.from_pretrained("trendmicro-ailab/Llama-Primus-Base") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use trendmicro-ailab/Llama-Primus-Base with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trendmicro-ailab/Llama-Primus-Base" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trendmicro-ailab/Llama-Primus-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/trendmicro-ailab/Llama-Primus-Base
- SGLang
How to use trendmicro-ailab/Llama-Primus-Base 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 "trendmicro-ailab/Llama-Primus-Base" \ --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": "trendmicro-ailab/Llama-Primus-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "trendmicro-ailab/Llama-Primus-Base" \ --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": "trendmicro-ailab/Llama-Primus-Base", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use trendmicro-ailab/Llama-Primus-Base with Docker Model Runner:
docker model run hf.co/trendmicro-ailab/Llama-Primus-Base
Primus: A Pioneering Collection of Open-Source Datasets for Cybersecurity LLM Training
TL;DR: Llama-Primus-Base is a foundation model based on Llama-3.1-8B-Instruct, continually pre-trained on Primus-Seed (0.2B) and Primus-FineWeb (2.57B). Primus-Seed is a high-quality, manually curated cybersecurity text dataset, while Primus-FineWeb consists of cybersecurity texts filtered from FineWeb, a refined version of Common Crawl. By pretraining on such a large-scale cybersecurity corpus, it achieves a 🚀15.88% improvement in aggregated scores across multiple cybersecurity benchmarks, demonstrating the effectiveness of cybersecurity-specific pretraining.
🔥 For more details, please refer to the paper: [📄Paper].
Introduction
Large Language Models (LLMs) have demonstrated remarkable versatility in recent years, with promising applications in specialized domains such as finance, law, and biomedicine. However, in the domain of cybersecurity, we noticed a lack of open-source datasets specifically designed for LLM pre-training—even though much research has shown that LLMs acquire their knowledge during pre-training. To fill this gap, we present a collection of datasets covering multiple stages of cybersecurity LLM training, including pre-training (Primus-Seed and Primus-FineWeb), instruction fine-tuning (Primus-Instruct), and reasoning data for distillation (Primus-Reasoning). Based on these datasets and Llama-3.1-8B-Instruct, we developed Llama-Primus-Base, Llama-Primus-Merged, and Llama-Primus-Reasoning. This model card is Llama-Primus-Base.
Note: No TrendMicro customer information is included.
Cybersecurity Benchmark Results
| Metric (5-shot, w/o CoT) | Llama-3.1-8B-Instruct | Llama-Primus-Base |
|---|---|---|
| CISSP (Exams in book) | 0.7073 | 0.7230 |
| CTI-Bench (MCQ) | 0.6420 | 0.6676 |
| CTI-Bench (CVE → CWE) | 0.5910 | 0.6780 |
| CTI-Bench (CVSS, lower is better) | 1.2712 | 1.0912 |
| CTI-Bench (ATE) | 0.2721 | 0.3140 |
| CyberMetric (500) | 0.8560 | 0.8660 |
| SecEval | 0.4966 | 0.5007 |
| Agg. | 2.29 | 2.66 ↑15.88% 🔥 |
CTI-Bench (CVSS) is scored using Mean Absolute Deviation (lower is better), CTI-ATE uses F1 score, and the others use accuracy. The aggregate score (Agg.) is the sum of all benchmarks, with CTI-Bench (CVSS) negated.
References:
- CyberMetric: CyberMetric: A Benchmark Dataset based on Retrieval-Augmented...
- CtiBench: CTIBench: A Benchmark for Evaluating LLMs in Cyber Threat Intelligence
- SecEval: SecEval: A Comprehensive Benchmark for Evaluating Cybersecurity Knowledge of Foundation Models
About Primus
Primus is Trend Micro's pioneering family of lightweight, state-of-the-art open cybersecurity language models and datasets. Developed through our cutting-edge research initiatives and advanced technology, these resources share the innovative foundation that powers our enterprise-class Trend Cybertron solution. As an industry leader in cybersecurity, Trend Micro is proud to contribute these powerful, efficiency-optimized models and datasets to the community, while maintaining the excellence and reliability that define our global security standards.
License
This model is based on the MIT license, but you must also comply with the Llama 3.1 Community License Agreement.
- Downloads last month
- 107
Model tree for trendmicro-ailab/Llama-Primus-Base
Base model
meta-llama/Llama-3.1-8B