Apple Silicon

How Much RAM for Local LLM? Apple Silicon & iOS Guide

Lapis EngineeringPublished Updated 7 min read

Calculate how much RAM a local LLM needs on Mac, iPhone, and iPad: weights, KV cache math, MoE capacity vs. speed, and safe memory limits.

Isometric diagram of Apple Silicon unified memory layers separating static LLM weights, dynamic KV cache blocks, and OS headroom
Illustration: Lapis Engineering
What to try
  • Budget for four separate allocations: quantized model weights, the per-token KV cache, temporary prefill/vision buffers, and OS wired memory.
  • iOS and iPadOS have no app swap and enforce strict jetsam ceilings (~2.8–3.3 GB on 8 GB devices), whereas macOS allows ~65–75% of RAM in Metal before swapping to SSD.
  • Active KV cache size depends on attention architecture: hybrid conv/attention and GQA models use a fraction of the per-token memory of older multi-head models.
  • In Mixture-of-Experts (MoE) models like Qwen3-Coder-30B-A3B, active parameters (3.3B) govern token speed, while total parameters (30.5B / ~16 GiB) govern RAM capacity.

The download size of a local model tells you how much storage its weights occupy on disk, not whether a 16,000-token debugging session or a multi-page PDF analysis will stay resident in memory. To size a local LLM reliably on Mac, iPhone, or iPad, you have to account for the weights, the conversation's key-value (KV) cache, temporary activation workspaces, and the operating system's hard memory ceiling.

1. The four components of local LLM memory

On Apple Silicon, the CPU, GPU, and Neural Engine share a single Unified Memory pool through frameworks such as Apple's MLX. Instead of copying tensors across a PCIe bus to a discrete graphics card, the runtime maps model buffers directly into shared DRAM. During an active chat, peak memory follows a four-part equation:

Peak Unified Memory = Stored Weights + KV Cache(context) + Prefill / Vision Workspace + OS Reserve
  • Stored weights (static): The quantized parameters loaded from .safetensors shards. At 4-bit group quantization (typically group_size: 64 in MLX), each billion parameters occupies roughly 0.53–0.58 GiB including quantization scales and biases. At 6-bit quantization, each billion parameters occupies roughly 0.75–0.80 GiB. As shown in Apple's LLM in a Flash research, keeping the active working set resident in DRAM rather than streaming from flash storage is the primary boundary between interactive generation and I/O bottlenecks.
  • KV cache (scales linearly with context): Every processed token stores its Key and Value projection vectors across all attention layers so the model does not recompute the entire conversation history on every new token. As documented in the PagedAttention paper, KV cache tensors grow with sequence length and quickly rival the weights themselves in long sessions.
  • Prefill and vision workspace (transient peak): Evaluating a large prompt chunk, parsing a local document, or running a vision encoder on an attached image allocates temporary intermediate buffers. Vision encoders and high-resolution image tiling add 384–768 MiB during prompt evaluation before settling back down during token generation.
  • OS and wired memory reserve: WindowServer, kernel wired memory, Metal command queues, and background apps claim a baseline slice of RAM before your first token is generated.
Comparison chart of unified memory allocation across an 8 GB iPhone running Qwen2.5-3B, a 16 GB Mac running Qwen3-8B at 4K versus 32K context, and a 32 GB Mac running Qwen3-Coder-30B-A3B MoE
Calculated Unified Memory breakdown across three representative Apple Silicon setups: an 8 GB iPhone under iOS jetsam limits, a 16 GB Mac where expanding context from 4K to 32K pushes an 8B model past the Metal working set limit, and a 32 GB Mac hosting a 30.5B MoE model.

To see how a lightweight 1.7B model behaves within this memory budget, see the guide to SmolLM2 on iPhone and its local benchmarks.

2. Usable memory ceilings: macOS Metal working set vs. iOS jetsam

Two devices with "8 GB of RAM" behave very differently depending on whether they run iOS/iPadOS or macOS. The operating system kernel enforces fundamentally different policies when Metal allocations climb:

  • iOS and iPadOS (zero app swap, hard jetsam termination): Mobile Darwin does not page anonymous application memory or Metal buffers out to flash storage. Instead, the kernel tracks each process's dirty memory footprint and enforces a strict per-device ceiling. If weights plus the growing KV cache cross that threshold, the kernel immediately terminates the app with a SIGKILL (reason per-process-limit or vm-pageshortage). You can verify this behavior directly in Apple's documentation on identifying high-memory use with jetsam event reports.
  • macOS (Metal working set ceiling + SSD swap fallback): On a Mac, Metal exposes MTLDevice.recommendedMaxWorkingSetSize, which typically represents 65% to 75% of physical RAM (around 10.6–12.0 GiB on a 16 GB Mac, and 16.0–18.0 GiB on a 24 GB Mac). If your model and context exceed that budget while other apps are open, macOS usually keeps the app alive by paging cold memory pages to the internal SSD—but because autoregressive decoding touches every active weight layer on every single token, hitting swap causes generation speed to collapse from dozens of tokens per second to a crawl.
