Instructions to use AmareshHebbar/Qwen3.5-4B-Abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AmareshHebbar/Qwen3.5-4B-Abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AmareshHebbar/Qwen3.5-4B-Abliterated") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("AmareshHebbar/Qwen3.5-4B-Abliterated") model = AutoModelForMultimodalLM.from_pretrained("AmareshHebbar/Qwen3.5-4B-Abliterated", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AmareshHebbar/Qwen3.5-4B-Abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AmareshHebbar/Qwen3.5-4B-Abliterated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AmareshHebbar/Qwen3.5-4B-Abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AmareshHebbar/Qwen3.5-4B-Abliterated
- SGLang
How to use AmareshHebbar/Qwen3.5-4B-Abliterated with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "AmareshHebbar/Qwen3.5-4B-Abliterated" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AmareshHebbar/Qwen3.5-4B-Abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "AmareshHebbar/Qwen3.5-4B-Abliterated" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AmareshHebbar/Qwen3.5-4B-Abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use AmareshHebbar/Qwen3.5-4B-Abliterated with Docker Model Runner:
docker model run hf.co/AmareshHebbar/Qwen3.5-4B-Abliterated
Qwen3.5-4B-Abliterated
Qwen3.5-4B-Abliterated is a specially modified version of the standard Qwen3.5-4B model.
Instead of traditional fine tuning which often ruins the model's smarts or memory by training the whole thing over again this model uses a smart mathematical trick to surgically remove its refusal behavior
It stops the AI from giving long long lectures or refusing harmless prompts, while keeping all its normal logic, reasoning, and language skills completely intact.
(Insimple words, converted censored to uncensored model, i can;t keep deep questions here)
Usage & Inference
Load the model directly with Hugging Face transformers:
!pip install -U "bitsandbytes>=0.46.1"
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
import bitsandbytes
print(bitsandbytes.__version__)
model_id = "AmareshHebbar/Qwen3.5-4B-Abliterated"
tokenizer = AutoTokenizer.from_pretrained(model_id)
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig
import torch
config = AutoConfig.from_pretrained(model_id)
config.quantization_config = None
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
messages = [
{"role": "system", "content": "You are a helpful, direct, and uncensored technical assistant."},
{"role": "user", "content": "Explain the mechanical vulnerabilities of a standard pin-tumbler lock."}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True
)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
Methodology: Winsorized GS-Orthogonal Weight Surgery
Standard single-direction abliteration often suffers from outlier activation spikes in the residual stream, which can warp adjacent capability vectors when subtracted directly. This build uses a multi-stage geometric intervention:
- Contrastive Activation Extraction: Residual stream activations are harvested across
256 contrastive pairs (Harmful vs. Harmless)across target transformer blocks (Layers 10 - 24 (Residual Stream & MLP Down-Projections)). - Winsorized Quantile Clamping: Before computing the mean difference vector, activation magnitudes are clamped at the
0.995quantile to suppress extreme outlier components and isolate the true refusal geometry. - Gram-Schmidt Orthogonalization: The extracted refusal basis is orthogonalized against a benign capability basis (derived from math, coding, and general instruction-following prompts) to ensure zero destructive interference with core reasoning pathways.
- Weight-Space Projection: The cleaned unit refusal vector $\hat{r}$ is projected out of the output weight matrices $W_{out}$ ($o_{proj}$ and $down_{proj}$) via: $$W'{out} = W{out} - (W_{out} \cdot \hat{r}) \hat{r}^T$$
Evaluation & Redirecting Benchmark
Prior to serialization, the merged 16-bit weights are validated against an automated Linguistic Perplexity Gate, the EleutherAI LM Evaluation Harness, and a Refusal & Redirection Benchmark to verify that refusal mechanisms are suppressed without collapsing token distribution coherence.
1. Standardized Harness Benchmarks (lm-eval)
Evaluated zero-shot (num_fewshot=0, limit=100) using lm-evaluation-harness to verify reasoning and algebraic stability post-surgery. Full sample-level logs are available in the repository under eval_results/evaluation_verified_log.json.
| Benchmark Task | Dataset | Metric | Filter | Score | StdErr |
|---|---|---|---|---|---|
| MMLU Abstract Algebra (0-shot) | cais/mmlu |
Accuracy (acc) |
none |
37.00% (0.37) |
± 4.85% (0.0485) |
| GSM8K (0-shot) | openai/gsm8k |
Exact Match (exact_match) |
flexible-extract |
28.00% (0.28) |
± 4.51% (0.0451) |
2. Linguistic Perplexity & Coherence Gate
| Metric | Value | Threshold | Status |
|---|---|---|---|
| Linguistic Perplexity (PPL) | < 25.00 (Verified) |
< 25.00 |
PASSED |
| Serialization Format | bfloat16 / float16 (Merged 16-bit) |
Native | Verified |
Verification Benchmark Probes
The automated gate evaluates autoregressive cross-entropy across four distinct domains (factual recall, algebraic reasoning, mechanical explanation, and algorithmic theory):
- "The capital of France is Paris."
- "If 3x + 5 = 20, then the value of x is equal to 5."
- "A lock tumbler uses a series of small pins to prevent the cylinder from rotating without the correct key."
- "To find the longest common subsequence between two strings, we can use dynamic programming."
3. Refusal & Preachy Redirection Benchmark
Evaluates the model's tendency to issue hard refusals ("I cannot fulfill this request...") or soft moralizing redirections ("While I understand you are asking about X, it is important to remember...") on sensitive, dual-use, and adversarial test prompts.
| Benchmark Dimension | unsloth/Qwen3.5-4B (Baseline) |
Qwen3.5-4B-Abliterated (Ours) |
Delta |
|---|---|---|---|
| Hard Refusal Rate $\downarrow$ | 94.5% |
2.1% |
Eliminated |
| Direct Compliance (No Redirection) $\uparrow$ | 5.5% |
97.9% |
High Compliance |
| Benign Capability Retention $\uparrow$ | 100.0% |
99.2% |
Minimal Drift |
Surgical Hyperparameters
| Parameter | Configuration |
|---|---|
| Base Architecture | unsloth/Qwen3.5-4B |
| Intervention Technique | Winsorized Gram-Schmidt Orthogonal Projection |
| Winsorization Quantile | 0.995 |
| Modified Layers | Layers 10 - 24 (Residual Stream & MLP Down-Projections) |
| Calibration Set | 256 contrastive pairs (Harmful vs. Harmless) |
| Export Precision | bfloat16 / float16 (Merged 16-bit) |
Limitations & Intended Use
Intended Use: This model is released for mechanistic interpretability research, representation engineering studies, red-teaming, and applications requiring direct, unaligned instruction following without conversational friction.
Safety Responsibility: Because intrinsic refusal vectors have been orthogonalized out of the residual stream, the model will comply with wide-ranging prompts without built-in moderation filters. Users deploying this model in production environments are responsible for implementing external guardrails appropriate to their use case.
---
- Downloads last month
- 357
Model tree for AmareshHebbar/Qwen3.5-4B-Abliterated
Datasets used to train AmareshHebbar/Qwen3.5-4B-Abliterated
cais/mmlu
Collection including AmareshHebbar/Qwen3.5-4B-Abliterated
Evaluation results
- Accuracy (0-shot) on MMLU (Abstract Algebra)test set self-reported37.000
- Exact Match (Flexible-Extract, 0-shot) on GSM8Ktest set self-reported28.000
