PRIME-Quant: Running Inkling-2-Mini 100% resident on 12–16 GB GPUs (8.83 GB / 10.87 GB, 54–56 tok/s on RX 9060 XT, 0.054 KLD) + OpenAI server

#60
by batteryphil - opened

Sharing a 2-bit/4-bit quantization & fused Triton runtime for Inkling-2-Mini built specifically for 12 GB and 16 GB consumer GPUs (AMD ROCm & NVIDIA CUDA):

Repo: https://huggingface.co/batteryphil/Inkling-2-Mini-PRIME-Quant
(Free for personal, hobbyist, academic, and research use.)

Why Looped-Layer Sensitivity Matters for 2-Bit Inkling-2-Mini

Because layers L6..17 run 3 looped passes per token (48 logical layer applications), uniform 2-bit MoE error compounds 3× per token. Promoting only the top-8 highest-sensitivity looped/boundary MoE layers (L5, L8, L9, L11, L12, L14, L15, L16) from 2-bit (P2_G32) to 4-bit (P4_G32) cuts mean KL divergence in half (0.1138 → 0.0542) for +2.04 GB VRAM while keeping all other 16 MoE banks at 2-bit:

Checkpoint VRAM Mean KLD (1,849 toks) PPL (ref = 2.1416) Python / C++ Top-1 Decode (RX 9060 XT 16 GB) Fits 100% On
loop_top8 (Recommended) 10.87 GB 0.0542 2.1542 97.50% / 97.61% 54.2 tok/s (4K) / 48.6 tok/s (16K) 16 GB GPUs
maxcomp (All-2-Bit MoE) 8.83 GB 0.1138 2.2143 95.39% / 96.90% 56.2 tok/s (4K) 12 GB & 16 GB GPUs
  • Real coding check vs unquantized BF16 (52.8 GB): On a 15-test reactive spreadsheet compiler + 40-layer diamond DAG suite (benchmarks/ included in repo), loop_top8 (10.87 GB) solved Stage A (6/6) in 5.3 min (46.9–49.3 tok/s) vs BF16 CPU+GPU hybrid (4/6 in 92.5 min at 2.6 tok/s), and hit 14/15 on Stage B.
  • Fused Triton runtime + HIP/CUDA Graph replay: Includes fused Triton kernels for Inkling-2's 4-tap static/dynamic short-convs, rank-64 message_gate, AttnRes, router_topk, and ring-buffer GQA with chunked prefill (16K context resident inside 16 GB VRAM).

30-Second Quick Start (Downloads Only 1 Checkpoint)

pip install -U torch triton safetensors huggingface-hub "transformers>=5.24.0"

huggingface-cli download batteryphil/Inkling-2-Mini-PRIME-Quant \
    --include "*.py" "*.json" "*.jinja" "tiktoken/*" "requirements.txt" "inkling2_mini_p2_looptop8.safetensors" \
    --local-dir ./Inkling-2-Mini-PRIME-Quant
cd ./Inkling-2-Mini-PRIME-Quant

# Interactive chat:
python run_inkling2_prime.py --variant looptop8 --max-cache-len 16384 --interactive

# Or built-in OpenAI-compatible HTTP/SSE server (Open WebUI / Cursor / Cline / Continue):
python run_inkling2_prime.py --variant looptop8 --max-cache-len 16384 --serve --port 8080

Feedback, CUDA/ROCm speed numbers on other 12–16 GB cards, and benchmark reports are super welcome!

Sign up or log in to comment