Skip to Content
coaadedocs

How it works

Strata of memory, per-expert streaming, the .strata file format, prefetching and the placement planner.

Strata of memory

Model weights live in strata, layers of memory, and flow between them on demand:

   VRAM  (fastest, smallest)   <- hot experts, trunk, KV cache
    ^v
   RAM   (fast, medium)        <- warm experts, resident trunk
    ^v
   SSD   (large, slowest)      <- the full model; cold experts stream in per token

Why a big MoE model fits in small RAM

A Mixture-of-Experts layer has many experts, and a router that picks a few of them (the top-k) for each token. Everything else in that layer goes unused for that token.

So for each token, RAM only needs:

  1. The trunk: embeddings, attention and other always-used weights
  2. The top-k experts of the current layer
  3. The KV cache for the conversation

The rest of the model only has to be reachable on disk.

Per-expert streaming

For each layer, StrataFlow:

  1. Runs the layer's router.
  2. Reads back which experts it chose.
  3. Makes only those experts resident, loading any that aren't cached.
  4. Runs the expert computation.

Experts live in a bounded slot pool with least-recently-used eviction. One slot holds one expert bundle: the gate, up and down weights for one expert in one layer. With fewer slots than experts, StrataFlow streams; with enough slots for the whole working set, nothing is evicted.

Because the computation is the same either way, the output is byte-identical whether the model is fully resident or tightly bounded.

Prefetching

The router's choices feed a predictor that guesses the next layer's experts. A background I/O thread loads them while the current layer computes, hiding disk latency. A wrong guess is just a cache miss, corrected by the normal synchronous load, so prefetching never changes the output. It's on by default (--async-prefetch on).

The .strata format

strata-pack converts a GGUF file into .strata, a single file laid out for streaming:

  • The trunk is stored together, so it can be loaded once and kept resident.
  • Each expert bundle is an aligned blob, so it can be read with one direct I/O call.
  • Weight bytes are copied verbatim: no re-quantization.
  • Optional lossless per-expert compression (--compress lz).

Loading a .strata file holds only the trunk in RAM; the full expert footprint is never allocated. Older Mixtral GGUFs that store experts one tensor per expert are regrouped automatically.

The placement planner

On load, StrataFlow profiles your hardware (cores, free RAM, VRAM, SSD speed) and plans where everything goes:

  • How many expert slots to keep resident, from free RAM and the model's expert layout
  • How large a KV window to keep
  • Whether to stream parts of the trunk
  • What to place in VRAM, when a GPU is present

Print the plan without running the model:

./bin/strataflow --model model.strata --plan

See Memory tuning to override it.

On this page