How to use from
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 Mario867/Inkling_2_mini_for_older_hardware:UD-Q3_K_XL
# Run inference directly in the terminal:
llama cli -hf Mario867/Inkling_2_mini_for_older_hardware:UD-Q3_K_XL
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf Mario867/Inkling_2_mini_for_older_hardware:UD-Q3_K_XL
# Run inference directly in the terminal:
llama cli -hf Mario867/Inkling_2_mini_for_older_hardware:UD-Q3_K_XL
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-app
# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama serve -hf Mario867/Inkling_2_mini_for_older_hardware:UD-Q3_K_XL
# Run inference directly in the terminal:
./build/bin/llama cli -hf Mario867/Inkling_2_mini_for_older_hardware:UD-Q3_K_XL
Use Docker
docker model run hf.co/Mario867/Inkling_2_mini_for_older_hardware:UD-Q3_K_XL
Quick Links

Inkling-2-Mini-UD-Q3_K_XL β€” Q4 Repack (NVFP4 $\rightarrow$ Q4_K / Q4_0)

Model Overview

  • Base Model: Inkling-2-Mini-UD-Q3_K_XL (GGUF v3, 13,631,779,296 bytes / ~12.70 GiB)
  • Modification Type: Size-neutral, in-place quantization repack (NVFP4 $\rightarrow$ Q4_K / Q4_0) using ggml_quantize_chunk() via libggml-base.so.1
  • Target Hardware: GPUs lacking native OCP FP4 (device->ocp_fp4 == 0) or BF16 accumulation supportβ€”specifically AMD Polaris (e.g., Radeon RX 580) and older NVIDIA GPUs (e.g., Tesla / pre-Ada cards) running llama.cpp / Vulkan
  • File Size & Layout: Byte-identical to the source GGUF (13,631,779,296 bytes); all tensor offsets, padding, metadata, and non-NVFP4 tensors remain completely untouched

Why This Repack Exists

On GPUs without native OCP FP4 hardware support (fp4: 0), llama.cpp falls back to software-side emulation for GGML_TYPE_NVFP4 tensors:

  1. Shared-Memory LUT Staging: In ggml-vulkan.cpp, if (src0_type == GGML_TYPE_NVFP4 && !device->ocp_fp4) stages a 256-entry lookup table in shared memory to decode FP4 weights.
  2. Forced BF16 Accumulation: In llama-graph.cpp, if (w->type == GGML_TYPE_NVFP4) ggml_prec_set_acc(res, GGML_PREC_BF16) forces BF16 accumulation on every NVFP4 matmul, triggering a second software fallback on devices with bf16: 0.

Rewriting the 32 NVFP4 MoE expert tensors into Q4_K and Q4_0 preserves the exact 4.5 bits per weight ($\frac{9}{16}$ byte/element) density while routing those tensors through standard, first-class llama.cpp and Vulkan kernels.


Quantization & Layout Design

NVFP4, Q4_K, and Q4_0 all use $\frac{9}{16}$ bytes (0.5625 B) per weight:

Format Block Structure Bytes per Element Row Width Requirement
NVFP4 (source) 36 B / 64 weights $\frac{9}{16}$ (0.5625 B) ne0 % 64 == 0
Q4_K (target) 144 B / 256 weights $\frac{9}{16}$ (0.5625 B) ne0 % 256 == 0
Q4_0 (target) 18 B / 32 weights $\frac{9}{16}$ (0.5625 B) ne0 % 32 == 0

Per-Tensor Target Selection

Because blk.N.ffn_down_exps.weight has a row width of 1152 and $1152 \pmod{256} = 128$, Q4_K cannot represent those rows without altering tensor dimensions or file layout. The conversion script selects targets per tensor:

  • ne0 % 256 == 0 $\rightarrow$ Q4_K: Applied to ffn_gate_up_exps.weight (ne0 = 2304, 1296 B/row), providing 6-bit sub-block scales.
  • Otherwise $\rightarrow$ Q4_0: Applied to ffn_down_exps.weight (ne0 = 1152, 648 B/row), keeping row byte sizes and file offsets identical.

