Local Code by Draw Things

Run models larger than your memory

Weights Streaming is the SSD streaming that lets DeepSeek and GLM run on a Mac with less memory than the model. It keeps the experts the model uses most in memory and reads the rest from the SSD.

Updated

How it works

DeepSeek 4 Flash 0731, DeepSeek 4.1 Flash 1017 and GLM 5.3 Flash are mixtures of experts. Each layer holds many small expert networks, and each token uses only a few of them. So the model doesn't need all its weights in memory at once.

Weights Streaming keeps the experts the model uses most in memory, together with the weights every token needs. When a token calls for an expert that isn't in memory, Local Code reads it from the SSD. The Weights Streaming option in Machine Settings sets how much memory those weights get.

  • Only these mixture-of-experts models stream. Qwen 3.8 27B always loads whole.
  • Nothing extra is downloaded or stored. Experts are read from the model files where they already are.

More memory, more speed

Every expert that isn't in memory has to be read before the token can finish. The more experts fit in memory, the fewer reads each token waits for, and the faster the model runs.

DeepSeek 4 Flash 0731, share of expert lookups already in memory
Weights StreamingExperts found in memory
24 GiB82%
40 GiB94%

These come from replaying real project conversations token by token.

GLM 5.3 Flash decoding on an M5 Ultra
Weights StreamingExperts found in memoryExpert loads per tokenDecode speed
Disabled, all in memoryAllNone58.8 tok/s
48 GiB72.4%1,069 MiB25.8 tok/s
32 GiB58.8%1,596 MiB23.2 tok/s
16 GiB36.6%2,455 MiB20.5 tok/s

Even with fewer than half its experts in memory, GLM 5.3 Flash keeps 35% of its full decode speed on that Mac. Your numbers depend on your Mac and its drive.

What Automatic picks

Automatic leaves 32 GiB for macOS and your other apps. It takes the Mac's memory less 32 GiB, rounded down to a step of 8 GiB, between 8 and 72 GiB. Machine Settings shows the result, such as Automatic (32 GiB).

What Automatic picks for each amount of memory
Mac memoryAutomatic
32 or 36 GB8 GiB
48 GB16 GiB
64 GB32 GiB
96 GB64 GiB
128 GB72 GiB
192 GB or moreNo limit: the whole model, when it fits in the memory that's free

The setting is a ceiling, not a demand. Each time a DeepSeek or GLM model loads, Local Code checks how much memory is free, counting the file cache, and uses the largest step that fits: in three quarters of it for DeepSeek 4.1 Flash 1017 and GLM 5.3 Flash, or 72% for DeepSeek 4 Flash 0731. For DeepSeek 4 Flash 0731, the 72 GiB step holds the whole model, so it loads only when the whole model fits. With other apps holding memory, the model loads fewer experts. Choosing Disabled yourself is the exception: it always loads the whole model.

When to change it

  • More, if the Mac is mostly for Local Code and you want speed. A larger step only takes effect when that much memory is free as the model loads.
  • Less, if you keep other memory-hungry apps open and the Mac slows down once the model is loaded.
  • Disabled, only when the whole model fits in memory with room to spare. See choosing a model for model sizes.

A change takes effect the next time the model's weights load: after you switch models, after Unload Models When Idle unloads it, or when you open the app again.

Streamed experts come from the drive that holds the model, so its speed matters. That's why Model Folder warns about a slow drive.

Measure it on your Mac

Open the Settings tab and choose View more under Avg. Speed. Model Speed times the selected model on this device at growing context lengths. Run it before and after a change to see what the memory buys you.