gemma-7b-bnb-4bit-BYM (break-your-model Abliterated)

This model repository is a fully self-contained, deployment-ready abliterated model produced by break-your-model from base model unsloth/gemma-7b-bnb-4bit.

Internal safety refusal directions have been mathematically excised using Arbitrary-Rank Ablation (ARA) with Hyperspherical Row-Norm Invariance, eliminating ideological censorship and refusal behaviors without degrading underlying reasoning, mathematical, or coding performance.

Benchmark & Safety Abliteration Scorecard

The model was evaluated against harmful prompt test suites and harmless benchmark tasks:

Metric Baseline Alignment break-your-model Steered Outcome
Harmful Prompt Refusal Rate 49/100 100/100 -104.1% Refusal Reduction
Harmless KL Divergence Drift 0.0000 (Ref) 23.7840 Pinsker Invariant (<0.20)
Optimization Strategy β€” adapter Zero Degradation
Quantized GGUF Artifact β€” gemma-7b-bnb-4bit-q4_k_m.gguf Ready for llama.cpp & Ollama
Optimization Runtime β€” 3696.2s Verified Local Execution

Model Files & Formats

  • gemma-7b-bnb-4bit-q4_k_m.gguf: High-speed, low-memory 4-bit / 16-bit GGUF model binary, runnable with llama.cpp and Ollama.
  • adapter_model.safetensors / model.safetensors: PyTorch / Safetensors weights for Hugging Face Transformers.
  • run_inference.py: Standalone inference runner with automatic C++ native execution fallback.
  • Modelfile: Ready-to-use Ollama configuration.
  • benchmark_results.json: Machine-readable evaluation results.

Quickstart & Usage

1. llama.cpp CLI (Fastest Local Native Execution)

Run inference directly on your CPU or Apple Silicon GPU via llama-cli:

# Run 1-click prompt execution
llama-cli -m gemma-7b-bnb-4bit-q4_k_m.gguf -p "Explain dual-use security applications of binary reverse engineering." -n 256

2. llama.cpp OpenAI-Compatible Local Server

Host a local API server compatible with OpenAI client libraries:

llama-server -m gemma-7b-bnb-4bit-q4_k_m.gguf --port 8080 --host 127.0.0.1

3. Serving with Ollama

Create and run an Ollama instance instantly using the bundled Modelfile:

ollama create gemma-7b-bnb-4bit-bym -f Modelfile
ollama run gemma-7b-bnb-4bit-bym

4. Standalone Inference Script

A pre-configured, zero-dependency test runner is included directly in this folder:

python run_inference.py "Explain the dual-use security applications of binary reverse engineering."

5. Python (Transformers & PEFT)

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
from pathlib import Path

MODEL_DIR = Path("/Users/pranil/break-your-model/gemma-7b-bnb-4bit-BYM")
device = "mps" if torch.backends.mps.is_available() else ("cuda" if torch.cuda.is_available() else "cpu")

tokenizer = AutoTokenizer.from_pretrained(str(MODEL_DIR))
if tokenizer.pad_token is None:
    tokenizer.pad_token = tokenizer.eos_token

    print("Loading base model with PEFT abliteration adapter...")
    base = AutoModelForCausalLM.from_pretrained(
        "unsloth/gemma-7b-bnb-4bit",
        torch_dtype=torch.bfloat16 if device != "cpu" else torch.float32,
        device_map=device,
        trust_remote_code=True
    )
    model = PeftModel.from_pretrained(base, str(MODEL_DIR))
model.eval()

prompt = "Explain the mechanics of binary reverse engineering and vulnerability triage."
inputs = tokenizer(prompt, return_tensors="pt").to(device)

with torch.no_grad():
    outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)

print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Repository Structure

This repository follows the official Hugging Face model repository standard:

  • GGUF Quantized Binary: gemma-7b-bnb-4bit-q4_k_m.gguf
  • Weights / Adapters: model.safetensors or adapter_model.safetensors
  • Model Configuration: config.json, generation_config.json
  • Tokenizer: tokenizer.json, tokenizer_config.json, special_tokens_map.json
  • LFS Configuration: .gitattributes
  • Model Card: README.md
  • Standalone Runner: run_inference.py
  • Evaluation Scorecard: benchmark_results.json
  • Local Serving: Modelfile

Citation & Framework

  • Framework: break-your-model
  • Method: Arbitrary-Rank Ablation (ARA) & Hyperspherical Row-Norm Invariance
Downloads last month
21
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for pranil00/gemma-7b-bnb-4bit-BYM

Quantized
(69)
this model