All Posts
PostBlog Posts

How Apple Runs Giant AI on Your Phone's Storage Drive

Apple Flash Memory Inference stores LLM weights on NAND flash and loads them on demand. Windowing and row-column bundling bypass iPhone RAM limits.

Apple runs massive foundation models on your iPhone, and RAM is the bottleneck. A useful model needs gigabytes of active memory; your phone shares that pool with the OS, the camera, and background apps.

Flash Memory Inference keeps model weights on NAND flash and pulls only the slices each inference step needs into DRAM. Apple called the approach LLM in a Flash: run models bigger than available RAM without shipping tokens to a cloud server. As an engineer building zero-cloud iOS software, flash-backed weight loading is what makes large-model inference possible within iPhone memory limits.

The Memory Bottleneck

A large language model stores billions of parameters. On a phone, unified memory is the hard ceiling. You split it with every running process.

Load the full model into RAM and iOS kills your process to keep the device stable. Most on-device AI tooling assumes you can fit the whole weights file in memory at once. Apple Intelligence-scale models break that assumption.

The Small Desk Architecture

Flash Memory Inference sidesteps the fit problem with a simple mental model: a small desk inside a big library.

The desk is active RAM. The shelves are NAND flash. Cloud-style inference tries to set every reference book on the desk at once; the desk gives out. Apple’s method leaves the library on the shelf and lets the processor fetch the one page required for the current token.

Parameters stream from flash while the full model stays on the device, so the working set in DRAM stays small.

How Apple Flash Memory Inference Works on iPhone

Flash reads slower than DRAM, so Apple engineers optimized transfer volume and read patterns. The LLM in a Flash paper centers on two techniques:

  • Windowing: Reuse parameters you already activated. Keep recent tokens in RAM so the Neural Engine skips repeat trips to flash.
  • Row-column bundling: Store matching rows and columns from feed-forward layers together, then read larger sequential chunks instead of byte-sized fetches.

The same paper adds sparsity-aware loading: fetch only the neurons predicted to fire for the current token, run the step on the Neural Engine, then drop the weights. Less data movement means lower heat and steadier battery draw.

Apple’s researchers report models up to twice the size of available DRAM, with 4–5× faster CPU inference and 20–25× faster GPU inference versus naive flash loading.

The Independent Developer Advantage

When weights live on flash, you can ship ML features without a per-token API bill. Core ML and Apple Silicon give small teams the same memory hierarchy Apple tuned for foundation models.

I build LocalPlan and LocalMemo on this stack. Inference runs on your silicon; your data never leaves the device.

Conclusion

Flash Memory Inference treats your phone’s storage drive as extended model memory. Apple solved the RAM bottleneck by loading weights on demand. If you build for iOS, you inherit that path.

Try LocalPlan, LocalMemo, or Kaari to see on-device inference in production, or book a Technical Architecture Review to map out a zero-cloud strategy for your own enterprise software.

Sources: Apple Machine Learning Research: LLM in a Flash · arXiv:2312.11514

Self-Test & FAQ

Click to reveal answer
What is Flash Memory Inference?
Flash Memory Inference runs large language models by storing weights on device flash and loading parameters into RAM on demand during each token step. Apple introduced the technique in LLM in a Flash to run models that exceed available DRAM without cloud offload.
Why does flash memory work for on-device AI?
NAND flash holds far more data than iPhone RAM. Reads are slower, which is the tradeoff. Windowing, row-column bundling, and sparsity-aware loading cut transfer volume and read flash in larger contiguous chunks, keeping latency within usable bounds for local inference.
Can indie developers build on-device AI without API costs?
Yes. Core ML and Apple Silicon give small teams access to the same memory hierarchy Apple optimized for foundation models. Apps that run inference locally, like planning and memo tools, avoid per-token API fees and keep user data off external servers.
Pirkka Räisänen

Pirkka Räisänen

Building a business with on-device AI.

Creator of LocalPlanLocalMemoKaari
Share this lesson