Cut memory waste.
Keep every bit of precision.

Run compressed local language models and long-context workloads natively on Apple Silicon, while preserving model fidelity.

2.34× vs BF16 0.5B 4-bit decode (181.8 vs 77.7 tok/s)
4.93× smaller RAM Unlocks 3B on 8 GB (5,886 MB OOM → 1.19 GB)
5.06× leaner 16K KV 88.6 MB cache (3.16 bpw, 5/5 Passkey)
Apple Silicon Metal MLX Hugging Face safetensors Qwen
INTRODUCTION · WHAT IS XFERMAT

Why local AI loses accuracy or stalls—and how xFermat fixes it

THE BOTTLENECK

Why naive compression & attention hit a wall on Apple Silicon

Full-precision models quickly exhaust unified memory on everyday Macs, while naive low-bit compression noticeably degrades output quality. Long prompts also expand conversation memory linearly across layers, and standard 32-bit GPU math loses precision on demanding scientific workloads.

HOW XFERMAT FIXES IT

Offline weight calibration + automatic hardware routing

xFermat rotates and calibrates model weights offline once on the GPU, saving compact checkpoints that reload in under a second with zero extra runtime overhead. At inference time, it pairs native Apple Silicon attention with shape-tuned matrix execution—matching calibrated 4-bit quality and substantially improving 3-bit fidelity.

How it works step-by-step
01 / OFFLINE CALIBRATION

One-time compression & sub-second reload

Rotates outlier channels offline and calibrates weights layer-by-layer on the GPU, shrinking local models more than three-fold and reloading saved checkpoints in about 0.7 seconds.

02 / ATTENTION & LONG CONTEXT

Fast native attention & compact hybrid state

Routes standard prompts and token generation to Apple Silicon's fastest native attention path by default, while our research hybrid sequence architecture cuts 8K context memory nearly four-fold.

03 / AUTOTUNED EXECUTION

Hardware-aware routing & GPU double precision

Benchmarks each matrix shape once to lock in the fastest execution path on your Mac, and offers optional 64-bit-level GPU math when scientific pipelines require extra precision.

HOW IT SITS IN BETWEEN · LIVE TRANSLATION PIPELINE

How xFermat Sits Between You and the Model

Once upfront, xfermat compress saves a compact calibrated checkpoint that reloads in 0.55 s. Every time you prompt the model, xFermat sits in the live path translating activations, shrinking cache transfers, and dispatching native Apple Silicon kernels.

Prompt & Context

Every question, multi-turn chat, or 16K document you send locally on your Mac.

Prompt tokens + conversation state

xFermat Engine

  • Once upfront (0.55s reload): Folds Hadamard rotations (R1) + GPU Clip-GPTQ for 2.86–4.93× smaller weights.
  • Every live token: Fused SwiGLU+RHT & shuffle FWHT, GQA-packed KIVI KV cache (3.16 bpw) & autotuned Metal / SDPA routing.

Compressed Model in RAM

Resident inside unified memory on 8 GB Apple Silicon (e.g. Qwen2.5-3B compressed from 5,886 MB BF16 OOM down to 1.19–1.47 GB, restoring 29.1–56.9 tok/s).

Apple Silicon Unified GPU Metal + GQA-packed SDPA fast path
← Streamed Reply Back to You 181.8 tok/s (0.5B 4-bit, decode parity vs AWQ) · 56.9 tok/s (3B mixed_2_3bit, 1.19 GB) · 16K Mixed KIVI 3.16 bpw (5/5 Passkey) · 3B OOM unlocked (5,886 MB → 1.47 GB, 10.42 PPL)
OUR MODEL

Not brute-force scaling—
algebraic efficiency

On unified-memory Apple Silicon, quantization error and KV bandwidth—not raw FLOPs—decide whether local models stay accurate and fit in RAM. xFermat pairs QuaRot/SpinQuant-style random Hadamard rotations, GPU sequential GPTQ, native SDPA dispatch, and research hybrid sequence layers without hiding tradeoffs.

Inspect empirical research

Sharper 3-bit & 4-bit compression

Offline rotation and GPU calibration preserve accuracy down to 3-bit—outperforming standard calibrated 3-bit quantization while matching 4-bit quality at native speed.

Over 3× smaller · 0.7s reload

Shrinks local language models more than three-fold to fit comfortably in 8–16 GB unified memory, reloading saved checkpoints in under a second.

Fast native attention

Automatically routes prompts and token generation to Apple Silicon's fastest native attention path, with custom tiled Metal kernels available for specialized shapes.

5.1× leaner 8K KV & 4× hybrid cache

Fused 2-bit/4-bit KIVI KV caching shrinks live 8K context memory 5.1× on pretrained models, while our 3:1 hybrid architecture cuts state memory 4×.

Double-precision GPU math

Recovers 15–16 digits of numerical accuracy directly inside Apple Silicon GPU pipelines when scientific simulations cannot afford 32-bit rounding drift.

Autotuned hardware routing

Benchmarks each matrix shape once and caches the fastest backend on your chip, ensuring theoretical algorithms never slow down real workloads.

USER PERSPECTIVE · REAL-TIME PROMPT SPEED

What it feels like when you hit Send

Qwen2.5-3B BF16

