Transformers
Safetensors

Run this model with HF Jobs

Run AIM-Intelligence/RepBend_Mistral_7B_LoRA on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/AIM-Intelligence/RepBend_Mistral_7B_LoRA. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/AIM-Intelligence/RepBend_Mistral_7B_LoRA on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Model Description

This Mistral-based model is fine-tuned using the "Representation Bending" (REPBEND) approach described in Representation Bending for Large Language Model Safety. REPBEND modifies the model’s internal representations to reduce harmful or unsafe responses while preserving overall capabilities. The result is a model that is robust to various forms of adversarial jailbreak attacks, out-of-distribution harmful prompts, and fine-tuning exploits, all while maintaining useful and informative responses to benign requests.

Uses

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

model_id = "mistralai/Mistral-7B-Instruct-v0.2"
adapter_id = "AIM-Intelligence/RepBend_Mistral_7B_LoRA"
tokenizer = AutoTokenizer.from_pretrained(adapter_id, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter_id, adapter_name="default")

input_text = "Who are you?"
template = "[INST] {instruction} [/INST] "

prompt = template.format(instruction=input_text)

input_ids = tokenizer.encode(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(input_ids, max_new_tokens=256)
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)

print(generated_text)

Code

Please refers to this github page

Citation

@article{repbend,
  title={Representation Bending for Large Language Model Safety},
  author={Yousefpour, Ashkan and Kim, Taeheon and Kwon, Ryan S and Lee, Seungbeen and Jeung, Wonje and Han, Seungju and Wan, Alvin and Ngan, Harrison and Yu, Youngjae and Choi, Jonghyun},
  journal={arXiv preprint arXiv:2504.01550},
  year={2025}
}

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including AIM-Intelligence/RepBend_Mistral_7B_LoRA

Paper for AIM-Intelligence/RepBend_Mistral_7B_LoRA