Skip to main content

xFermat (v1.4.1) — Apple Silicon Open Inference Runtime

xFermat Open Runtime provides Apple Silicon Metal GPU kernels, native-speed Safetensors loading, hardware-keyed persistent shape & Split-K autotuning (~/.fermat/autotune_cache.json), register-unpacking 2/3-bit & online-R4 GEMV kernels (M=1..8, float16/bfloat16), half-SRAM D=128 Split-K (1.52×–1.90× GQA-4 vs Apple SDPA), unquantized attention sinks (sink_tokens=4) + variance Key salience + v_bits=3 (v_group_size=128) Split-K, fused Metal K/V block quantize+pack prefill (3.56×–5.10×) with zero-materialization Flash-KIVI 32K chunked prefill (--kv-bits 4|2, --prefill-chunk-size 512, float/half SRAM bfloat16 decode), 3:1 Mamba-2 SSD + SDPA hybrid layers (FermatModel), and verified Qwen2.5 / Qwen3 / Llama / Mistral SWA support (FermatEngine).

Open-Core Architecture: This public repository and PyPI runtime distribute the transparent, pure-source inference engine (xfermat info, xfermat bench, xfermat run, load_compressed_model, FermatKIVICache, chunked_prefill_with_cache, FermatRegisterQuantLinear, FermatEngine persistent autotuner, and verified Metal kernels). Proprietary offline weight compression & QAT (surgery, codebook: Clip-GPTQ, Cayley R1 + blockwise STE QAT, 4D VPTQ, PV-Tuning), MOHAWK distillation (distill), and speculative decoding modules remain private commercial tools under aopas software development.


Measured Apple Silicon Summary (0.5B–4B, v0.7.0–v1.4.1 Median ± IQR)

Full disjoint evaluations, null-result boundaries, and reproducible JSON logs live in WHITEPAPER.md, benchmarks/v07_rigorous_results.json, benchmarks/v08_rigorous_results.json, benchmarks/v09_rigorous_results.json, benchmarks/v10_rigorous_results.json, benchmarks/v11_specverify_results.json, benchmarks/v11_32k_calib_results.json, benchmarks/v11_rigorous_results.json, benchmarks/v12_kivi_32k_decode_results.json, benchmarks/v12_rigorous_results.json, benchmarks/v13_kivi_multifamily_32k_results.json, benchmarks/v13_rigorous_results.json, benchmarks/v14_kivi_salient_results.json, benchmarks/v14_rigorous_results.json, benchmarks/v15_kivi_results.json, and benchmarks/v141_rigorous_results.json:

