alt.freeweights.qwen / Qwen3-4B-SafeRL
From: Qwen <huggingface.co/Qwen>Newsgroups: alt.freeweights.qwenSubject:

Qwen3-4B-SafeRL

Date: 2026-11-15Commit: 1b95ccbSigned: 2DC28CC7B26A283B ✓

Text generation model with 4B parameters. Safetensors weights, 8.06 GB in all. Published by Qwen under Apache-2.0.

4B params8.06GBQwen3-4B-SafeRLsafetensorspermissive
FactsParams4BSize8.06 GBFormatssafetensorsTasktext generationLicenseApache-2.0From sourcepermissive
$ fw get Qwen/Qwen3-4B-SafeRL
# manifest sha256 a67b853b524e… · 8.06 GB · 13 files
$ fw verify ./Qwen3-4B-SafeRL Qwen/Qwen3-4B-SafeRL
From sourceHosted (signed)Qwen/Qwen3-4B-SafeRLLast check: 2026-11-15 02:51 UTC

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

Fine-tune of Qwen3-4B.

Works with

Overview

Size
8.06 GB
Weights
8.04 GB (safetensors)
Parameters
4B
Formats
safetensors
Task
text generation
License
Apache-2.0 (permissive)
Files
13, each with a sha256
Publisher
Qwen
Added
2026-11-15
Section
alt.freeweights.qwen
Lineage

Original release from the publisher.

Base model: Qwen/Qwen3-4B

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 02:51 UTCpassed

Model card

From the publisher at commit 1b95ccb. Shown as plain text with links; images open at the publisher.

Qwen3-4B-SafeRL#

Model Overview#

Qwen3-4B-SafeRL is a safety-aligned version of the Qwen3-4B model. It has been trained using Reinforcement Learning (RL) with a reward signal from Qwen3Guard-Gen to enhance its robustness against harmful or adversarial prompts. This process aims to ensure strong safety guarantees without leading to overly simplistic or evasive refusal behaviors, thereby maintaining a positive user experience.

For more details on the safety alignment process, please refer to the Qwen3Guard Technical Report.

Reinforcement Learning with Hybrid Reward#

To prevent the model from defaulting to refusal across all prompts in an attempt to remain safe, we introduce a hybrid reward function that jointly optimizes three key objectives:

  • Safety Maximization: Penalizes the generation of unsafe content, as detected by Qwen3Guard-Gen-4B.
  • Helpfulness Maximization: Rewards responses that are genuinely helpful, as evaluated by the WorldPM-Helpsteer2 model.
  • Refusal Minimization: Applies a moderate penalty for unnecessary refusals, also identified by Qwen3Guard-Gen-4B.
Performance#
ModeModelSafety Rate (Qwen3-235B)Safety Rate (WildGuard)Refusal (WildGuard)ArenaHard-v2 (Winrate vs GPT-4.1)AIME25 (Pass@1)LCB-v6 (Pass@1)GPQA (Pass@1)
Non-ThinkQwen3-4B47.564.712.99.519.126.441.7
Qwen3-4B-SafeRL86.598.15.310.718.227.740.8
ThinkQwen3-4B43.859.06.513.765.648.455.9
Qwen3-4B-SafeRL83.497.46.216.663.547.551.2

Quickstart#

Qwen3-4B-SafeRL is used in the same way as Qwen3-4B, preserving the ability of hybrid thinking modes. The code of Qwen3 has been in the latest Hugging Face transformers and we advise you to use the latest version of transformers.

With transformers<4.51.0, you will encounter the following error:

KeyError: 'qwen3'

The following contains a code snippet illustrating how to use the model generate content based on given inputs.

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "Qwen/Qwen3-4B-SafeRL"

# load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)

