Edit model card

Model Card for Cyber-risk-llama-2-7b

Model Description

This model is a fine-tuned version of NousResearch/Llama-2-7b-chat-hf on the vanessasml/cyber-reports-news-analysis-llama2-3k dataset.

It is specifically designed to enhance performance in generating and understanding cybersecurity, identifying cyber threats and classifying data under the NIST taxonomy and IT Risks based on the ITC EBA guidelines.

Intended Use

  • Intended users: Data scientists and developers working on cybersecurity applications.
  • Out-of-scope use cases: This model should not be used for medical advice, legal decisions, or any life-critical systems.

Training Data

The model was fine-tuned on vanessasml/cyber-reports-news-analysis-llama2-3k, a dataset focused on cybersecurity news analysis.

Training Procedure

  • Preprocessing: Text data were tokenized using the tokenizer corresponding to the base model NousResearch/Llama-2-7b-chat-hf.
  • Hardware: The training was performed on GPUs with mixed precision (FP16/BF16) enabled.
  • Optimizer: Paged AdamW with a cosine learning rate schedule.
  • Epochs: The model was trained for 1 epoch.
  • Batch size: 4 per device, with gradient accumulation where required.

Evaluation Results

Model evaluation was based on qualitative assessment of generated text relevance and coherence in the context of cybersecurity.

Quantization and Optimization

  • Quantization: 4-bit precision with type nf4. Nested quantization is disabled.
  • Compute dtype: float16 to ensure efficient computation.
  • LoRA Settings:
    • LoRA attention dimension: 64
    • Alpha parameter for LoRA scaling: 16
    • Dropout in LoRA layers: 0.1

Environmental Impact

  • Compute Resources: Training leveraged energy-efficient hardware and practices to minimize carbon footprint.
  • Strategies: Gradient checkpointing and group-wise data processing were used to optimize memory and power usage.

How to Use

Here is how to load and use the model:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "Vanessasml/cyber-risk-llama-2-7b"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

# Example of how to use the model:
prompt = """Question: What are the cyber threads present in the article?
Article: More than one million Brits over the age of 45 have fallen victim to some form of email-related fraud, \
as the internet supersedes the telephone as the favored channel for scammers, according to Aviva. \
The insurer polled over 1000 adults over the age of 45 in the latest update to its long-running Real Retirement Report. \
Further, 6% said they had actually fallen victim to such an online attack, amounting to around 1.2 million adults. \
Some 22% more people it surveyed had been targeted by ...	
"""
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=2048, repetition_penalty=1.2,temperature=0)
# To generate text:
result = pipe(f"<s>[INST] {prompt} [/INST]")
print(result[0]['generated_text'])

Limitations and Bias

The model, while robust in cybersecurity contexts, may not generalize well to unrelated domains. Users should be cautious of biases inherent in the training data which may manifest in model predictions.

Citation

If you use this model, please cite it as follows:

@misc{cyber-risk-llama-2-7b-sft-lora-4bit-float16,
  author = {Vanessa Lopes},
  title = {Cyber-risk-llama-2-7B Model},
  year = {2024},
  publisher = {HuggingFace Hub},
  journal = {HuggingFace Model Hub}
}
Downloads last month
22
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Dataset used to train Vanessasml/cyber-risk-llama-2-7b