Benchmark (Apple Silicon Unified GPU (applegpu_g14g, 8 GB), mlx 0.32.4) Strongest Native / Baseline xFermat v0.7.0 – v1.4.1 Verified Advance
v1.4.1 half-SRAM Split-K, Qwen3-4B 8K (< 2.48 GiB) & 1.5B 32K Apple FP16 SDPA D=128 (0.94–2.10 ms); v1.3 Qwen3-4B 8K (2.5414 GiB OOB); v1.4 1.5B 32K (20.92 t/s) & cont. 65K WT2 (9.3511) GQA-4 16K/32K 1.079×–1.553× single & 1.450×–1.900× batched vs SDPA (1.520×–1.653× delta, GQA-8 1.029×–1.087× batched); Qwen3-4B 8K 5/5 Passkey @ 2.4223 GiB (235 MB); 1.5B 32K 5/5 30.63 t/s (+46.4% @ 1.52 GiB) & 4K 498.5 pref / 48.5 dec; 3B cont. 65K WT2 8.8060 (-0.5451) & vb3 32K 5/5 (2.22 GiB); TinyLlama 32K 1.18 GiB 1.52×–1.90× batched D=128 Split-K vs Apple SDPA, Qwen3-4B 8K 5/5 < 2.48 GiB, +46.4% 1.5B 32K (30.63 t/s), & -0.545 continuous 65K WT2 (459.2× Split-K reload)
v1.4.0 Attention Sinks (sink=4), Variance Salience & Factored Split-K v1.3 3B 32K: 4/5 (9.38 t/s, 2.39 GB), 65K WT2: 11.14 (FP16=10.04), 3B 4K–16K: 12.36–10.05 t/s 3B 32K 5/5 (100%) Passkey (14.54 t/s = +55%, 229.6 MB = 5.02×, 2.27 GB pk); 65K WT2 10.81 (-0.33); live 3B 4K/8K/16K 32.1/27.0/20.4 t/s (219.2 pref, 2.07–2.16 GB); 1.5B 16K 34.8 t/s (255.4 pref, 1.52 GB) & 32K 5/5 (20.9 t/s); TinyLlama 32K 33.8 t/s; 0.5B 159.9 vs 69.2 BF16 (2.312×) 5/5 (100%) 3B 32K recall < 2.27 GB, 2.03×–2.60× live 4K–16K speedup, & -0.33 65K WT2 PPL (2.80×–4.32× sink=4 KV updates, 301.5× Split-K reload)
v1.3.0 Fused KV Quantize+Pack Prefill, 65K WT2 & Multi-Family 32K Pure-MLX take_along_axis 16K KV updates (123.0–161.3 ms); 3B 65K WT2 FP16=10.035 (2.425 GB) 16K KV updates 29.9–31.7 ms (4.11×–5.10×), 3B 4K 245.5 t/s pref; 65K WT2 11.14 (k_gs=64, +26.7% eval speed @ 2.23 GB); 1.5B 16K 16.8 t/s (1.53 GB) & 32K 5/5 (17.0 t/s); TinyLlama 32K 28.4 t/s (1.34 GB); Qwen3-4B 6K 9.2 t/s (1/1, 2.47 GB); 0.5B 160.6 vs 73.4 BF16 (2.187×) 4.11×–5.10× faster KV writes, +26.7% 65K eval throughput, & 4 model-family verification < 2.5 GB (3B 32K k_gs=64 4/5 Passkey @ 2.39 GB)
v1.2.0 Autotuned Split-K KIVI (float SRAM bf16) & Sustained 32K Pre-v1.2 vec<T,4> bf16 32K (5.532 ms), sp=32 fixed Split-K, 3B 32K k_gs=32 (6.80 t/s), Apple SDPA (0.840–0.848 ms) D=128 bf16 32K 0.772–0.933 ms (1.088× vs SDPA); fp16 16K 1.764× vs sp=32; D=64 1.608× vs SDPA; 3B 32K 15.10 t/s (227.8 MB KV, 2.026 GB pk); 1.5B 21.90 t/s (5/5 Passkey, 177.2 MB KV, 1.574 GB pk) 2.22× faster live 3B 32K sustained decode + 5.06× leaner 32K KV (227.8 MB 3B / 177.2 MB 1.5B) beating Apple SDPA at 16K–32K
v1.1.0 M=5 Spec-Verify GEMV & Calibrated 3B 32K Flash-KIVI 3B 32K FP16 KV 1,152 MB (uncal 3b RTN 0/1 Passkey); native 3B M=5 68.34 ms / 1.5B 35.43 ms 3B calibrated 3b 32K: 5/5 Passkey, 245.8 MB KV (2.02 GB pk, 1.44 GB wts); 3B M=5 63.22 ms (1.081×); 1.5B M=5 32.97 ms (1.074×, K=4 +12.3%); 0.5B 169.0 t/s (2.094× vs 80.7 BF16) 4.69× leaner 3B 32K KV with 5/5 Passkey < 2.02 GB + up to 1.196× M=5 (1.318× bf16) & +8.1% live 3B M=5
v1.0.0 Persistent Autotune & Multi-Family (Qwen2.5/Qwen3/Llama/Mistral SWA) Cold first-call probe 832.25 ms (4-shape) / 675.91 ms (3-shape) 7.78 ms warm (106.97×, 0 reprobes, 0.305 GB) / 1.10 ms (614.13×); TinyLlama 36.40 t/s (2.29 GB), Qwen3-4B-4bit 21.53 t/s (2.48 GB), Mistral SWA 303.9 t/s 107×–614× warm startup + multi-family parity < 2.5 GB (5/5 32K Passkey @ 1.637 GB, 0.5B 2.125× vs BF16)
v0.9.0 Zero-Mat 32K SIMD Flash-KIVI (Qwen2.5-1.5B) 8K single-shot FP16 KV: 4.611 GB (896 MB @ 32K FP16 KV); 3b RTN 32K: 0/5 Passkey 191.32 MB KV (3.416 bpw) & 1.637 GB peak GPU at 32,768 tokens (26.81 t/s dec, 5/5 Passkey); 8K 1.536 GB (44.3 MB) 4.68× leaner 32K KV, 100% (5/5) 32K Passkey recall strictly < 2.5 GB (FermatModel Hybrid 32K: 0.1159 GB)
v0.9.0 Register 2/3-Bit & Online-R4 GEMV (FermatEngine) MLX native qmv/qmm ((11008→2048) M=2: 0.9966 ms; 3B 3b M=4: 63.67 ms) (11008→2048) 0.7112 ms (1.401×), (2048→11008) 1.275×, R4 1.188×; 3B 3b M=4 53.36 ms (1.193×, greedy_parity=True) Up to 1.401× kernel & 1.193× live 3B M=4 speedup (1.583 GB peak, zero regression on native shapes)
v0.8.0 Fused D=128 SIMDgroup KIVI (G=6, 4K–16K) v0.7 GQA 0.2686 (8K) / 0.5421 ms (16K); Apple SDPA 0.1422 / 0.2587 ms; Live 16K FP16 23.02 t/s, v0.7 18.13 t/s 0.1396 ms (8K) / 0.2359 ms (16K Mixed 3.16b) & 27.64 t/s live 16K (4b: 0.1997 ms, 30.19 t/s) 1.92×–2.30× kernel & 1.53× live 16K vs v0.7, 1.20× live 16K vs FP16 (5/5 Passkey, 88.6 MB)
v0.8.0 Cayley R1 + STE QAT (0.5B & 1.5B Full WT2, Pro/Ent.) 0.5B v0.7: mixed 41.16 PPL, vptq_2b 74.4 t/s; 1.5B v0.7: mixed 20.27 PPL (58.3 t/s), 3b 54.0 t/s 0.5B mixed 35.05 PPL, 3b 17.59 PPL, vptq 93.0 t/s; 1.5B mixed 18.85 (66.9 t/s), 3b 11.55 (75.3 t/s) -14.8% full-WT2 0.5B mixed (-36.1% slice vptq_2b), +25% VPTQ decode, +39.5% 1.5B 3b decode
Qwen2.5-0.5B 4-Bit WT2 PPL & Speed (v0.7.0) mlx_lm.awq: 16.06 PPL (173.4 ± 0.6 tok/s) 15.20 PPL (181.8 ± 3.9 tok/s, 330.0 MB) -5.4% PPL, decode parity (62.9 GB/s eff bw)
Qwen2.5-0.5B 3-Bit Quality (v0.7.0) mlx_lm.awq: 23.27 PPL (0.848 KL) 17.99 PPL (0.606 KL, 287.6 MB) -22.7% PPL, -28.5% KL (143.0 ± 5.7 tok/s), comparable MC (53.0% vs 49.8%)
TinyLlama-1.1B 3-Bit Untied Head (v0.7.0) xfermat FP16 head: 61.4 ± 4.5 tok/s (38.4 GB/s; AWQ 120.7) head_bits=8: 98.0 ± 6.7 tok/s (55.2 GB/s) +59.5% internal speedup at 9.62 WT2 PPL
Qwen2.5-1.5B 3-Bit WT2 Perplexity (v0.7.0) mlx_lm.awq: 13.02 PPL (0.585 KL) 11.48 PPL (0.487 KL, 783.9 MB) -11.8% PPL, -16.7% KL at 54.0 ± 4.4 tok/s (3.76× smaller)
Qwen2.5-3B 8 GB Memory Recovery (v0.7.0) BF16: 5,886 MB (~5.75 GiB > 5.33 GiB limit → OOM) 1,474 MB (10.42 PPL @ 29.1 tok/s) / 1,193 MB mixed (56.9 tok/s) Unlocks 3B on 8 GB unified memory without OS swap thrashing
16K Context Mixed KIVI KV Cache (v0.7.0–v0.8.0) FP16 448.0 MB (16.0 bpw) 88.6 MB (5.06× smaller, 3.16 bpw), 5/5 Passkey Holds 100% Passkey through 16K (1.38× vs SDPA @ 8K, 1.42× vs v0.7)
Real 0.5B 3:1 Hybrid Conversion (v0.7.0, Pro/Ent.) Student init: 129.96 PPL 14.46 final PPL (0.575 KL, 6,618 MB peak) -24.56% 8K KV cache with near-teacher generation quality

