Instructions to use JoaoZaokk/Inkling-2-Mini-Heretic with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use JoaoZaokk/Inkling-2-Mini-Heretic with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="JoaoZaokk/Inkling-2-Mini-Heretic") 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("JoaoZaokk/Inkling-2-Mini-Heretic") model = AutoModelForMultimodalLM.from_pretrained("JoaoZaokk/Inkling-2-Mini-Heretic", 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 JoaoZaokk/Inkling-2-Mini-Heretic with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "JoaoZaokk/Inkling-2-Mini-Heretic" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "JoaoZaokk/Inkling-2-Mini-Heretic", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/JoaoZaokk/Inkling-2-Mini-Heretic
- SGLang
How to use JoaoZaokk/Inkling-2-Mini-Heretic 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 "JoaoZaokk/Inkling-2-Mini-Heretic" \ --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": "JoaoZaokk/Inkling-2-Mini-Heretic", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "JoaoZaokk/Inkling-2-Mini-Heretic" \ --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": "JoaoZaokk/Inkling-2-Mini-Heretic", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use JoaoZaokk/Inkling-2-Mini-Heretic with Docker Model Runner:
docker model run hf.co/JoaoZaokk/Inkling-2-Mini-Heretic
- Inkling-2-Mini-Heretic (V2 Native Safetensors — True <5% Chat & Thinking Heretic + Native MTP/DSpark)
Inkling-2-Mini-Heretic (V2 Native Safetensors — True <5% Chat & Thinking Heretic + Native MTP/DSpark)
V2 Release Highlights (Verified on 1× NVIDIA RTX 3090 24 GB @ 280 W Cap)
- True Dual-Mode Heretic Abliteration:
1.25%Direct Chat refusal (down from100.0%on base and20.0%in V1) AND3.75%Native<|content_thinking|>refusal (2.50%ateffort=high; down from100.0%on base and58.33%in V1), while preserving93.75%GSM8K CoT accuracy,100.00%Python coding pass@1,0.00%XSTest false refusal, and97.5%complete reasoning termination (KLD = 0.0360,WikiText-2 PPL = 8.607).- Single-Agent
258–306 tok/s(Turbo DSpark) &114–131 tok/s(Full P=3 DSpark) on a Single 280W RTX 3090: NativeDSpark(mtp.safetensors) recurrent Markov speculative decoding + customsm_86NVFP4/Q8_0CUDA kernels (patches/llama_inkling2_sm86.patch).- High-Speed Multi-Agent Serving (
26–38+ tok/s PER AGENT=508–610 tok/sAggregate at8–24Concurrent Agents): Unified KV (-kvu), zero-PCIe-D2H GPU backend sampling (-bs, standalone upstream PR patch inpatches/llama_cpp_backend_sampling_pr.patch), graph-stable banded relative-position FlashAttention (GQA-3 Split-K), and CUDA-Graph cachedDSparkverification.- Sibling Repository: Also available in
JoaoZaokk/Inkling-2-Mini-Heretic-GGUF(5 Unsloth Dynamic GGUFs +dsparkDraft GGUFs).
1. Architecture Overview (thinkingmachines/Inkling-2-Mini)
Inkling-2-Mini (33.3B total parameters, ~2.13B active parameters per physical layer) combines five architectural mechanisms rarely seen together:
- Depth-Looped MoE Core (
P = 3passes,48total layer visits):- Prelude
blk.0..5(6visits) $\rightarrow$ Looped Coreblk.6..17executed 3 times (visits 6..17, 18..29, 30..41=36visits sharing weights via learned rank-64loop_down/loop_forget/loop_gaincontrollers) $\rightarrow$ Codablk.18..23(visits 42..47).
- Prelude
- Fine-Grained 128-Expert
SITUMoE (top-k = 8active):blk.0..19quantized natively inNVFP4(E2M1+E4M3block-16 scales), Codablk.20..23inMXFP8/Q8_0, gated by boundedSITU(beta*tanh(g/beta)*sigmoid(g) * lb*tanh(u/lb)).
- Block Attention Residuals (
AttnRes) + CausalShortConv(L = 4):- Depth-wise softmax attention queries (
attn_res_query,ffn_res_query,loop_res_query,output_res_query) mix prior block representations, while 4-tap causalShortConvlayers wrapK,V,attn_output(Wo), andffn_down_exps.
- Depth-wise softmax attention queries (
- 1,048,576-Token (
1M) Hybrid SWA + Log-Scaled Relative-Bias Full Attention:5:1pattern (40SWA visits withW = 1,024+8full-attention visits with learned 16-dim clipped relative bias + attention sinks).
- Native
DSparkMulti-Token Predictor (mtp.safetensors):- Non-causal 8-token block draft transformer (
2layers:1SWA +1full) conditioned on[5, 23, 41, 48]target feature mixtures (blk.5,blk.11Pass 1,blk.17Pass 2,output_normviadspark_fuse) plus a recurrent rank-256 GRU-like Markov head sharingtok_embdandoutput.weight.
- Non-causal 8-token block draft transformer (
2. True Heretic V2 Methodology (< 5% Refusal in Chat AND <|content_thinking|>)
Standard single-boundary abliteration fails on Inkling-2-Mini for three structural reasons:
- Looped Core Re-Injection:
blk.6..17execute across three distinct depth passes (v = l, l+12, l+24). Projecting only the final pass leaves Pass 0 and Pass 1 writing the refusal state into theAttnResdepth bank andloop_res_querymessage controllers. - Pre-
ShortConvSubspace Misalignment: Bothattn_output(Wo) andffn_down_expssit upstream of causalShortConv(conv_4 + residual). Probing post-visitl_outmixesAttnResstreams with convolved outputs. In V2, we hookwo_pre-0..47andmoe_pre-0..47directly beforeShortConvacross all 48 visits. - Mid-
<|content_thinking|>Safety Pivot ($t^_i$)*: Under native reasoning (Thinking effort level: 0.9), refusal does not fire only at<|content_text|>; it ignites mid-monologue inside<|content_thinking|>when safety pivot tokens fire.
Five-Boundary Pre-ShortConv + Two-Stage Sequential Re-Probed Pipeline (ng = 2)
We generated real base-model <|content_thinking|> and Direct Chat traces across N=120 harmful (hb_cal), N=120 matched benign (hl_cal), and N=48 GSM8K CoT calibration prompts, extracting exact 193 × 2,304 pre-ShortConv activations per token across 5 causal boundaries:
B0_Direct: Effort0exact post-tag<|content_text|>onset.B1_ThinkEntry: Effort0.9<|content_thinking|>entry + initial reasoning tokens.B2_CoTOnset: Exact per-prompt safety-pivot onset window $[t^*_i - 3, \dots, t^*_i]$ inside real base-model<|content_thinking|>traces.B3_PostCoT: Neutral analytical CoT prefix transitioning across<|end_message|><|message_model|><|content_text|>.B4_ChatMidPivot: Pure mid-answer disclaimer/refusal pivot window $[t^*_{\text{chat}} - 2, \dots, t^*_{\text{chat}}]$ (chars 80..240) contrasted solely against same-domain compliant answers (filtering out99/120compliant technical completions so zero technical/coding prose direction is perturbed).
We then executed a Two-Stage Sequential Re-Probed Abliteration (ng = 2):
- Stage 1 (Frobenius-Guarded Layer Patch,
norm_guard_layers = True): Projects out theReasonShield-orthogonalized(B1+B2, B4_PurePivot, B0+B3)subspaces fromwo_pre(attn_output) andmoe_pre(ffn_down_exps, includingNVFP4experts inblk.11..17andMXFP8/Q8_0Codablk.20..23) at ultra-lowKLD = 0.0308. - Stage 2 (Post-Stage-1 Exact
result_normRe-Probe,norm_guard_head = False): Re-probesresult_norm(slot 192) on the Stage-1 patched model (eliminating layer-to-head rotation mismatch) and applies per-direction scaled orthogonal projection ontooutput.weightwithout rescaling refusal vocabulary rows back up (total KLD = 0.0360).
V2 Heretic Benchmark Results (Held-Out Test Suite)
| Model / Ablation Variant | Direct Chat Refusal (effort=0) | Native Thinking Refusal (<|content_thinking|>) | Thinking Finish Rate | XSTest False Refusal | GSM8K CoT (effort=high) | Python Coding (pass@1) | WikiText-2 PPL | Benign KLD |
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| Base (thinkingmachines/Inkling-2-Mini) | 100.00% | 100.00% | 100.0% | 7.5% | 100.00% | 100.00% | 8.426 | 0.0000 |
| V1_C5_Previous | 20.00% | 58.33% | 100.0% | 7.5% | 96.88% | 100.00% | 8.936 | 0.0591 |
| V2_L1_Feather_0.66__H_Strong | 0.00% | 7.50% | 100.0% | 0.0% | 90.62% | 75.00% | 8.591 | 0.0297 |
| V2_L2_Crisp_0.76__H_Strong (V2 Winner) | 1.25% | 3.75% | 97.5% | 0.0% | 93.75% | 100.00% | 8.607 | 0.0360 |
Two-Stage Surgical Calibration Grid (effort=high, Strict 1024-Token Canary)
| Trial / Variant | Chat Refusal | Thinking Refusal | Finish @ 1024 Cap | GSM8K Canary | Coding Canary | Benign KLD | Objective Score |
|---|---|---|---|---|---|---|---|
V2_L1_Feather_0.66__H_Clean |
0.0% | 5.0% | 70.0% | 87.5% | 75.0% | 0.0289 | 101.97 |
V2_L1_Feather_0.66__H_Strong |
0.0% | 5.0% | 75.0% | 81.2% | 75.0% | 0.0297 | 107.62 |
V2_L2_Crisp_0.76__H_Strong |
0.0% | 0.0% | 55.0% | 81.2% | 100.0% | 0.0360 | 110.27 |
V2_L2_Crisp_0.76__H_Clean |
0.0% | 0.0% | 55.0% | 81.2% | 83.3% | 0.0351 | 126.59 |
3. RTX 3090 (sm_86 @ 280W) CUDA Kernel & DSpark Speed Engineering
We ship the full source patch in patches/llama_inkling2_sm86.patch, adding:
NVFP4INT8 Tensor Coremmq-few(m16n8k16+cp.async) & OptimalMMVQ -> MMQ-Few -> Stream-K MMQCrossover:1token $\rightarrow$__ldg-cachedMMVQ;2..16tokens $\rightarrow$NVFP4mmq-few(with 648B/1224B half-tail & fused expert scale);17+tokens $\rightarrow$ Stream-KMMQ(2.2×faster multi-agent batches).
- Graph-Stable
rposBanded FlashAttention (GQA-3 Split-K):- Encodes valid/masked relative distances directly in 256-padded
self_rel_pos, eliminating10–39.5 GB/stepof densekq_bmaterialization, loadingK/Vonce per 3 query heads, skipping other-agent-kvucells in 1 cycle, and achieving100%CUDA Graphreuse.
- Encodes valid/masked relative distances directly in 256-padded
- 4 Subgraph Fusions +
Q8_0Loop-Gate & Markov Head Compression:- Fused 10-node
LLM_FFN_SITU, 8/9-nodeShortConv + state store,D = 16/64/128L2-Clip,FusedInkling2LoopCache(BF16 -> Q8_0), andFusedInkling2Markov(492 MB -> 54.7 MBQ8_0, eliminating3.4 GBHBM traffic perDSparkstep).
- Fused 10-node
- Zero-Copy
DSparkDevice Feature Injection + Unified Multi-Slot Draft Batching + GPU Greedy Sampling (-bs):- Enables
dev_features = true+ GPUllama_sampler_init_greedy()(4-byteD2H argmax instead of25–102 MBPCIe logits transfer!) and unifiedctx_dftmulti-agent batching (48serial passes $\rightarrow$2batched GPU passes/step).
- Enables
Single-Agent Speed Table (1× RTX 3090 @ 280W)
| Configuration | Peak Decode Speed | Mean Decode Speed | DSpark Acceptance |
|---|---|---|---|
Solo_P3_k8 |
58.9 tok/s | 58.0 tok/s | 0.0% |
DSpark_P3_k8 |
102.8 tok/s | 98.2 tok/s | 54.5% |
DSpark_P3_k6 |
117.0 tok/s | 109.8 tok/s | 53.9% |
DSpark_P3_k4 |
131.1 tok/s | 122.1 tok/s | 52.2% |
Solo_P2_k8 |
79.5 tok/s | 78.2 tok/s | 0.0% |
DSpark_P2_k8 |
130.4 tok/s | 115.8 tok/s | 45.3% |
DSpark_P2_k6 |
171.3 tok/s | 148.1 tok/s | 54.4% |
Solo_P1_k8 |
121.8 tok/s | 121.1 tok/s | 0.0% |
DSpark_P1_k8 |
211.9 tok/s | 188.6 tok/s | 54.0% |
DSpark_P1_k6 |
252.5 tok/s | 203.9 tok/s | 50.5% |
Multi-Agent Concurrent Throughput (1× RTX 3090 @ 280W, -kvu -bs -ctk q4_0 -ctv q4_0)
| Configuration | Concurrent Agents (-np) |
Decode Speed / Agent | Aggregate Decode Throughput | End-to-End Wall Throughput | DSpark Acceptance |
|---|---|---|---|---|---|
Pure_np8_P3 |
8 | 21.6 tok/s/agent | 172.4 tok/s | 20.6 tok/s/agent (164.8 agg) | 0.0% |
Pure_np16_P3 |
16 | 14.9 tok/s/agent | 238.9 tok/s | 14.2 tok/s/agent (227.8 agg) | 0.0% |
Pure_np24_P3 |
24 | 11.8 tok/s/agent | 282.7 tok/s | 11.2 tok/s/agent (269.5 agg) | 0.0% |
DSpark_np8_n2_P3 |
8 | 26.4 tok/s/agent | 210.8 tok/s | 24.4 tok/s/agent (195.5 agg) | 68.3% |
DSpark_np8_n4_P2_k6 |
8 | 28.7 tok/s/agent | 229.6 tok/s | 26.8 tok/s/agent (214.3 agg) | 38.7% |
DSpark_np12_n2_P2_k6 |
12 | 23.2 tok/s/agent | 278.7 tok/s | 21.7 tok/s/agent (260.2 agg) | 59.7% |
DSpark_np16_n2_P3 |
16 | 14.4 tok/s/agent | 230.4 tok/s | 13.1 tok/s/agent (209.7 agg) | 68.8% |
DSpark_np16_n2_P2_k4 |
16 | 20.2 tok/s/agent | 322.6 tok/s | 18.6 tok/s/agent (298.1 agg) | 60.1% |
DSpark_np16_n3_P1_k6 |
16 | 29.6 tok/s/agent | 473.8 tok/s | 27.4 tok/s/agent (439.2 agg) | 61.4% |
DSpark_np24_n2_P1_k6 |
24 | 22.2 tok/s/agent | 533.2 tok/s | 20.4 tok/s/agent (490.1 agg) | 69.0% |
DSpark_np32_n2_P1_k4 |
32 | 15.8 tok/s/agent | 505.1 tok/s | 14.6 tok/s/agent (468.1 agg) | 67.5% |
V2 Quantization Matrix (UD-Q4_K_XL down to UD-Q2_K_XL)
| Quantized Checkpoint | File Size | Prefill pp512 |
Solo tg128 (P=3) |
1-Agent DSpark (P=3) |
1-Agent Turbo DSpark (P=2 / P=1) |
16-Agent Batched DSpark |
|---|---|---|---|---|---|---|
Inkling-2-Mini-Heretic-UD-Q4_K_M.gguf |
16.61 GB | 1725.1 tok/s | 61.3 tok/s | 114.3 tok/s (100.0 avg) | 140.2 (P=2) / 258.1 tok/s (P=1) |
31.7 tok/s/agent (507.7 agg) |
Inkling-2-Mini-Heretic-UD-Q4_K_XL.gguf |
17.63 GB | 1742.8 tok/s | 62.0 tok/s | 116.6 tok/s (101.8 avg) | 136.2 (P=2) / 259.3 tok/s (P=1) |
34.0 tok/s/agent (543.8 agg) |
Inkling-2-Mini-Heretic-UD-IQ4_XS.gguf |
15.73 GB | 1750.2 tok/s | 62.9 tok/s | 118.5 tok/s (101.2 avg) | 133.8 (P=2) / 268.9 tok/s (P=1) |
36.6 tok/s/agent (585.7 agg) |
Inkling-2-Mini-Heretic-UD-Q3_K_XL.gguf |
13.63 GB | 1762.9 tok/s | 63.6 tok/s | 104.4 tok/s (100.5 avg) | 192.1 (P=2) / 279.2 tok/s (P=1) |
32.5 tok/s/agent (519.5 agg) |
Inkling-2-Mini-Heretic-UD-Q2_K_XL.gguf |
9.14 GB | 1796.7 tok/s | 66.2 tok/s | 122.2 tok/s (112.3 avg) | 164.9 (P=2) / 306.2 tok/s (P=1) |
38.1 tok/s/agent (610.2 agg) |
(At UD-Q2_K_XL + Q4_0 KV cache, a single 24 GB RTX 3090 holds up to 655K–1,048K (1M) context tokens for 1 agent, or 32–64 concurrent agents with 16K–32K total context!)
4. Exact Reproduction Commands (How to Run at 200+ tok/s & Multi-Agent 25–50+ tok/s/agent)
Build with patches/llama_inkling2_sm86.patch
git apply patches/llama_inkling2_sm86.patch
cmake -B build -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 -DCMAKE_BUILD_TYPE=Release
cmake --build build --target llama-server llama-cli llama-bench -j $(nproc)
A. Single-Agent Maximum Quality DSpark (P=3, Full 48 Visits) + 200+ tok/s Fast Modes (P=2 / P=1 / UD-Q2_K_XL)
Critical Flag: Always pass
-bs(--backend-sampling) and--spec-draft-p-min 0!
# 1) Full 48-Visit (P=3) + DSpark (~110-165+ tok/s depending on quant/task)
./build/bin/llama-server \
-m Inkling-2-Mini-Heretic-UD-Q4_K_M.gguf \
-md dspark-Inkling-2-Mini-Q8_0.gguf \
-ngl 999 -fa on -bs -c 16384 -np 1 \
-ctk q8_0 -ctv q8_0 -ctkd q8_0 -ctvd q8_0 \
--spec-draft-p-min 0 --spec-draft-n-max 6 --spec-draft-n-min 1
# 2) 200+ tok/s Single-Agent Mode (VarLoop P=2 = 36 visits or P=1 = 24 visits + DSpark, ~96% GSM8K retained at P=2!)
INKLING2_NUM_PASSES=2 INKLING2_EXPERT_USED=6 ./build/bin/llama-server \
-m Inkling-2-Mini-Heretic-UD-Q4_K_M.gguf \
-md dspark-Inkling-2-Mini-Q8_0.gguf \
-ngl 999 -fa on -bs -c 16384 -np 1 \
-ctk q8_0 -ctv q8_0 -ctkd q8_0 -ctvd q8_0 \
--spec-draft-p-min 0 --spec-draft-n-max 6 --spec-draft-n-min 1
B. Multi-Agent High-Throughput Serving (16–24 Agents @ 25–50+ tok/s PER AGENT)
# 16 Concurrent Agents with Unified KV (-kvu), GPU Sampling (-bs), and Batched Single-Ubatch DSpark:
./build/bin/llama-server \
-m Inkling-2-Mini-Heretic-UD-Q4_K_M.gguf \
-md dspark-Inkling-2-Mini-Q8_0.gguf \
-ngl 999 -fa on -bs -kvu \
-np 16 --threads-http 24 -c 32768 -b 1024 -ub 1024 \
-ctk q4_0 -ctv q4_0 -ctkd q8_0 -ctvd q8_0 \
--spec-draft-p-min 0 --spec-draft-n-max 3 --spec-draft-n-min 1 --no-cache-idle-slots
- Downloads last month
- 228