Downloads · 30 days
10
6% of all-time downloads
Shlok307/gemma-3-1b-it-cyber-lora
gemma-3-1b-it-cyber-lora is a text generation model from Shlok307. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as gemma.
This model is a LoRA adapter fine-tuned on top of google/gemma-3-1b-it, optimized for safe cybersecurity explanations, vulnerability analysis, and general security guidance. It improves the base Gemma model’s performa…
Downloads · 30 days
10
6% of all-time downloads
All-time downloads
171
Public
Repo size
373 MB
Likes
1
Public
Click a slice to open those files.
.pt192 MB · 55%
From the Hugging Face model README
This model is a LoRA adapter fine-tuned on top of google/gemma-3-1b-it, optimized for safe cybersecurity explanations, vulnerability analysis, and general security guidance. It improves the base Gemma model’s performance on technical cyber topics while keeping responses safe, helpful, and beginner-friendly.
This is a lightweight LoRA (QLoRA) adapter trained on a curated dataset of cybersecurity conversations containing system, user, and assistant messages.
The fine-tuning process enhances Gemma-3-1B to be:
The underlying base model remains google/gemma-3-1b-it.
google/gemma-3-1b-itUse the code below to get started with the model.
!pip install -U bitsandbytes accelerate
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
import torch
base = "google/gemma-3-1b-it"
adapter = "Shlok307/gemma-3-1b-it-cyber-lora"
# 4-bit quantization (recommended)
quant_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype="float16",
bnb_4bit_quant_type="nf4"
)
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained(base)
# Load base model in 4-bit
model = AutoModelForCausalLM.from_pretrained(
base,
quantization_config=quant_config,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(model, adapter)
model.eval()
# Example prompt
prompt = (
"System: You are a straight forward cybersecurity and Fraud detection assistant.\n"
"User: Explain how SQL injection works on website.\n"
"Assistant:"
)
# Tokenize
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Inference
with torch.no_grad():
output = model.generate(
**inputs,
max_new_tokens=450,
temperature=0.7
)
print(tokenizer.decode(output[0], skip_special_tokens=True))
System: <system>
User: <user>
Assistant: <assistant>