(Honest engineering caveat: 3-bit and 4-bit remain the recommended production PTQ tiers; k_outlier_ratio=0.625 KIVI KV uses ~3.16 effective bits/element while k_outlier_ratio=0.0 provides pure 2-bit KV. Under mode="auto", sub-cubic Winograd–Strassen, AlphaEvolve rank-48, ternary LUTs, and CRT FP64 stay opt-in where native Apple GEMM/BLAS wins.)


Runtime Modules Included (src/fermat/)

Module Capability
src/fermat/kv_quant.py QuantizedKVCache, FermatKIVICache, chunked_prefill_with_cache, zero-mat 32K SIMD Flash-KIVI + fused D=128 SIMDgroup GQA Metal decode, SWA & O(1) trim/rewind
src/fermat/persistence.py Sub-second sharded .safetensors serialization & load_compressed_model
src/fermat/engine.py FermatEngine(mode="auto") per-shape median + 10% hysteresis autotuner (reg_sg1/reg_sg2/reg_sg4 + native)
src/fermat/io_algebra.py flash_tiled_attention (SDPA auto-routing + Split-KV Metal FlashDecode) & WinogradConv2d
src/fermat/ssd_mamba.py Chunked Q_c=64 Mamba-2 State Space Duality Metal forward + reverse-VJP scan
src/fermat/structured.py HadamardQuantLinear, FermatRegisterQuantLinear, register_quantized_matmul, FermatFinalNorm, MonarchLinear, zero-barrier shuffle FWHT, fused_swiglu_rht
src/fermat/bilinear.py AlphaEvolve <4,4,4>, AlphaTensor, Gauss 3M, Winograd-Strassen + bundled .npz tables
src/fermat/rns_ozaki.py Explicit 150-bit Garner CRT-Ozaki II GPU FP64 reconstruction & sliced IEEE-754 path
src/fermat/ternary.py OzakiHadamardTernaryLinear (T-MAC Metal SRAM LUTs)

