Run this model with HF Jobs
Run barha/granite-genai-attack-vector-350m-lora on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/barha/granite-genai-attack-vector-350m-lora. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/barha/granite-genai-attack-vector-350m-lora on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/barha/granite-genai-attack-vector-350m-lora. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/barha/granite-genai-attack-vector-350m-lora. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use barha/granite-genai-attack-vector-350m-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use barha/granite-genai-attack-vector-350m-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("ibm-granite/granite-4.0-350m") model = PeftModel.from_pretrained(base_model, "barha/granite-genai-attack-vector-350m-lora") - Notebooks
- Google Colab
- Kaggle
Granite 4.0 350M β GenAI Attack-Vector Classification LoRA
A LoRA adapter for ibm-granite/granite-4.0-350m
that classifies a described GenAI security incident into one of 14 attack-vector
classes (a closed set).
This is one of three adapters built to share a single Granite Switch checkpoint
(alongside CTI technique-mapping and text-to-JSON generation), so its LoRA shape is
identical across all three: rank 16, alpha 32, on the fused q/k/v/o attention
projections and the input_linear / output_linear MLP projections.
Evaluation
Held-out eval (n = 222), greedy decoding, exact-match over the 14-class label set:
| Metric | Score |
|---|---|
| Accuracy | 74.8% (166 / 222) |
| Macro-precision | 77.4 |
| Macro-recall | 74.9 |
| Macro-F1 | 75.1 |
| Malformed generations | 0 |
Intended use
Triage / routing of GenAI-related security incident reports into a fixed attack-vector taxonomy. Defensive-security use; outputs should be reviewed by an analyst.
Quick start
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = "ibm-granite/granite-4.0-350m"
tok = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(base, device_map="cuda")
model = PeftModel.from_pretrained(model, "barha/granite-genai-attack-vector-350m-lora")
messages = [{"role": "user", "content": "<incident description here>"}]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to("cuda")
out = model.generate(inputs, max_new_tokens=32)
print(tok.decode(out[0, inputs.shape[1]:], skip_special_tokens=True))
Training
- Base:
ibm-granite/granite-4.0-350m - Method: supervised fine-tuning (TRL), LoRA r=16 / Ξ±=32, dropout 0.05
- Target modules:
q_proj,k_proj,v_proj,o_proj,input_linear,output_linear - Data:
emmanuelgjr/genai-incidents
License: Apache-2.0
- Downloads last month
- 15
Model tree for barha/granite-genai-attack-vector-350m-lora
Base model
ibm-granite/granite-4.0-350m-base