5,886 MB · OOM OOM
YOU SENT

Explain Fermat's principle of least time and derive Snell's law in plain English.

QWEN RESPONSE

Light does not travel aimlessly between two points: it follows the exact...

Illustrative OOM: Qwen2.5-3B BF16 static weights (5,886 MB / ~5.75 GiB) exceed the 5.33 GiB GPU working-set limit on an 8 GB Mac (error_or_oom).
0.0 tok/s · Exceeds 8 GB Mac memory ceiling 0 / 90 tok · Failed (OOM)

xFermat 3B (3-Bit)

1.47 GB · 29.1 tok/s 3.32 s
YOU SENT

Explain Fermat's principle of least time and derive Snell's law in plain English.

XFERMAT → QWEN 3B RESPONSE

Light does not travel aimlessly between two points: it follows the exact trajectory whose travel time stays stationary against tiny nearby detours. Because light slows down inside glass relative to air (n = c / v), the fastest overall route bends sharply at the boundary—spending less distance in the slower medium so n1 sin(theta1) equals n2 sin(theta2).

29.1 tok/s · 106.1 t/s prefill (~226 ms wait, 10.42 WT2 PPL) 90 / 90 tok · 3.32 s total (Zero-swap on 8 GB Mac)

Verified Apple Silicon basis (8 GB Unified GPU, mlx 0.32.4): Timings simulate a 90-token reply using exact measured prefill & decode rates—Qwen2.5-3B unlocks 8 GB Mac capacity (5,886 MB / ~5.75 GiB BF16 OOM → 1,474 MB at 29.1 tok/s & mixed_2_3bit 1,193 MB at 56.9 tok/s with 9.43–16.01 PPL); 0.5B 4-bit achieves decode parity with AWQ (181.8 vs. 173.4 tok/s) at lower perplexity (15.20 vs. 16.06 WT2); 0.5B 3-bit delivers 17.99 WT2 PPL (vs. 23.27 AWQ and 39.12 native); and 16K Mixed KIVI cuts KV RAM 5.06× (448 MB → 88.6 MB) at 3.16 bpw with 5/5 Passkey retrieval.

MEASURED ON APPLE SILICON

Side-by-side benchmark

Explore research charts →
WITHOUT XFERMAT · STANDARD BF16

Uncompressed BF16 (Baseline)

942 MB 0.5B · 5,886 MB 3B OOM
Measured Decode Latency (Qwen2.5-0.5B)
12.87 ms/tok
77.7 tok/s BF16 (0.5B) · 3B BF16 crashes OOM on 8 GB Mac
Memory Footprint
942.3 MB (0.5B) · 5,886 MB (~5.75 GiB 3B OOM)
Technical specs & caveats
Method / Strategy
Full 16-bit BF16 streaming (or AWQ/Native 4b @ 173.4/153.3 t/s)
Quality & Fidelity
0.5B BF16: 14.42 PPL · AWQ 4b: 16.06 PPL (173.4 t/s)
System Impact
Streams 942 MB per token on 0.5B (77.7 t/s); 3B BF16 (5,886 MB) exceeds 5.33 GiB 8 GB Mac ceiling and OOMs
WITH XFERMAT · V0.7.0

xFermat R1+Clip-GPTQ 4-Bit

2.34× vs BF16 · 15.20 PPL
Measured Decode Latency (Qwen2.5-0.5B)
5.50 ms/tok
181.8 tok/s (2.34× vs BF16) · 15.20 WT2 PPL · 3B hits 9.43 PPL
Memory Footprint
330.0 MB 0.5B (2.86× smaller) · 1,804 MB 3B (vs OOM)
Technical specs & caveats
Method / Strategy
QuaRot/SpinQuant R1 fold + GPU Clip-GPTQ (16K full-rank cal)
Quality & Fidelity
0.5B: 15.20 PPL (vs 16.06 AWQ / 16.80 native) · 3B: 9.43 PPL
Honest Scope
2.34× faster than BF16 (181.8 vs 77.7 t/s); runs at decode parity with AWQ 4b (173.4 t/s) while beating AWQ perplexity
4-Bit (0.5B vs AWQ) 181.8 vs 173.4 t/s Parity · 15.20 vs 16.06 PPL
3-Bit (0.5B & 3B Rescue) 17.99 vs 23.27 AWQ (-22.7%) · 3B 10.42 PPL
16K Mixed KIVI & MOHAWK 5.06× KIVI (5/5) · -24.6% 8K Hybrid
150-Bit Garner CRT (p=25..45) 0.0 Rel Err GPU (0.0 Sliced on κ=1e12)
START NOW · LOCAL ON APPLE SILICON

Run compressed AI in two commands.

Free (€0) on 1 personal Mac for solo non-commercial builders and academic research. Pro (€39/seat/mo) and air-gapped Enterprise Mac Fleet licenses available for commercial teams.

QUICKSTART · MLX 0.32+
$ pip install "xfermat[llm]"
$ xfermat bench
$ xfermat run Qwen/Qwen2.5-1.5B-Instruct --kv-bits 4 \
    --prompt "Explain Fermat's principle."
1,193 MB (3B mixed) · 0.55 s reload · 181.8 tok/s (0.5B 4b) · Wi-Fi off