Destiny
Sign In
ACD-11 · Hardware Mechanical Sympathy & Unified Memory Sizing

Apple Silicon LPDDR5X Roofline Math & KV-Cache Quantization

Sizing local language models by parameter count alone mispredicts both RAM fit and token throughput. Below is the exact roofline bound governing batch-1 Metal decode, why sparse Mixture-of-Experts (A1B–A4B) architectures multiply tokens per second on 16 GB–24 GB Macs, and how to calculate exact KV-cache overhead before downloading a single weight file.

1. Batch-1 Autoregressive Decode Is Strictly Bandwidth-Bound

Prompt prefill evaluates hundreds of input tokens in parallel via matrix-matrix multiplication (GEMM), achieving high arithmetic intensity and saturating Metal GPU ALUs. Single-stream token generation (batch = 1), by contrast, reduces every linear projection to matrix-vector multiplication (GEMV), reading each active weight byte from Unified Memory once per generated token:

Theoretical Upper-Bound Decode Speed (tok/s):
  tok_s_max  =  (BW_peak_GBs * eta_eff) / Bytes_active_per_token

Where:
  Bytes_active_per_token  =  P_active * (bits_per_weight / 8) + KV_bytes_read
  eta_eff                 ≈  0.68 to 0.78 on tuned Metal SIMD-group GEMV kernels

Measured Apple M4 Pro (24 GB, BW_peak = 273 GB/s) — Destiny Swift (LFM2-8B-A1B Q8_0):
  Active bytes/step ≈ 2.45 GB (active experts + shared layers + KV state)
  Measured throughput = 78.62 tok/s  (12.72 ms/token, 0 B network egress)

2. Exact KV-Cache Footprint Under GQA & Quantized Cache Pages

Total Unified Memory residency sums three terms: memory-mapped GGUF weights (M_weights), context KV cache (M_KV), and Metal compute scratch + macOS desktop headroom (M_sys ≈ 4.5 GiB). With Grouped-Query Attention (n_kv < n_q), KV memory scales linearly with sequence length L_ctx and KV head count rather than full attention dimension:

M_KV (bytes) = 2 * n_layers * n_kv_heads * d_head * L_ctx * bytes_per_kv_elem

Worked Example (32 layers, n_kv_heads = 8, d_head = 128, L_ctx = 32,768):
  FP16 KV (2.0 B/elem):  2 * 32 * 8 * 128 * 32,768 * 2.0  =  4.29 GB (4.00 GiB)
  Q8_0 KV (1.06 B/elem): 2 * 32 * 8 * 128 * 32,768 * 1.06 =  2.28 GB (2.12 GiB)

Quantizing the KV cache from FP16 to Q8_0 cuts 32K context memory nearly in half with negligible perplexity drift, allowing a 24 GB MacBook Pro or Mac mini M4 Pro to hold a 12.0 GiB–12.74 GiB reasoning model (Gemma-4-26B-A4B Q3_K_M or Qwen3.6-35B-A3B UD-IQ3_S) plus a long document context comfortably in wired RAM without touching NVMe swap.

3. Recommended Destiny Model Tier by Apple Silicon Memory Class

Unified MemoryBandwidthRecommended Local TierWeight Footprint
8 GB – 12 GB100–120 GB/sDestiny Spark 0.8B (Qwen3.5 Q8_0) + Web Cloud Pass0.90 GiB
16 GB – 18 GB120–150 GB/sDestiny Swift (LFM2-8B-A1B Q8_0 · 0-Login)8.26 GiB
24 GB – 36 GB273–410 GB/sDestiny Pro Thinker (26B-A4B) & Analyst (35B-A3B)12.0–12.74 GiB
48 GB – 192 GB546–819 GB/sDestiny Horizon 30B-A3B Q4_0 (1M Context) + Multi-Slot17.85 GiB

4. Interactive Cloud SaaS Consolidation & Live Telemetry

Calculate annual savings when replacing metered cloud AI seats, charting plans, and SEO crawlers with local Apple Silicon inference ($29.99/mo All-in-One Pro) or browser-native Web Cloud Pass ($14.99/mo).

SaaS TCO & Consolidation CalculatorCompare fragmented cloud subscriptions vs Destiny
Select Cloud Tools Replaced
Estimated Monthly Consolidation
Selected Cloud SaaS Total:$180.24/mo
Destiny (Web Cloud):$14.99/mo
Save $165.25/mo ($1983/yr)
Informational market analytics only · Not investment advice.
Open Full 1s Terminal →
Destiny 2.0 Mac: 78.62 tok/s · M1–M6 NativeZero Trackers · Cross-Origin SVG
Embed Apple Silicon Metrology Badge

Cite reproducible Apple M4 Pro Unified Memory benchmark receipts in engineering repositories.

FAQ · DIRECT ANSWERS

Apple Silicon Roofline & KV-Cache Sizing — FAQ

Technical answers on batch-1 bandwidth bounds, MoE active bytes, and Unified Memory headroom.

04 Questions
Why does LPDDR5X memory bandwidth—not GPU TFLOPS—govern single-user local LLM token generation?
During autoregressive batch-1 decode, generating each output token requires streaming every active quantized weight byte from Unified Memory into GPU registers once while performing only two FLOPs per parameter. Arithmetic intensity stays near 1–2 FLOPs/byte, placing decode firmly on the horizontal memory-bandwidth ceiling of the Williams-Waterman-Patterson roofline model.
Why do Mixture-of-Experts (MoE) models like LFM2-8B-A1B and Qwen3.6-35B-A3B decode so fast on 24 GB Macs?
Total parameter count determines static RAM residency, whereas active parameters per token determine memory bytes read per decode step. A 35B-total / 3B-active MoE model quantized to ~3.5 bits/weight occupies ~12.74 GiB in Unified Memory yet streams under 1.4 GB per token—achieving 8B-dense decode speeds with 35B knowledge capacity.
How much Unified Memory should remain free for macOS WindowServer and KV cache?
Reserve at least 4.0 to 5.5 GiB of Unified Memory for macOS kernel wired pages, Metal command buffers, WindowServer compositing, and sliding/paged KV cache so wired GPU allocations never trigger SSD swap thrashing.
What if I am on Windows, Linux, or an 8 GB laptop without local headroom?
Destiny Web Cloud Pass ($14.99/mo) runs in any browser across Windows, Linux, macOS, iOS, and Android—providing 450 daily Web Studio runs across SEO, Writing, Citation Verification, Security, and 2x2 1s Supercharts with zero local VRAM required.