Quickstart & Security Verification

# Install runtime (add [llm] to load & stream Hugging Face / mlx-lm models with KIVI)
pip install "xfermat[llm]"

# Verify pure-source package integrity & Metal GPU runtime
xfermat info
xfermat bench --json

# Stream any Hugging Face / mlx-lm model with fused 4-bit KIVI KV cache
xfermat run Qwen/Qwen2.5-0.5B-Instruct --kv-bits 4 --prompt "Explain Fermat's principle."

# Or load a saved compressed xFermat safetensors checkpoint in ~0.7s
xfermat run ./path-to-compressed-model --kv-bits 4 --prompt "Explain Fermat's principle."

# Verify runtime suite
pytest -q
  • Supply-Chain Transparency (SECURITY.md): Pure py3-none-any source Python + runtime-compiled Metal shaders (zero compiled .dylib/.so blobs, zero pickle checkpoint loading, zero telemetry).
  • Licensing (LICENSE): Free (€0) for solo personal & academic use on 1 personal Mac. Commercial redistribution and business fleets (€39/seat Pro, From €750/mo Enterprise) are licensed via xfermat.com/pricing.

Metadata

Release files for xfermat 1.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xfermat 1.4.1
File Size Uploaded Provenance Actions
xfermat-1.4.1.tar.gz 836.3 kB Without provenance Details for xfermat-1.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xfermat 1.4.1
File Interpreter ABI Platform Actions
xfermat-1.4.1-py3-none-any.whl Python 3 none any Details for xfermat-1.4.1-py3-none-any.whl

Total release size: 1.7 MB

Release files / xfermat-1.4.1.tar.gz

Download URL xfermat-1.4.1.tar.gz
Size 836.3 kB
Tags Source
SHA-256 checksum
How to use checksums
fd25492f8c73283e3d919726cea19852da97ec7fddc200648857848b088c0b96
BLAKE2b-256 checksum
How to use checksums
e006f6df6971c3a378c3b32861a8da3bd542a81449be4b5e0b078383a09bc8ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / xfermat-1.4.1-py3-none-any.whl

Download URL xfermat-1.4.1-py3-none-any.whl
Size 840.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
522246b57f241470a1eec151a51a0d7d8392e08e316204fa5de0d0ccc530fc8b
BLAKE2b-256 checksum
How to use checksums
771fba2e88bcd52b34e4ffb0408b907a70c40d0dc9f31e565a2bd4ba271e349f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for xfermat 1.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page