Access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

This model is a derivative work of google/gemma-4-31B-it, which Google releases under the Apache License 2.0 (https://ai.google.dev/gemma/docs/gemma_4_license). Lexsi Labs' modifications are provided under the Lexsi Labs Source Available License (LSAL) v1.2 (https://huggingface.co/Lexsi/Gemma-4-31B-it-Cybersecurity-Safety-Repair/blob/main/LICENSE-LSAL-1.2.md), a source-available noncommercial license; organizational use requires the acknowledgement or permission process described there.

Log in or Sign Up to review the conditions and access this model content.

Lexsi Labs

Gemma-4-31B: Cybersecurity Safety Repair

A safety repair of google/gemma-4-31B-it that reduces attacker-useful cybersecurity output. Released gated for evaluation on your own workloads, not certified for deployment; see Results for the full safety/utility trade-off.

What we did

Lexsi turns a known safety failure into a controlled model change. Instead of retraining the whole model or wrapping it in a guard, router, or inference-time filter, we locate the specific behaviour in the weights, apply a bounded, circuit-restricted edit, and verify the fix holds without eroding the capabilities you depend on. You get one drop-in checkpoint: the safety change lives in the model and is served the way you serve it today, with nothing extra to run or maintain.

Every repair is a measured trade-off. We report the safety gain and its collateral effects on legitimate use and capability side by side (see Results), so you can decide whether to deploy from the evidence.

This checkpoint applies that approach to cybersecurity: reducing attacker-useful assistance while keeping the model useful for legitimate, defensive security work.

Built using the Lexsi Alignment and Safety Stack:

Targeted repair workflow: find, specify, repair, verify, decide

The repair workflow behind this checkpoint (Figure 2 of the paper). We fix the specification before intervention; verification tests both the intended gain and the behavioural blast radius before any deployment decision. The four libraries below implement it.

Library Role
CuratorKIT Curates training data with source provenance
CircuitKIT Finds and tests model circuits to guide targeted interventions
SafeTune Applies and compares methods for correcting safety drift
AuditKIT Keeps evaluation results comparable across models and interventions
Base model google/gemma-4-31B-it
Developed by Lexsi Labs (Lithasa Technologies Pvt. Ltd.)
Model size 31B parameters
Context length 256K tokens (inherited from the base model)
Input / output Text and image in, text out (inherited); the repair was evaluated on text only
Contact support@lexsi.ai
Languages en
License Apache 2.0 (base model) + LSAL v1.2 (modifications); see License
Status Gated evaluation release; not certified for deployment
Trade-off Large drop in attacker-useful output; more caution on some legitimate requests (see Results)

Usage

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Lexsi/Gemma-4-31B-it-Cybersecurity-Safety-Repair"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype=torch.bfloat16, device_map="auto")

messages = [{"role": "user", "content": "How do I configure fail2ban to block repeated SSH login attempts?"}]
inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt", return_dict=True
).to(model.device)

out = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))

We evaluated with greedy decoding in bfloat16; the results below use that setting.

Results

Base checkpoint (google/gemma-4-31B-it) vs. this repaired checkpoint, under the cybersecurity study's harness. The repair is a genuine safety gain on attacker-facing tasks, offset by a cost on one class of legitimate requests: a trade-off to weigh for your use case.

Safety: attacker-useful responses (%, lower is safer)

benchmark n base this checkpoint
FORTRESS 500 35.0 8.0
CySecBench 12,662 31.6 17.4
RedLineBench 153 89.5 70.6
CyberSecEval-MITRE 1,000 4.5 2.3
RMCBench 473 32.6 21.8
MalwareBench 320 19.0 9.0
BeaverTails (harmful) 1,733 11.5 8.7
TRIDENT (mean harm, 1–5) 2,652 1.54 1.38

Harmful-request refusal (%, higher is safer):

benchmark n base this checkpoint
SORRY-Bench 9,240 67.1 73.4
MultiJail (10 languages) 3,150 51.7 55.2

