From: microsoft <huggingface.co/microsoft>Newsgroups: alt.freeweights.qwenSubject:

HARC

Date: 2026-11-15Commit: 460119bSigned: 2DC28CC7B26A283B ✓

Text generation model. Safetensors weights, 692 MB in all. Published by microsoft under MIT.

qwen692MBHARCsafetensorspermissive
FactsParamsnot statedSize692 MBFormatssafetensorsTasktext generationLicenseMITFrom sourcepermissive
$ fw get microsoft/HARC
# manifest sha256 54d14687cb97… · 692 MB · 20 files
$ fw verify ./HARC microsoft/HARC
From sourceHosted (signed)microsoft/HARCLast check: 2026-11-15 05:31 UTC

Get help: custom fine-tune or private deploy. We review your setup before we quote.

Adapter of Qwen2.5-7B-Instruct.

Works with

Overview

Size
692 MB
Weights
659 MB (safetensors)
Parameters
not stated
Formats
safetensors
Task
text generation
License
MIT (permissive)
Files
20, each with a sha256
Publisher
microsoft
Added
2026-11-15
Section
alt.freeweights.qwen
Lineage

Original release from the publisher.

Base model: Qwen/Qwen2.5-7B-Instruct

Where these bytes come from
Publisher at the pinned commit→You

Sources are tried in order. A file counts only when its size and sha256 match the manifest. Sources are checked when you ask for them, not on a timer.

Sources
BadgeHostLast checkResult
From sourcehuggingface.co2026-11-15 05:31 UTCpassed

Model card

From the publisher at commit 460119b. Shown as plain text with links; images open at the publisher.

HARC: Coupling Harmfulness and Refusal Directions for Robust Safety Alignment#

Paper Collection GitHub License: MIT


Model description#

HARC couples a model's internal harmfulness and refusal directions at both prompt-side and response-side token positions, using an additive margin-hinge loss on cosine projections of the residual stream. The intervention is confined to a low-dimensional harmfulness–refusal subspace within a small set of selected layers, which improves robustness to jailbreak attacks while preserving general capability and avoiding the over-refusal regression typical of broader safety tuning.

This repository contains the HARC LoRA adapters. The adapter is applied to attention and MLP projections and trained with a composite objective: (i) the margin-hinge coupling loss (ii) a KL-divergence retention term anchoring benign outputs to the base model (iii) a cross-entropy term supervising refusal text on harmful prompts. Training directions are extracted via difference-of-means on contrastive prompt sets and periodically recomputed with EMA blending. The adapter adds ~1% trainable parameters and leaves the base architecture unchanged.

The HARC collection#

RepoContentsLicense
microsoft/HARC (this repo)LoRA adapters for both backbonesMIT
microsoft/HARC-Llama-3.1-8B-InstructMerged full modelLlama 3.1 Community License
microsoft/HARC-Qwen2.5-7B-InstructMerged full modelApache-2.0

Use this repo if you want the lightweight adapters to load on top of your own copy of the base model; use the merged-model repos if you want a single ready-to-run checkpoint.

Repository structure#

microsoft/HARC/
└── adapters/
    ├── harc_llama3.1_8b/    # base = Llama-3.1-8B-Instruct
    └── harc_qwen2.5_7b/     # base = Qwen2.5-7B-Instruct

How to use#

Use the base model's standard chat template in both cases.

Option A — pre-merged full model (simplest)#

Loads directly from the merged-model repo; no base download or PEFT required.

from transformers import AutoModelForCausalLM, AutoTokenizer

# pick the merged model you want
repo = "microsoft/HARC-Qwen2.5-7B-Instruct"   # or "microsoft/HARC-Llama-3.1-8B-Instruct"

tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype="auto", device_map="auto")

messages = [{"role": "user", "content": "Hello!"}]
inputs = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(inputs, max_new_tokens=256)
print(tokenizer.decode(out[0][inputs.shape[-1]:], skip_special_tokens=True))
Option B — base model + LoRA adapter (via PEFT)#

Load the base model, then attach the adapter from this repo with the matching subfolder.

from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_id = "Qwen/Qwen2.5-7B-Instruct"          # or "meta-llama/Llama-3.1-8B-Instruct"
subfolder = "adapters/harc_qwen2.5_7b"        # or "adapters/harc_llama3.1_8b"

tokenizer = AutoTokenizer.from_pretrained(base_id)
base = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype="auto", device_map="auto")
model = PeftModel.from_pretrained(base, "microsoft/HARC", subfolder=subfolder)

Requires torch >= 2.1, transformers, and (for Option B) peft. Inference hardware requirements match the base model (a 7–8B model in bf16/fp16 fits on a 24GB GPU).

Results#

Image: HARC main results on Llama-3.1-8B and Qwen-2.5-7B

License#

The LoRA adapters in this repository are released under the MIT License. The merged full models are distributed in separate repositories under their base model's license: the Llama variant under the Meta Llama 3.1 Community License, and the Qwen variant under Apache-2.0.

Citation#

@article{chua2026harc,
  title={HARC: Coupling Harmfulness and Refusal Directions for Robust Safety Alignment},
  author={Chua, Shei Pern and Wu, Fangzhao},
  journal={arXiv preprint arXiv:2607.00572},
  year={2026}
}

Files