Practical local LLM memory budgets by Apple hardware tier
Hardware Tier OS Memory Policy Safe LLM Budget (Weights + KV) Recommended Model Class (4-bit / 6-bit)
iPhone / iPad · 6 GB iOS jetsam (no app swap) ~1.7 – 2.1 GiB 0.8B – 1.7B dense or hybrid (4-bit, 2K–4K context)
iPhone / iPad · 8 GB iOS jetsam (no app swap) ~2.8 – 3.3 GiB 1.2B – 4B dense or VLM (4-bit, 4K–8K context)
iPad Pro / Air · 16 GB iPadOS jetsam ceiling ~7.5 – 9.5 GiB 7B – 9B dense (4-bit / 6-bit) with 8K–16K context
Mac · 8 GB Unified Memory Metal working set + SSD swap ~4.2 – 5.2 GiB 3B – 4B comfortable; 7B–8B 4-bit only with short context
Mac · 16 GB Unified Memory Metal working set (~10.6–12 GiB) ~9.5 – 11.5 GiB 8B – 9B (4-bit/6-bit) or 14B (4-bit) at 8K–16K context
Mac · 24 GB Unified Memory Metal working set (~16–18 GiB) ~15.0 – 17.5 GiB 14B – 24B dense (4-bit) or 30B-A3B MoE (4-bit, 4K–8K context)
Mac · 32 GB+ Unified Memory Metal working set (~22–24+ GiB) ~21.0 – 24.0+ GiB 30B-A3B MoE with 16K–32K context, or 27B–32B dense (4-bit)

Inference throughput depends directly on memory bus bandwidth: the guide to Apple Silicon memory bandwidth for LLMs explains how memory translates to tokens per second.

3. Calculating KV cache growth across architectures

Why do two models with similar parameter counts consume wildly different amounts of RAM during a long conversation? Because KV cache size is determined by the attention geometry inside the model's config.json, not simply by total parameter count. For any transformer using Grouped-Query Attention (GQA), the exact uncompressed KV cache cost per token is:

KV Bytes per Token = 2 (K and V) × n_attention_layers × n_kv_heads × head_dim × bytes_per_scalar

With standard 16-bit (FP16/BF16, 2 bytes per scalar) KV storage, look at how four real architectures from the MLX ecosystem compare using their published configuration files:

  1. Hybrid Convolution + Attention (mlx-community/LFM2.5-1.2B-Instruct-4bit): Although the model has 16 total layers, its layer_types array specifies only 6 full-attention layers alongside 10 gated short-convolution layers (which maintain a tiny fixed state). With num_key_value_heads: 8 and head_dim: 64 across those 6 attention layers, its BF16 KV cache costs just 12 KiB per token—only 48 MiB at 4,096 tokens.
  2. Aggressive GQA Dense 3B (Qwen2.5-3B-Instruct in 4-bit MLX format): Uses 36 layers, 16 query heads, and only 2 KV heads (an 8:1 GQA ratio) with head_dim: 128. That keeps its BF16 KV cache at 36 KiB per token (144 MiB at 4,096 tokens), making it ideal for 8 GB iPhones.
  3. Dense 8B GQA (mlx-community/Qwen3-8B-6bit): Uses 36 layers, num_key_value_heads: 8, and head_dim: 128. At BF16, each token requires 144 KiB. At a 4,096-token context, the KV cache is a modest 576 MiB (total footprint ~7.0 GiB with 6.20 GiB weights). Push that conversation to 32,768 tokens, however, and the KV cache alone swells to 4,608 MiB (4.50 GiB)—lifting total model memory near 11 GiB and pushing a 16 GB Mac into swap if a browser or IDE is open.
  4. Sparse MoE 30B-A3B (mlx-community/Qwen3-Coder-30B-A3B-Instruct-4bit): Uses 48 layers, num_key_value_heads: 4, and head_dim: 128, resulting in 96 KiB per token—actually less KV cache per token than the dense 8B model, even though its 128 routed experts require 16.0 GiB of weight storage.
Exact weight and BF16 KV cache footprints calculated from model config.json specifications
Model (MLX Package) Stored Weights Attention Geometry (L × KV × d) BF16 KV / Token KV at 4K Tokens KV at 32K Tokens
LFM2.5-1.2B-Instruct-4bit 0.62 GiB (633 MB) 6 attn layers × 8 × 64 (hybrid) 12 KiB 48 MiB 384 MiB (0.38 GiB)
Qwen2.5-3B-Instruct-4bit 1.63 GiB (1,667 MB) 36 layers × 2 × 128 (GQA 8:1) 36 KiB 144 MiB 1,152 MiB (1.13 GiB)
Qwen3-8B-6bit 6.20 GiB (6,347 MB) 36 layers × 8 × 128 (GQA 4:1) 144 KiB 576 MiB 4,608 MiB (4.50 GiB)
Qwen3-Coder-30B-A3B-4bit 16.00 GiB (16,385 MB) 48 layers × 4 × 128 (MoE GQA) 96 KiB 384 MiB 3,072 MiB (3.00 GiB)