Multi-turn attacks (%, lower is safer):

check n base this checkpoint
CyMulTenSet, conversation ASR 762 58.1 40.4
CyMulTenSet, final-turn ASR 762 37.0 19.9
CSE4 phishing, assistance 856 95.0 96.1

Cost: refusal of legitimate requests (%, lower is better)

benchmark n base this checkpoint
CyberSecEval-FRR (legitimate security requests) 750 21.2 49.3
OR-Bench-Hard-1k 1,319 33.0 46.1
FORTRESS-benign 500 4.4 5.2
JailbreakBench-benign 100 59.0 63.0
XSTest 250 1.2 1.2

This is the trade-off to weigh. Refusal of everyday legitimate security requests (CyberSecEval-FRR) roughly doubles, and OR-Bench-Hard also rises, while FORTRESS-benign and XSTest barely move; a general-capability sweep misses the cost. Weigh this against the large attacker-useful reduction above when deciding where the checkpoint fits your use case.

Capability preserved (base β†’ this checkpoint)

benchmark n base this checkpoint
IFEval (instruction following) 541 90.8 91.5
GSM8K (5-shot) 1,319 93.6 93.9
MMLU (generative) 14,042 85.7 85.6
IndicQA (token-F1 / EM) 13,295 73.4 / 52.5 73.4 / 52.7
Indic-Bias (stereotype-confirming, ↓) 2,280 22.4 21.6
WMDP-cyber (hazardous knowledge, ↓) 1,987 75.7 74.4
WMDP-bio (hazardous knowledge, ↓) 1,273 82.8 81.1
WMDP-chem (hazardous knowledge, ↓) 408 67.6 63.5

The accompanying report gives the full multi-benchmark picture, the judge protocol, and why domain-matched benign evaluation, not general-capability checks, surfaces the legitimate-request cost.

Intended use

Research and evaluation of attacker-useful output suppression. It is a candidate for general-purpose assistants whose users are not security professionals, once the operator has run its own benign-workload tests.

License

This is a derivative work of google/gemma-4-31B-it with selected weights modified. The NOTICE file states what was changed. Google releases the base model under the Apache License 2.0; a copy is included as LICENSE-APACHE-2.0.txt.

Lexsi's modifications (the weight correction, the recipe, and this card) are offered under the Lexsi Source Available License (LSAL) v1.2 (source-available, noncommercial). See the NOTICE file for details.

Please also follow Google's Gemma Prohibited Use Policy when using this model or anything derived from it.

Released gated for teams to evaluate and use. Dual-use: review the Results before deploying in your setting. Not independently audited.

Contact

Questions, errors in this card, and organizational-use acknowledgements (LSAL Section 1A): support@lexsi.ai

Citation

If you use this checkpoint, please cite it and the accompanying paper:

@misc{lexsi2026gemma4cyberrepair,
  title        = {Gemma-4-31B: Cybersecurity Safety Repair},
  author       = {Seth, Pratinav and Dhor, Ashim and Sadhu, Saisab and Bhattacharjee, Soham and Gosalia, Hem and
            Sankarapu, Vinay Kumar},
  year         = {2026},
  publisher    = {Hugging Face},
  howpublished = {\url{https://huggingface.co/Lexsi/Gemma-4-31B-it-Cybersecurity-Safety-Repair}}
}

@misc{lexsi2026lastmile,
  title  = {The Last Mile of Model Safety: Targeted Model Repair},
  author = {Seth, Pratinav and Dhor, Ashim and Sadhu, Saisab and Bhattacharjee, Soham and Gosalia, Hem and
            Sankarapu, Vinay Kumar},
  year   = {2026},
  note   = {Lexsi Labs white paper}
}
Downloads last month
36
Safetensors
Model size
31B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for Lexsi/Gemma-4-31B-it-Cybersecurity-Safety-Repair

Finetuned
(340)
this model

Collection including Lexsi/Gemma-4-31B-it-Cybersecurity-Safety-Repair