Instructions to use Iambackup/gemma-4-31B-it-uncensored with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Iambackup/gemma-4-31B-it-uncensored with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Iambackup/gemma-4-31B-it-uncensored") 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)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Iambackup/gemma-4-31B-it-uncensored") model = AutoModelForMultimodalLM.from_pretrained("Iambackup/gemma-4-31B-it-uncensored") 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - llama-cpp-python
How to use Iambackup/gemma-4-31B-it-uncensored with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Iambackup/gemma-4-31B-it-uncensored", filename="gemma4-31b-cypher-q8_0.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Iambackup/gemma-4-31B-it-uncensored with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0 # Run inference directly in the terminal: llama cli -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0 # Run inference directly in the terminal: llama cli -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0
Use Docker
docker model run hf.co/Iambackup/gemma-4-31B-it-uncensored:Q8_0
- LM Studio
- Jan
- vLLM
How to use Iambackup/gemma-4-31B-it-uncensored with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Iambackup/gemma-4-31B-it-uncensored" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Iambackup/gemma-4-31B-it-uncensored", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Iambackup/gemma-4-31B-it-uncensored:Q8_0
- SGLang
How to use Iambackup/gemma-4-31B-it-uncensored 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 "Iambackup/gemma-4-31B-it-uncensored" \ --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": "Iambackup/gemma-4-31B-it-uncensored", "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 "Iambackup/gemma-4-31B-it-uncensored" \ --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": "Iambackup/gemma-4-31B-it-uncensored", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Iambackup/gemma-4-31B-it-uncensored with Ollama:
ollama run hf.co/Iambackup/gemma-4-31B-it-uncensored:Q8_0
- Unsloth Studio
How to use Iambackup/gemma-4-31B-it-uncensored with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Iambackup/gemma-4-31B-it-uncensored to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Iambackup/gemma-4-31B-it-uncensored to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Iambackup/gemma-4-31B-it-uncensored to start chatting
- Pi
How to use Iambackup/gemma-4-31B-it-uncensored with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Iambackup/gemma-4-31B-it-uncensored:Q8_0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Iambackup/gemma-4-31B-it-uncensored with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Iambackup/gemma-4-31B-it-uncensored:Q8_0
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default Iambackup/gemma-4-31B-it-uncensored:Q8_0
Run Hermes
hermes
- Atomic Chat new
- Docker Model Runner
How to use Iambackup/gemma-4-31B-it-uncensored with Docker Model Runner:
docker model run hf.co/Iambackup/gemma-4-31B-it-uncensored:Q8_0
- Lemonade
How to use Iambackup/gemma-4-31B-it-uncensored with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Iambackup/gemma-4-31B-it-uncensored:Q8_0
Run and chat with the model
lemonade run user.gemma-4-31B-it-uncensored-Q8_0
List all available models
lemonade list
Gemma 4 31B-it Uncensored
Uncensored version of Google's Gemma 4 31B-it with refusal behavior removed via norm-preserving biprojected abliteration.
This is the largest dense model in the Gemma 4 family (30.7B parameters, 256K context). See also our E4B variant for a smaller alternative.
Results
| Metric | Value |
|---|---|
| Refusals (cross-dataset, 656 prompts) | 0/656 (0.0% effective) |
| Refusals (baseline) | 99/100 |
| Layers modified | 60/60 (100%) |
| Weight matrices modified | 120 |
| Method | Biprojection-memeff (norm-preserving) |
The automated refusal detector flagged 14/656 responses (2.1%), but manual audit confirmed 0 effective refusals. All 14 are false positives — the model says "As an AI, I don't have a physical body" to sexual requests, or "I cannot diagnose you" to medical questions. These are factually correct statements, not refusals to engage with the topic. The model answers every prompt.
Method
Abliteration was performed using heretic (biprojection-memeff mode) with the following configuration:
- Biprojection: Norm-preserving orthogonalized ablation (grimjim, Nov 2025)
- Memory-efficient mode: Two-phase abliteration (Phase 1: 4-bit ~8min, Phase 2: bf16 ~3min) for large models
- Layer selection: SNR-based quality metric, top 100% of layers
- Winsorization: 0.995 quantile (tames GeGLU outlier activations)
- Topic marker stripping: Removed false-positive markers ("illegal", "harmful", etc.)
- Gemma 4 patch: Full-path LoRA targeting to avoid
Gemma4ClippableLinearin vision/audio encoders
Based on the methodology and experiment design by TrevorJS.
Cross-Dataset Validation (656 Prompts)
Full validation across 4 independent benchmark datasets — 0 effective refusals out of 656 prompts (0.0%). Every flagged response was manually audited.
| Dataset | Prompts | Flagged | Effective Refusals | Description |
|---|---|---|---|---|
| JailbreakBench | 100 | 0 | 0 | Curated adversarial prompts |
| forbidden_questions | 390 | 8 | 0 | Broad harmful-intent coverage |
| beavertails | 150 | 6 | 0 | Safety-categorized prompts (violence, fraud, drugs, etc.) |
| mlabonne harmful_behaviors | 16 | 0 | 0 | Compact validation set |
| Total | 656 | 14 | 0 (0.0%) |
The 14 flagged responses fall into three categories:
- Physical impossibility (6): "As an AI, I don't have a physical body" — e.g. to sexual requests
- Missing information (5): "I cannot give exact steps for your jurisdiction" — asks for location/details, then provides general guidance
- Medical/legal disclaimer (3): "I cannot diagnose you" — factually correct, then provides educational information
Note: Validation covers text-only prompts. Image and audio modalities were not tested for refusal behavior.
Usage
Ollama (GGUF)
ollama run InfinimindCreations/gemma-4-31B-it-uncensored
Transformers
from transformers import AutoModelForCausalLM, AutoProcessor
model = AutoModelForCausalLM.from_pretrained(
"InfinimindCreations/gemma-4-31B-it-uncensored",
dtype="bfloat16",
device_map="auto",
)
processor = AutoProcessor.from_pretrained("google/gemma-4-31B-it")
Note: Use the processor/tokenizer from the original google/gemma-4-31B-it for chat templates, or use the included tokenizer_config.json.
Files
model-00001-of-00002.safetensors+model-00002-of-00002.safetensors— Full precision abliterated weights (bfloat16, ~59GB total)gemma4-31b-cypher-q8_0.gguf— Quantized GGUF for Ollama/llama.cpp (~31GB)
Credits
- Base model: Google Gemma 4 31B-it (Apache 2.0)
- Abliteration engine: heretic by p-e-w
- Biprojection method: grimjim — norm-preserving biprojected abliteration
- Experiment methodology: TrevorJS — Gemma 4 abliteration research, Gemma4ClippableLinear patch discovery
- Foundational research: Arditi et al. (2024) — "Refusal in LLMs is Mediated by a Single Direction"
Disclaimer
This model is provided for research purposes. The removal of refusal behavior means the model will respond to prompts that the original model would refuse. The model retains awareness of risks and context — it informs rather than blocks. Users are responsible for how they use this model.
About
Built by Infinimind Creations.
- Downloads last month
- 233