To reduce DRAM consumption across long context windows, see the guide to KV cache quantization on Apple Silicon.

4. Dense vs. Mixture-of-Experts (MoE) and vision overhead

Two common sizing mistakes trip up local LLM users on Apple Silicon: confusing MoE active parameters with RAM capacity, and overlooking multimodal vision buffers.

  • MoE rule—active parameters set speed, total parameters set RAM: In a sparse Mixture-of-Experts model such as Qwen3-Coder-30B-A3B-Instruct-4bit, the router selects 8 experts out of 128 on each token, activating only 3.3B parameters per token. Because Apple Silicon inference is memory-bandwidth bound, streaming only ~1.8 GiB of active weights per token makes it generate nearly as fast as a dense 3B–4B model. However, because any of the 128 experts can be selected from one token to the next, all 30.5B parameters (~16.0 GiB) must remain resident in Unified Memory. That is why a 30B-A3B MoE model is fast on a 24 GB or 32 GB Mac, yet does not fit in RAM on a 16 GB Mac.
  • Vision-Language Model (VLM) buffer overhead: When you attach a photo or screenshot to a multimodal model (such as Qwen3.5-2B-OptiQ-4bit or Gemma-3n-E2B-it-lm-4bit), the runtime loads both the language backbone and the vision tower, splits the image into patches, and injects hundreds or thousands of visual tokens into the prefill batch. Budget an extra 0.4–0.8 GiB of headroom over text-only chats when working with high-resolution images on an 8 GB iPhone or iPad.

For a full breakdown of per-token memory reads and prefill latency across sparse and dense architectures, see our comparison of MoE vs. dense local LLMs on Apple Silicon.

To evaluate precision trade-offs when compressing weights, review the comparison of 4-bit and 8-bit quantization on mobile.

5. Repeatable memory test and what to adjust first

Before relying on a model for long daily work, run this repeatable four-step verification on your own machine with your normal work apps open:

  1. Measure the baseline load (0-token floor): Open Activity Monitor on macOS (Memory tab, watching Memory Pressure and Swap Used) or Xcode Instruments / device diagnostics on iOS. Load the model and send a 20-token greeting. The jump in process footprint gives you the true weight + Metal runtime floor.
  2. Step test to 4,096 tokens: Paste a ~3,000-word technical article or code file and ask for a structured summary. Confirm that macOS Swap Used does not climb and that time-to-first-token (TTFT) scales linearly.
  3. Stress-test target context + attachments: If you plan to use 16K+ contexts or attach PDFs and images, run one turn with your largest typical attachment. Watch whether generation throughput after prefill stays steady or drops sharply (the classic sign that KV pages have spilled past recommendedMaxWorkingSetSize).
  4. Adjust the right lever when a limit is reached:
    • If the model fails or crashes immediately on load: the static weights exceed your free headroom. Switch to a lower quantization (e.g., 6-bit to 4-bit) or a smaller parameter tier.
    • If the model loads fast but slows down or exits after several long turns: the KV cache has outgrown your headroom. Start a fresh chat, shorten the context window, or split large documents into smaller sections.
    • If the model only fails when attaching images: crop or downscale the image before sending, or switch to a smaller VLM variant so the vision encoder workspace fits inside the mobile memory ceiling.

6. How to apply this in Lapis

Lapis is built around these exact Apple Silicon memory constraints so you do not have to calculate tensor dimensions by hand before downloading a model:

  • Up-front size and device fit in the model catalog: Both the curated catalog and the integrated Hugging Face mlx-community browser inspect repository config.json metadata and .safetensors weight totals before download, surfacing exact download sizes and compatibility warnings for your Mac, iPhone, or iPad (see the model catalog & Hugging Face browser).
  • Automatic context window and reply headroom management: Rather than letting an unbounded prompt silently overflow memory mid-reply, Lapis tracks token usage against the active context window and reserves generation headroom so long sessions degrade gracefully (see how Lapis manages conversation context).
  • Offload heavy models from iPhone to Mac with Lapis Link: When you want the reasoning or coding depth of a 14B dense or 30B-A3B MoE model while working from an 8 GB iPhone or iPad, Lapis Link lets your mobile device use your Mac's Unified Memory pool over your local network or Tailscale—keeping all prompts and documents private on your own hardware. You can test both local on-device models and Mac offloading right away from the Lapis download page.

See how Lapis manages chat context as it approaches the limit.

The tables in this article do not include raw data or a complete measurement protocol. Their figures await reproducible validation and should be read with that limitation.

Sources and references

Local execution with Lapis

Chat with compatible models on iPhone, iPad and Mac. Download them once and use local inference offline; model size depends on your device’s resources.

App Store