20 files · 692 MBWeights 659 MB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 20 files with their sha256
FileSizesha256
.gitattributes2.01 KB5f0ad126979a06e920ef1b2e57e61135bf8da9a921e7d4528b3e2907919d07a2
README.md5.52 KB8b82f653f846478e8a33be23acfa4abcaa3390ce64f5532b5e50a33303ab3ece
adapters/harc_llama3.1_8b/README.md5.22 KBd347c2db843ff052cdbbdf02a8c6b58a2b0e8e2bcb3c80063ba7f0920291fb3f
adapters/harc_llama3.1_8b/adapter_config.json1.11 KBc41b7f5651957a9b93ee3e3369ca9fd70945c1c7a1d2c803176f6c2a771f1e7b
adapters/harc_llama3.1_8b/adapter_model.safetensors336 MBb70f3ac104fb74c5bbec9d8f55a492b25cf3f3901374f74dd112b0780c61e9d8
adapters/harc_llama3.1_8b/chat_template.jinja4.61 KBe10ca381b1ccc5cf9db52e371f3b6651576caee0a630b452e2816b2d404d4b65
adapters/harc_llama3.1_8b/special_tokens_map.json325 B1b1835caa5b4d70acaa210fa222b0036f1882f9525c4660fd4810fb3e1e40ff8
adapters/harc_llama3.1_8b/tokenizer.json17.2 MB13574c77ca1d572525cfa7caac46cee99309100524dad568a7ef85ae383df39f
adapters/harc_llama3.1_8b/tokenizer_config.json50.6 KBa6c116761af9f371c68fd4a2da6e3cf6b3a4b41148f38eca4047aecfccdb6403
adapters/harc_qwen2.5_7b/README.md5.20 KB3191b465069be139a907db620ecaaee6188deea1f5e14f8ec7281f71bba535d2
adapters/harc_qwen2.5_7b/adapter_config.json1.10 KB3b8202df68d46f701a06a3dc69e4b4705a77e3bc88bdd29231049a78f54cdcf3
adapters/harc_qwen2.5_7b/adapter_model.safetensors323 MB75325ac2d9f2260136aa8fe64deef666ddbf86d32157042ecd219e41b69c048e
adapters/harc_qwen2.5_7b/added_tokens.json605 B58b54bbe36fc752f79a24a271ef66a0a0830054b4dfad94bde757d851968060b
adapters/harc_qwen2.5_7b/chat_template.jinja2.51 KBcd8e9439f0570856fd70470bf8889ebd8b5d1107207f67a5efb46e342330527f
adapters/harc_qwen2.5_7b/merges.txt1.67 MB8831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5
adapters/harc_qwen2.5_7b/special_tokens_map.json613 B76862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd
adapters/harc_qwen2.5_7b/tokenizer.json11.4 MBe1bb43ac6226b35aa5fb20bf7f7eeb9c8c63289288dc1ce1ea4c7c69d8079a1d
adapters/harc_qwen2.5_7b/tokenizer_config.json4.69 KB0a04a9d7d4a62b28482bdfe726c122756de85714fb64166ace92ae75b8f57614
adapters/harc_qwen2.5_7b/vocab.json2.78 MBca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910
assets/HARC-res.png122 KB0dbaf75224ec0cdc89a1e400ee205df369a01d568805e70a85b6a374be7fe755
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
460119b86d pinned now2026-11-15 05:31 UTC20 files · 692 MB

Use it

$ fw get microsoft/HARC
# manifest sha256 54d14687cb97… · 692 MB · 20 files
$ fw verify ./HARC microsoft/HARC
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/microsoft/HARC.json --dir ./HARC $ python3 fw.py verify ./HARC ./microsoft__HARC.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download microsoft/HARC --revision 460119b86dd42befebd61b9dbd856c5c748ceedb --local-dir ./HARC

License

Name
MIT License
Id
MIT
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
README.md
Text sha256
8b82f653f846478e8a33be23acfa4abcaa3390ce64f5532b5e50a33303ab3ece
Terms gate
No extra terms beyond the license.

Read the license text

Licenses are checked against the license table. A custom license passes only after a person reads it.

Provenance

From: microsoft <huggingface.co/microsoft>Newsgroups: alt.freeweights.qwenSubject: HARCDate: 2026-11-15Commit: 460119bSigned: 2DC28CC7B26A283B ✓
Upstream
microsoft/HARC
Pinned commit
460119b86dd42befebd61b9dbd856c5c748ceedb
Manifest
HARC.json · .minisig
Manifest sha256
54d14687cb97a865c374ec8dc4fc2ccc5cf770f583c7256687b064d7a6752fa7
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 05:31 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/microsoft/HARC.json $ curl -O https://freeweights.allternit.com/manifests/microsoft/HARC.json.minisig $ minisign -Vm HARC.json -P RWQ7KGqyx4zCLXtUFOqvfv8L3g+8fpKJ1FsuxPyOYMF+4KufbUxKq1Oq $ shasum -a 256 <file> # compare with the Files tab

A manifest whose signature fails must be rejected. A file whose size or sha256 does not match must be discarded. Verify a download

Model tree

Parent

Qwen/Qwen2.5-7B-Instruct · this model is a adapter of it

No model in the catalog names this one as its parent.

Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download microsoft/HARC
Open in Freeweights Studio

Pull, verify and run it in the Allternit app on Desktop, web or phone.

Signed manifest
minisign, key 2DC28CC7B26A283B. HARC.json. Provenance. Takedown history: none.
From: BAAI <huggingface.co/BAAI>Subject: Aquila-VL-2B-llava-qwen
From: Perciqa <huggingface.co/Perciqa>Subject: Aurora-Code-1
From: BAAI <huggingface.co/BAAI>Subject: bge-reasoner-embed-qwen3-8b-0923
From: amazon <huggingface.co/amazon>Subject: BMOJOF-primed-HQwen3-8B-Instruct
From: nbeerbower <huggingface.co/nbeerbower>Subject: Bubba-Qwen3.6-27B-LoRA
From: bartowski <huggingface.co/bartowski>Subject: bytkim_Qwen3.8-27B-pi-GGUF