Preserved Scale Arithmetic

  • The 40 per-expert *.scale tensors are left untouched.
  • In llama-graph.cpp (build_lora_mm), expert scales multiply the matmul output (res = ggml_mul(ctx0, res, w_s)), not the stored weights directly. Keeping dequantized weight magnitudes at their original scale ($\approx \pm 1440$) preserves the downstream arithmetic.

Conversion Summary & Verification

Tensor Breakdown (Inkling-2-Mini-UD-Q3_K_XL.gguf $\rightarrow$ .q4.gguf)

Converted across 32 expert tensors in 165 seconds (~49 MiB/s across 6 threads):

Metric / Tensor Type Before After
NVFP4 tensors 32 tensors (7.83 GiB) 0 tensors
Q4_K tensors 3 15 (12 converted)
Q4_0 tensors 0 20 (converted)
Total file size 13,631,779,296 bytes 13,631,779,296 bytes
Tensor offsets & padding Baseline All identical

Pre-Conversion Validation

  • NVFP4 Dequantization Parity: Vectorized NumPy UE4M3 + E2M1 dequantization matched ggml's dequantize_row_nvfp4 via ctypes with 0.000e+00 max absolute difference across 5 random buffers.
  • Synthetic Round-Trip SNR: 21.3 dB for Q4_0 (ne0 = 1152) and 23.0 dB for Q4_K (ne0 = 2304).
  • Row-Size Neutrality: 648 B/row $\rightarrow$ 648 B/row (ne0 = 1152) and 1296 B/row $\rightarrow$ 1296 B/row (ne0 = 2304).

Real-Weight Fidelity (512 Rows per Sampled Tensor vs. Decoded Source NVFP4)

Tensor Target Type Signal RMS Error RMS SNR
blk.6.ffn_gate_up_exps.weight q4_K 483.12 33.80 23.10 dB
blk.11.ffn_gate_up_exps.weight q4_K 219.06 15.41 23.06 dB
blk.6.ffn_down_exps.weight q4_0 485.03 41.81 21.29 dB
blk.11.ffn_down_exps.weight q4_0 170.03 14.93 21.13 dB
  • Untouched Tensor Check: Confirmed byte-identical across output.weight, blk.0.attn_q.weight, token_embd.weight, and blk.11.ffn_down_exps.scale.

Usage & Reproduction

Running with llama.cpp

Verify that NVFP4 tensors are eliminated at load time:

llama-server -m Inkling-2-Mini-UD-Q3_K_XL.q4.gguf -lv 4 ... 2>&1 | grep -- '- type'

Expected output includes nvfp4: 0, q4_K: 15, and q4_0: 20.

Reproducing the Conversion (nvfp4_to_q4.py)

The conversion script requires only Python 3, numpy, and an existing libggml-base.so.1 build:

# Run built-in self-tests
python3 nvfp4_to_q4.py --selftest

# Inspect NVFP4 tensors and target mapping
python3 nvfp4_to_q4.py --list -i Inkling-2-Mini-UD-Q3_K_XL.gguf

# Perform size-neutral conversion
python3 nvfp4_to_q4.py -i Inkling-2-Mini-UD-Q3_K_XL.gguf -o Inkling-2-Mini-UD-Q3_K_XL.q4.gguf

(On NixOS / Nix environments, invoke via nix-shell -p python3Packages.numpy --run "...".)


Limitations & Caveats

  • Second-Generation 4-Bit Quantization: Repacking already-quantized NVFP4 weights into Q4_K/Q4_0 introduces one additional generation of 4-bit quantization error (~21–23 dB SNR relative to the decoded NVFP4 weights), isolated to the MoE expert layers.
  • Q4_0 on 1152-Wide Down Projections: Q4_0 (~21.1–21.3 dB SNR) is used for ffn_down_exps.weight to preserve exact byte offsets without relayout. Higher-precision formats (such as Q5_0 or Q6_K) would require shifting tensor offsets and increasing file size.
  • Memory Footprint Unchanged: Because this repack is strictly size-neutral (~12.70 GiB total file size), VRAM capacity and CPU/RAM offload requirements remain identical to the base file.
Downloads last month
161
GGUF
Model size
26B params
Architecture
inkling2_loop
Hardware compatibility
Log In to add your hardware

3-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support