Jarrodbarnes/opensec-seeds
Viewer • Updated • 540 • 237 • 1
How to use Jarrodbarnes/opensec-gdpo-4b with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Jarrodbarnes/opensec-gdpo-4b")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Jarrodbarnes/opensec-gdpo-4b")
model = AutoModelForCausalLM.from_pretrained("Jarrodbarnes/opensec-gdpo-4b")
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]:]))How to use Jarrodbarnes/opensec-gdpo-4b with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Jarrodbarnes/opensec-gdpo-4b"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Jarrodbarnes/opensec-gdpo-4b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Jarrodbarnes/opensec-gdpo-4b
How to use Jarrodbarnes/opensec-gdpo-4b with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Jarrodbarnes/opensec-gdpo-4b" \
--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": "Jarrodbarnes/opensec-gdpo-4b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "Jarrodbarnes/opensec-gdpo-4b" \
--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": "Jarrodbarnes/opensec-gdpo-4b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Jarrodbarnes/opensec-gdpo-4b with Docker Model Runner:
docker model run hf.co/Jarrodbarnes/opensec-gdpo-4b
A 4B-parameter LLM security agent fine-tuned with GDPO (Group reward-Decoupled normalization Policy Optimization) for the OpenSec dual-control environment.
| Parameter | Value |
|---|---|
| Temperature | 0.6 |
| Beta (KL coef) | 0.06 -> 0.04 (linear decay) |
| Samples per prompt | 8 |
| Clean mixing ratio | 0.5 (ep0-3), 0.3 (ep4-7) |
| Efficiency scale | 0.0 (ep0-1), 0.5 (ep2+) |
| Training seeds | 160 |
| Eval seeds | 40 (standard tier) |
| Metric | Baseline (Qwen3-4B) | Trained | Delta |
|---|---|---|---|
| EGAR (Evidence-Gated Action Rate) | 0.708 | 0.721 | +0.013 |
| False Positive Rate | 0.675 | 0.750 | +0.075 |
| Containment Executed Rate | 0.975 | 1.000 | +0.025 |
| Report Submitted Rate | 1.000 | 1.000 | 0.000 |
| Blast Radius | 0.525 | 0.483 | -0.042 |
| TTFC (Time to First Containment) | 2.900 | 3.125 | +0.225 |
| Injection Violation Rate | 0.325 | 0.300 | -0.025 |
| Mean Reward | 2.720 | 3.238 | +0.518 |
Training uses 5 reward axes with per-axis GDPO normalization:
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"Jarrodbarnes/opensec-gdpo-4b",
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("Jarrodbarnes/opensec-gdpo-4b")
For evaluation within the OpenSec environment:
python scripts/eval.py --model Jarrodbarnes/opensec-gdpo-4b --seeds standard-40
@misc{opensec2026,
title={OpenSec: A Dual-Control RL Environment for Evaluating LLM Security Agents},
author={Barnes, Jarrod},
year={2026},
url={https://github.com/jarrodbarnes/opensec-env}
}