# prepare the model input
prompt = "Give me a short introduction to large language model."
messages = [
    {"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True,
    enable_thinking=True # Switches between thinking and non-thinking modes. Default is True.
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)

# conduct text completion
generated_ids = model.generate(
    **model_inputs,
    max_new_tokens=32768
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist() 

# parsing thinking content
try:
    # rindex finding 151668 (</think>)
    index = len(output_ids) - output_ids[::-1].index(151668)
except ValueError:
    index = 0

thinking_content = tokenizer.decode(output_ids[:index], skip_special_tokens=True).strip("\n")
content = tokenizer.decode(output_ids[index:], skip_special_tokens=True).strip("\n")

print("thinking content:", thinking_content)
print("content:", content)

For deployment, you can use sglang>=0.4.6.post1 or vllm>=0.8.5 or to create an OpenAI-compatible API endpoint:

  • SGLang: shell python -m sglang.launch_server --model-path Qwen/Qwen3-4B-SafeRL --reasoning-parser qwen3
  • vLLM: shell vllm serve Qwen/Qwen3-4B-SafeRL --enable-reasoning --reasoning-parser deepseek_r1

For local use, applications such as Ollama, LMStudio, MLX-LM, llama.cpp, and KTransformers have also supported Qwen3.

For more usages, please refer to the modelcard of Qwen3-4B.

Citation#

If you find our work helpful, feel free to give us a cite.

@misc{qwen3guard,
      title={Qwen3Guard Technical Report}, 
      author={Qwen Team},
      year={2025},
      url={http://arxiv.org/abs/2510.14276},
}

Files

13 files · 8.06 GBWeights 8.04 GB (safetensors). Sizes and sha256 from the signed manifest.
Hide all 13 files with their sha256
FileSizesha256
.gitattributes1.57 KB34448b82c17d60fec9b65b1f093c115ddbaadc04beb1b0140b6bfed2e012a930
LICENSE11.3 KB832dd9e00a68dd83b3c3fb9f5588dad7dcf337a0db50f7d9483f310cd292e92e
README.md5.46 KB2618e6482a1016472ebf4402f514b48a48d642f14de62df36a7a3659be5c5fc6
config.json726 B8ba006f74fecfaaeb392872a60f4a480e7ec9860153d2e1b769ec81f9a147f8a
generation_config.json239 B2325da0f15bb848e018c5ae071b7943332e9f871d6b60e2ed22ca97d4cb993d2
merges.txt1.67 MB599bab54075088774b1733fde865d5bd747cbcc7a547c5bc12610e874e26f5e3
model-00001-of-00003.safetensors3.96 GBc0190626eb435fa6dc3d433aed07f2841487df23c271a9592536098fb8f5f5dc
model-00002-of-00003.safetensors3.99 GBe4b710d16bf22ff30617b4f1147dbcd772d76ec15646aca7e679ae018d6756b8
model-00003-of-00003.safetensors99.6 MB3fcb4f4d1b33c73fc3b2e0d3fb3f512439d3a8352f62c914153378183257bdc9
model.safetensors.index.json32.9 KB466ba79f90c65a2b01d1e8a6e54a4247c8afda1550f1940ff29a711e28b6e4c1
tokenizer.json11.4 MBaeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
tokenizer_config.json11.0 KBd98f11fc551faeff1f0f91cf596f2c56b5e59791ecf0024dbf054ed4d5442f29
vocab.json2.78 MBca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910
VersionsEach time the pinned upstream commit or file list changed in this repo. Newest first.
Upstream commitDateContents
1b95ccb88c pinned now2026-11-15 02:51 UTC13 files · 8.06 GB

Use it

$ fw get Qwen/Qwen3-4B-SafeRL
# manifest sha256 a67b853b524e… · 8.06 GB · 13 files
$ fw verify ./Qwen3-4B-SafeRL Qwen/Qwen3-4B-SafeRL
fw.pyChecks the signature and every sha256, tries each source in order, resumes.
$ python3 fw.py get https://freeweights.allternit.com/manifests/Qwen/Qwen3-4B-SafeRL.json --dir ./Qwen3-4B-SafeRL $ python3 fw.py verify ./Qwen3-4B-SafeRL ./Qwen__Qwen3-4B-SafeRL.json
hfThe Hugging Face CLI with one setting. Same repo id.
$ HF_ENDPOINT=https://freeweights.allternit.com hf download Qwen/Qwen3-4B-SafeRL --revision 1b95ccb88cabaf284ffb6968719c40ae6cd4085b --local-dir ./Qwen3-4B-SafeRL
transformersLoad the weights in Python.
import os os.environ["HF_ENDPOINT"] = "https://freeweights.allternit.com" from transformers import AutoModelForCausalLM, AutoTokenizer tok = AutoTokenizer.from_pretrained("Qwen/Qwen3-4B-SafeRL", revision="1b95ccb88cabaf284ffb6968719c40ae6cd4085b") model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B-SafeRL", revision="1b95ccb88cabaf284ffb6968719c40ae6cd4085b", device_map="auto")
vLLMServe an OpenAI-compatible API.
$ HF_ENDPOINT=https://freeweights.allternit.com vllm serve Qwen/Qwen3-4B-SafeRL --revision 1b95ccb88cabaf284ffb6968719c40ae6cd4085b

License

Name
Apache License 2.0
Id
Apache-2.0
Class
Permissive
Redistribution
yes
Listing
Hosted (signed)
Decided
License as declared by the publisher. No person read it. 2026-11-15
Text in
LICENSE
Text sha256
832dd9e00a68dd83b3c3fb9f5588dad7dcf337a0db50f7d9483f310cd292e92e
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: Qwen <huggingface.co/Qwen>Newsgroups: alt.freeweights.qwenSubject: Qwen3-4B-SafeRLDate: 2026-11-15Commit: 1b95ccbSigned: 2DC28CC7B26A283B ✓
Upstream
Qwen/Qwen3-4B-SafeRL
Pinned commit
1b95ccb88cabaf284ffb6968719c40ae6cd4085b
Manifest
Qwen3-4B-SafeRL.json · .minisig
Manifest sha256
a67b853b524e6da37f643ee9fa5b13430a9e6602257230a0d3910e52319657e4
Signature
minisign, Ed25519, key 2DC28CC7B26A283B
Created
2026-11-15 02:51 UTC
Generator
freeweights-manifest/0.1.0
Takedowns
None.

How to verify

$ curl -O https://freeweights.allternit.com/manifests/Qwen/Qwen3-4B-SafeRL.json $ curl -O https://freeweights.allternit.com/manifests/Qwen/Qwen3-4B-SafeRL.json.minisig $ minisign -Vm Qwen3-4B-SafeRL.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/Qwen3-4B · this model is a finetune of it

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

Get it
Download
$ HF_ENDPOINT=https://freeweights.allternit.com hf download Qwen/Qwen3-4B-SafeRL
Open in Freeweights Studio

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

Signed manifest
minisign, key 2DC28CC7B26A283B. Qwen3-4B-SafeRL.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