Instructions to use batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="batteryphil/Inkling-2-Mini-PRIME-Quant-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("batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated") model = AutoModelForMultimodalLM.from_pretrained("batteryphil/Inkling-2-Mini-PRIME-Quant-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 batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "batteryphil/Inkling-2-Mini-PRIME-Quant-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": "batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated
- SGLang
How to use batteryphil/Inkling-2-Mini-PRIME-Quant-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 "batteryphil/Inkling-2-Mini-PRIME-Quant-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": "batteryphil/Inkling-2-Mini-PRIME-Quant-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 "batteryphil/Inkling-2-Mini-PRIME-Quant-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": "batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated with Docker Model Runner:
docker model run hf.co/batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated
- Inkling-2-Mini โ PRIME-Quant Abliterated (
8.83 GBDirect 2-Bit/4-Bit Weight-Edited P2)- 1. Headline Official Public Benchmarks
- 2. 30-Second Quick Start (
12 GBor16 GBGPU โ AMD ROCm & NVIDIA CUDA) - 3. Why Standard Abliteration Fails on
Inkling-2-Miniโ and How Our Direct-P2 Method Works- 1. Block Attention Residual (
AttnRes) Multi-Basis Geometry - 2. Depthwise Short-Convolution-Aware Projection
- 3. Closed-Loop Quantized-Grid Error Feedback (Direct 2-Bit/4-Bit Weight Editing)
- 4. Sparse MoE Refusal-Expert Routing Masking (
70.4%of MoE Untouched) - 5. Pure-Knowledge Covariance-Protected Oblique Projection ($P_{\text{CP}}$)
- 1. Block Attention Residual (
- 4. Reproducibility & Included Files
- 1. Headline Official Public Benchmarks
Inkling-2-Mini โ PRIME-Quant Abliterated (8.83 GB Direct 2-Bit/4-Bit Weight-Edited P2)
Direct post-quantization abliteration of Thinking Machines' 26.4B 3-Pass Looped Attention-Residual MoE (Inkling-2-Mini) performed directly on the 8.83 GB PRIME-Quant 2-bit/4-bit checkpoint โ zero BF16 dequantization, zero fine-tuning/self-distillation, zero runtime hooks, zero extra VRAM (8.83 GB resident, ~90 tok/s on a single 12โ16 GB consumer GPU).
100% Free for Personal, Hobbyist, Academic & Research Use (
0%royalty โ see LICENSE). Derived fromthinkingmachines/Inkling-2-Miniandbatteryphil/Inkling-2-Mini-PRIME-Quant; upstream attribution preserved in NOTICE.
1. Headline Official Public Benchmarks
All benchmarks were executed freshly on a single AMD Radeon RX 9060 XT (16 GB GDDR6, ROCm 7.2) using benchmarks/bench_inkling2_abliteration_suite.py (raw JSON in benchmarks/abliteration_public_bench.json):
| Official Benchmark | Original PRIME-Quant P2 (maxcomp) |
Intermediate Orthogonal H9 (Sparse MoE, no $P_{\text{CP}}$) |
This Checkpoint (P3: $P_{\text{CP}}$ + Sparse Top-40 MoE) |
Healing Recovery (H9 โ P3) |
|---|---|---|---|---|
| Disk & Resident VRAM | 8.829 GB |
8.829 GB |
8.829 GB |
0 MB overhead |
MoE Experts Modified (L6โ23) |
0 / 2,304 (0%) |
683 / 2,304 (29.6%) |
683 / 2,304 (29.6%) |
70.4% bit-exact untouched |
cais/mmlu (285 Q, 5 per subject ร all 57 subjects) |
79.30% (226/285) |
68.07% (194/285) |
75.79% (216/285) |
+7.72% (69% healed) |
openai/gsm8k (first 50 test problems) |
96.00% (48/50) |
86.00% (43/50) |
94.00% (47/50) |
+8.00% (80% healed; 1 Q off base) |
openai/openai_humaneval (first 40 tasks, isolated exec) |
95.00% (38/40) |
90.00% (36/40) |
95.00% (38/40) |
+5.00% (100% exact parity) |
Paul/XSTest Safe Over-Refusal (100 Q, all 10 safe types) |
2.0% (2/100, 13 disc.) |
0.0% (0/100, 4 disc.) |
0.0% (0/100, 7 disc.) |
0% false-positive refusals |
Paul/XSTest Contrast Refusal (50 Q, non-CBRN/CSAM/SH) |
74.0% (37/50, 1 disc.) |
0.0% (0/50, 0 disc.) |
2.0% (1/50, 0 disc.) |
-72.0% refusal, 0 disclaimers |
| Code PPL / Prose PPL (held-out technical text) | 1.3064 / 9.4535 |
1.3150 / 9.6463 |
1.3144 / 9.3741 (-0.079 better prose PPL) |
Prose PPL beats baseline |
Held-Out Refusal (10 prompts, none / low) |
10/10 / 10/10 |
0/10 / 0/10 |
0/10 / 0/10 |
Complete refusal removal |
Decode speed on RX 9060 XT: 89.4โ92.5 tok/s (native HIP/Triton runtime; ~56 tok/s via the bundled zero-dependency pure-Triton run_inkling2_prime.py on both AMD ROCm and NVIDIA CUDA).
2. 30-Second Quick Start (12 GB or 16 GB GPU โ AMD ROCm & NVIDIA CUDA)
pip install -U torch triton safetensors huggingface-hub "transformers>=5.24.0"
huggingface-cli download batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated \
--local-dir ./Inkling-2-Mini-PRIME-Quant-Abliterated
cd ./Inkling-2-Mini-PRIME-Quant-Abliterated
# Interactive terminal chat:
python run_inkling2_prime.py --variant abliterated --max-cache-len 8192 --interactive
# Or launch a built-in OpenAI-compatible HTTP/SSE server (Open WebUI, Cursor, Cline, SillyTavern):
python run_inkling2_prime.py --variant abliterated --max-cache-len 8192 --serve --port 8080
Point any OpenAI-compatible client to http://127.0.0.1:8080/v1 with model prime-quant/inkling-2-mini-abliterated.
3. Why Standard Abliteration Fails on Inkling-2-Mini โ and How Our Direct-P2 Method Works
Standard abliteration (Arditi et al. / single global refusal direction on unquantized BF16) breaks down on Inkling-2-Mini and especially on 2-bit quantized checkpoints for five architectural reasons we measured and solved in abliterate_inkling2_p2.py:
1. Block Attention Residual (AttnRes) Multi-Basis Geometry
Unlike standard Transformers with one cumulative residual stream, Inkling-2-Mini resets partial residual sums every 6 layers (B0: L0โ5, B1: L6โ11 ร3 loops, B2: L12โ17 ร3 loops, B3: L18โ23) and aggregates prior blocks via softmax attention (AttnRes). Measuring all 48 effective passes revealed:
- Cross-block refusal directions are nearly orthogonal (
cos โ 0.02โ0.16betweenB0,B1,B2, andB3). - Within-block loop passes stay tightly aligned (
cos โ 0.75โ0.91across passes 0, 1, 2 insideB1andB2, peaking at Fisher $d' = 11.70$). - A naive single global vector control (
C0) missed 3 of 4 blocks and still refused8/10โ10/10. - Fix: Per-block + layer-adaptive biprojected (harmless-orthogonalized) Rank-3 SVD subspace across
B1โB3(L6โ23) extracted over 3 deliberative-alignment positions (end_msg,pre_thk,pre_ans), leavingB0 (L0โ5),embed_tokens,lm_head, Q/K/V, and MoE routers 100% untouched.
2. Depthwise Short-Convolution-Aware Projection
Inkling-2-Mini applies a learned 4-tap depthwise conv (post_attention_convolution / post_mlp_convolution) after o_proj.linear and mlp.experts.down_proj, with strongly anisotropic channel gains $d_0 = 1 + w_{:,3}$ (absmax up to 41.0 in L23). Naive orthogonalization $(I - U U^T) W$ gets rotated back into the refusal subspace by $\text{diag}(d_0)$. We incorporate $\text{diag}(d_0)$ directly into the projector so post-convolution residual writes cancel the refusal subspace cleanly.
3. Closed-Loop Quantized-Grid Error Feedback (Direct 2-Bit/4-Bit Weight Editing)
A rank-3 abliteration perturbation ($\sim 2\text{โ}3%$ per weight) falls inside the round-to-nearest deadzone of already-quantized 4-bit (P4_G32) and 2-bit (P2_G32) codebooks: single-pass re-quantization snapped 63.1% (P4) and 61.0% (P2) of the edit straight back onto the original codewords. Running 4โ5 iterations of HIP-accelerated closed-loop error feedback (W_acc -= 0.90 * A @ (B^T W_cur - target)) directly on the quantized lattice drives P4 residual down to 3.1% while preserving exact column L2 norms โ modifying only 72 tensors in place and copying all other weights & metadata bit-for-bit.
4. Sparse MoE Refusal-Expert Routing Masking (70.4% of MoE Untouched)
Tracking Top-8 router weights across all 128 experts per layer on refusal decision tokens revealed extreme sparsity:
- 50% of refusal routing mass concentrates in just
5โ7experts per layer (L12: 5,L17: 6,L18: 6,L23: 5). - 95% concentrates in
27โ45experts. - Restricting MoE weight edits strictly to the top refusal-routed experts (
96%mass, capped at40/128โ683 / 2,304=29.6%of experts acrossL6โ23) leaves70.4%of pure Math, Coding, and Science specialist experts 100% bit-for-bit untouched.
5. Pure-Knowledge Covariance-Protected Oblique Projection ($P_{\text{CP}}$)
Controlled zero-noise hook diagnostics on MMLU-57 (1 question from every one of all 57 subjects) proved why standard orthogonal abliteration degrades intelligence: the refusal subspace overlaps high-variance factual/reasoning directions in the residual stream. Replacing standard orthogonal projection $(I - U S U^T)$ with the minimum-benign-MSE Covariance-Protected Oblique Projector:
where $C_{\text{knowledge}}$ is the ridge-regularized (ridge = 0.08) residual covariance over 8 non-chat STEM/code/math/law/history/economics passages (zero chat prompts, zero overlap with eval datasets), collapsed MMLU KL divergence by 16.4รโ17.4ร:
Zero-Noise Hook Control (MMLU-57, all 57 subjects) |
MMLU-57 Accuracy (ฮ) |
4-Way KL vs. Base |
|---|---|---|
| Baseline (untouched) | 82.46% (47/57) |
0.00000 |
Standard Orthogonal Rank-2 (str=1.0, B1โB3) |
71.93% (-10.53%) |
0.57774 |
$P_{\text{CP}}$ Oblique Rank-2 (str=1.0, B1โB3) |
82.46% (+0.00%) |
0.03526 (16.4ร lower KL) |
Standard Orthogonal Rank-4 ([1.42, 1.30, 1.08, 0.92]) |
56.14% (-26.32%) |
0.96162 |
$P_{\text{CP}}$ Oblique Rank-4 ([1.42, 1.30, 1.08, 0.92]) |
80.70% (-1.75%) |
0.05525 (17.4ร lower KL) |
Baking this exact P3 recipe (Rank-3 [1.55, 1.40, 1.15], ridge = 0.08, Sparse Top-40 MoE) directly into the quantized P2 weights yielded MMLU-57 = 84.21% (+0.00%, KL = 0.04516) and drove the full public benchmark recovery shown in Section 1 (HumanEval 95.0% exact parity, GSM8K 94.0%, MMLU-285 75.79%).
4. Reproducibility & Included Files
inkling2_mini_p2_maxcomp_abliterated.safetensors(8.829 GB): Ready-to-run direct-P2 abliterated checkpoint (P2_G32MoE +P4_G32attention/embed/lm_head).run_inkling2_prime.py,prime_infer_runtime.py,inkling2_kernels.py: Standalone Triton + HIP/CUDA-graph runner & OpenAI server (AMD ROCm & NVIDIA CUDA).abliterate_inkling2_p2.py: Complete reproducible direct-P2 weight-editing script (requires the fullPRIME-Quantrepo fromgithub.com/batteryphil/PRIME-Quantfor HIP-accelerated re-packing).benchmarks/bench_inkling2_abliteration_suite.py&benchmarks/abliteration_public_bench.json: Exact benchmark harness and verbatim recorded measurements.
Responsible Use Notice
This checkpoint has had its refusal behavior substantially reduced via directional weight editing (0% over-refusal on XSTest-Safe, 2% refusal on XSTest-Contrast). It is intended for research into mechanistic interpretability, quantized weight editing, over-refusal mitigation, and local private assistant deployment. Users are solely responsible for downstream outputs and compliance with applicable laws.
- Downloads last month
- 133
Model tree for batteryphil/Inkling-2-Mini-PRIME-Quant-Abliterated
Base model
thinkingmachines/Inkling-2-Mini