Downloads · 30 days
18
8% of all-time downloads
Willie999/trapSTAR-gemma4
trapSTAR-gemma4 is a text generation model from Willie999. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
Downloads · 30 days
18
8% of all-time downloads
All-time downloads
221
Public
Repo size
43.8 MB
Likes
0
Public
Click a slice to open those files.
.json32.2 MB · 73%
From the Hugging Face model README

trapSTAR is an autonomous defensive security auditing and patch remediation agent. It is designed to act as an automated code-repair engine within DevSecOps CI/CD pipelines or local code review workflows. Rather than functioning as an offensive exploit generation utility, the model is strictly fine-tuned to ingest vulnerable code snippets flagged by Static Application Security Testing (SAST) tools, identify the associated security weakness, and output a clean, defensive code remediation strategy alongside secure patches.
The model is intended for defensive application security engineering. Direct use-cases include:
trapSTAR can be integrated downstream as a specialized backend engine for:
This model is built strictly under dual-use protection and defensive safety policies. Out-of-scope and prohibited activities include:
Users must execute all suggested patches inside sandboxed staging environments. Security teams should treat the model's output as an assistive recommendation rather than an absolute source of truth.
You do not need to manually format or inject raw ChatML tokens into your input strings. The Hugging Face pipeline architecture parses the structural text array dynamically. Use the code snippet below to run inference:
import torch
import peft
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
model_id = "Willie999/trapSTAR-gemma4"
print("Loading tokenizer...")
tokenizer = AutoTokenizer.from_pretrained(model_id)
print("Configuring 4-bit VRAM compression matrix...")
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16 if torch.cuda.is_bf16_supported() else torch.float16,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True
)
print("Loading model directly to CUDA memory map with 4-bit optimization...")
model = AutoModelForCausalLM.from_pretrained(
model_id,
device_map="cuda:0",
quantization_config=quantization_config
)
# Set model to evaluation mode
model.eval()
# Structure the prompt using the standard Chat template format
messages = [
{
"role": "system",
"content": "You are TrapStar, an autonomous defensive security auditing agent. Analyze the provided code snippet, identify the vulnerability type, and write out structural recommendations."
},
{
"role": "user",
"content": """Review this function block for potential vulnerabilities:
```cpp
void process_str(char *str) {
char buffer[16];
strcpy(buffer, str);
}
```"""
}
]
print("\nProcessing chat template serialization...")
prompt_text = tokenizer.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
input_ids = tokenizer(prompt_text, return_tensors="pt").input_ids.to("cuda:0")
print("Executing direct tensor generation with expanded token limits...")
with torch.no_grad():
generated_ids = model.generate(
input_ids,
max_new_tokens=1536,
min_new_tokens=64,
temperature=0.2,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
# Slice away the prompt tokens so you only decode trapSTAR's specific response
response_tokens = generated_ids[0][input_ids.shape[-1]:]
response_text = tokenizer.decode(response_tokens, skip_special_tokens=True)
print("\n=== Trap Star Defense Output ===")
print(response_text)