# 1.7 Trillion-Parameter MoE Memory Tiering in Practice: GPU VRAM + tmpfs + Persistent Memory (Not a Consumer Setup)
This article documents a memory-tiering approach for serving a ~1.7T-parameter Mixture-of-Experts model on limited hardware: 2×RTX 4090 (48GB VRAM), a Xeon Gold 6252 with 1.5TB DDR4, Optane PMem 200 in App Direct mode, and a 414GB tmpfs tier for hot experts. It explains why the dense path (attention + shared experts) belongs in VRAM while routed experts are split between tmpfs and persistent memory, how to divide compute between GPU and CPU, what to watch when tmpfs consumes physical RAM, and the measured gains (decode ~2.2 → ~3.11 tok/s, prefill ~13.3 → ~16.8 tok/s). It also covers quantization, prefetching, expert caching, and the workload profiles this setup does and does not suit.
1. Scope first: this is a 1.7T MoE, not a consumer-grade build
Mixture-of-Experts (MoE) architectures have become a common way to host extremely large models. The key difference from a dense model is that an MoE contains a large number of expert sub-networks, but each token activates only a few of them. Total parameter count can therefore reach the trillion scale, while the parameters actually involved in computing any single token are far fewer.
This also means the hard part of deploying an MoE is not simply “do we have enough compute.” The realistic questions are three: can the weights fit, can expert weights be fetched fast enough, and can the CPU/GPU keep up under limited bandwidth.
Before any discussion of “5.6TB is only a theoretical reference point,” it is worth fixing the test platform and memory mode used in this case study:
- GPU: 2× RTX 4090, ~48GB VRAM total
- CPU: Intel Xeon Gold 6252
- DRAM: 1.5TB DDR4 physical memory
- Persistent memory: Optane PMem 200 series, running in App Direct mode
This is not an ordinary consumer desktop. A 414GB tmpfs implies physical memory typically above 600GB, while most consumer motherboards support only 128GB to 192GB. Intel also announced the end of the Optane business in 2022. The configuration should therefore be understood as a tiered-inference practice on large-capacity-memory workstation/server platforms, not a purely consumer-grade recipe.
One clarification on the numbers used throughout: the case model has roughly 1.7 trillion parameters, quantized to 4-bit weights, and the on-disk model files come to about 865GB once necessary scale factors, routing metadata, and shard indexes are included. If that 865GB were misread as 16-bit weights, it would correspond to only about 430 billion parameters, which is not enough to support a “trillion-parameter” claim. The “1.7T parameters” and “865GB on disk” figures only hold together under the same quantization assumption.
2. How MoE inference behaves: the dense path sets speed, the sparse path sets capacity
To design a memory tiering strategy, start by separating the two compute paths in an MoE.
The dense compute path consists mainly of the attention mechanism and the shared experts. It runs for nearly every token, is compute-intensive and memory-access-heavy, and has the largest effect on time-to-first-token and decode speed.
The sparse compute path is the routed experts. Each token passes through a router that selects its top-k experts. A commonly cited illustrative configuration is a model with 896 experts, 16 activated per token (including 2 shared experts), for roughly 104 billion active parameters per token. Those 896/16 numbers are only a teaching example for sparse activation, not the real structure of the 1.7T case here.
For this case, the more important figure is the resource split: the dense path is about 80 billion parameters, or roughly 40GB at 4-bit quantization. The 48GB of VRAM across two cards can hold that dense path while leaving headroom for the KV cache, framework overhead, and scheduling buffers. The routed expert weights, which make up the bulk of the model’s volume, are not a good fit for VRAM.
The key conclusion follows directly: at any given moment, the large majority of expert weights are in a storage state, not a compute state. Response speed is determined by the dense path; storage capacity is consumed by the sparse path. The optimization direction is therefore not to cram every expert weight into VRAM, but to reserve the scarce high-speed compute resources for the dense path, place the bulky sparse expert weights on higher-capacity, cheaper, relatively slower media, and load them on demand.
3. Memory tiering: what goes in VRAM, tmpfs, and persistent memory / NVMe
When VRAM is severely insufficient, a practical approach is to build a three-level storage hierarchy: GPU VRAM, a tmpfs memory disk, and persistent memory or fast NVMe.
Tier 1: GPU VRAM fastest, smallest capacity, usually tens of GB attention + shared expertsTier 2: tmpfs RAM disk DRAM-backed, fast, consumes physical memory hot routed expertsTier 3: PMem / NVMe large capacity, cheaper than DRAM, slower cold routed experts
Tier 1 is GPU VRAM. It holds the dense path — attention and shared experts — on the fastest layer. With about 48GB across two cards, this is roughly 5.5% of the 865GB model files, so full weights are out of the question. VRAM is reserved for the high-frequency, low-latency dense path only.
Tier 2 is a tmpfs RAM disk. tmpfs lives in physical memory, and reads/writes bypass disk I/O, so its speed is close to DRAM. It suits hot experts with frequent access. In this case, about 45 of the model’s 94 shards — roughly 414GB — can be placed in tmpfs.
tmpfs capacity must be capped explicitly and never left to grow unbounded. A workable approach is to set the size at mount time:
mkdir -p /mnt/hotmount -t tmpfs -o size=414G tmpfs /mnt/hot# If the size genuinely needs changing at runtime:mount -o remount,size=414G /mnt/hot
Three safety boundaries matter here.
- tmpfs consumes physical memory directly. Before deploying, confirm physical memory exceeds the tmpfs allocation, and leave enough RAM for the OS, page cache, and the inference processes.
- tmpfs is wiped on reboot. The 414GB of hot experts must be reloaded or migrated back from persistent memory after a restart, which noticeably increases cold-start time. Mitigations include persisting hot experts as DAX files on persistent memory and pre-warming them at startup, or keeping a stable shard index from the training/export stage.
- tmpfs pages can still be swapped out. Reserve a small amount of swap to guard against OOM, and lower
vm.swappiness— for example to 10 — so hot expert pages are not swapped out and drag down decode.
Tier 3 is persistent memory or fast NVMe. Persistent memory offers byte-addressability and fits huge but relatively sparsely accessed expert weights. One common claim needs correcting: the Optane PMem 200 series tops out around 512GB per module, not several TB per module; reaching multi-TB capacity requires populating multiple modules. CXL memory modules do reach TB scale, but their form factor, compatibility, and cost differ from persistent memory and they are not simple equivalents.
For persistent memory to actually serve MoE inference, it must run in App Direct mode and expose byte addressing through a DAX filesystem or devdax. Under Memory Mode (2LM), DRAM is hidden as a cache for persistent memory, so what the system sees is not the stable large-capacity DRAM that a tmpfs hot tier requires — the “hot experts in tmpfs” design would not hold.
If the machine has no persistent memory, fast NVMe can stand in for cold expert storage. A “VRAM + tmpfs + NVMe” three-tier structure still works, but decode throughput is usually lower, because cold-expert hits pay a higher read latency than on persistent memory.
4. CPU–GPU cooperation: GPU computes dense, CPU computes sparse
Whether tiered storage translates into performance depends on how compute work is divided. A workable pattern:
- GPU handles attention and shared experts. This is the dense path: compute-intensive and latency-sensitive, well suited to GPU tensor cores and high VRAM bandwidth.
- CPU handles routed experts. The routed expert tensors stay on the CPU side, fed by persistent memory and tmpfs; the CPU reads the selected experts and runs their feed-forward computation.
This “GPU for dense, CPU for sparse” pattern is essentially fine-grained operator offloading. It works because each token activates only a few experts, so the amount of weight the CPU must move and compute stays limited.
The CPU side is not free of compute cost, though. Routed expert feed-forward still requires FLOPs. At roughly 104 billion active routed parameters per token, the feed-forward path alone is on the order of 208 billion floating-point operations, about 0.208 TFLOP/token. At a generation rate of 3 tokens/s, that implies roughly 0.6 TFLOP/s of effective compute demand. That does not sound extreme, but on a low-clock, vectorization-limited CPU with meaningful dequantization overhead and insufficient expert shard scheduling, the CPU can still become the bottleneck.
So the bottleneck cannot be diagnosed from “is the CPU busy?” alone. It needs to be read together with metrics: if memory bandwidth is near the platform ceiling during decode while CPU utilization is not maxed, the system is usually bandwidth-bound; if CPU cores are pinned for long stretches, memory bandwidth is not saturated, and the GPU is idle or waiting, then CPU compute and scheduling overhead has become the primary bottleneck.
5. Performance comparison and estimates: persistent-memory-only vs. hot experts in tmpfs
On the same hardware, comparing the old approach (all weights in persistent memory, CPU-only inference) with the new one (GPU-accelerated dense path + persistent memory + tmpfs hot experts) shows a clear gain.
| Metric | Old: PMem only / CPU-only | New: GPU + tmpfs | Gain | Main reason |
|---|---|---|---|---|
| Decode throughput | ~2.2 tok/s | ~3.11 tok/s | ~41% | Hot experts served from RAM disk, easing the bandwidth bottleneck |
| Prefill / prompt eval | ~13.3 tok/s | ~16.8 tok/s | ~26% | Prefill here is also limited by expert movement, not purely compute-bound |
Test conditions: ~1.7T parameters, 4-bit weight quantization, ~865GB of model files; ~48GB VRAM across two cards; persistent memory and tmpfs on the CPU side; input prompt ~512 tokens, output ~256 tokens, batch=1, concurrency=1; inference framework version that supports CPU-side MoE offload, with the specific version or commit recorded; warm-up run before measurement, with 3 repetitions averaged.
To reduce the sense of post-hoc curve fitting, the estimate should be stated before the change:
decode_speed ≈ B_eff / (B_dense + B_expert / H)
where B_eff is the effective expert-read bandwidth, B_dense is the bytes read per token by the dense path, B_expert is the bytes of activated routed expert parameters per token, and H is the hot-expert hit rate.
Plugging in this case’s numbers: at 4-bit, 104 billion activated routed parameters come to about 52GB; the dense path reads about 1.5GB per token. Before the change, with effective persistent-memory expert read bandwidth of ~150–160GB/s and a ~0.75 hit rate, the estimate lands at ~2.0–2.5 tok/s; measured old-plan throughput was 2.2 tok/s. After the change, with effective tmpfs bandwidth of ~210–230GB/s and a ~0.8 hit rate, the estimate is ~2.9–3.4 tok/s; measured new-plan throughput was 3.11 tok/s.
The engineering lesson is that the biggest gains come from the stage that the slow media was previously holding back — the memory-access bottleneck. Prefill has more parallelism in theory and should be much faster than decode; here it reached only 13.3–16.8 tok/s, about 5× decode, which suggests it never became purely compute-bound. A more plausible explanation is that CPU-side MoE work also participates in prefill: router selection and expert weight reads still happen. Under batch=1 with a ~512-token prompt, prefill is affected by expert movement and hit rate too, so the improvement is smaller than one might expect.
Set expectations accordingly: 3.11 tok/s generation is slow for interactive chat. It suits offline batch jobs, summarization, code-completion post-processing, and other latency-tolerant scenarios. Smooth conversation would require more aggressive quantization, a more stable expert hit strategy, or larger-scale hardware.
6. Next optimizations: quantization, prefetching, caching, batching
The approach above still has room to improve. Priorities worth investing in:
Expert-aware mixed-precision quantization. Not all experts need the same precision. Experts with low access frequency and low quality sensitivity can be stored at lower precision, shrinking their footprint and letting more experts live on fast media. The key is a joint evaluation of expert hotness + precision loss + activation quality, rather than a blanket global precision reduction.
Routing prediction and prefetching. If the experts the next token is likely to activate can be predicted from historical routing distributions, their weights can be prefetched from persistent memory or NVMe into tmpfs or VRAM ahead of time, hiding access latency.
Expert caching and hotness scheduling. Dynamically adjust which experts stay resident on the RAM disk so the most frequently accessed ones always hit the fast tier. This adapts to changing load better than static sharding.
Batching and concurrency trade-offs. Expert activation patterns differ substantially across batch sizes. Larger batches may raise throughput, but they also amplify VRAM pressure, the range of activated experts, and scheduling complexity — so tuning has to be workload-specific.
7. Common questions and where this applies
Three questions usually come up before anyone starts building.
How much memory does a trillion-scale MoE need? At 1.7T parameters with 4-bit quantization, raw weights are about 850GB, and roughly 865GB once scale factors, routing metadata, and shard indexes are added. Running a 414GB tmpfs on top typically means 600GB+ of physical memory. This is not a configuration an ordinary consumer platform can carry reliably.
tmpfs or persistent memory? Hot, high-frequency experts go in tmpfs; cold, low-frequency ones go on persistent memory or NVMe. tmpfs capacity must stay below the available physical memory headroom and have an explicit cap. Persistent memory should run in App Direct mode and expose byte addressing via DAX or devdax.
Will CPU-side expert compute become the bottleneck? It can. Watch two metrics: whether memory bandwidth is saturated and whether the CPU is pinned long-term. If bandwidth is saturated but the CPU is not, prioritize expert layout and read bandwidth. If the CPU is saturated while the GPU sits idle, work on dequantization, expert scheduling, and batching.
Several mistakes recur:
- tmpfs crowding out memory. tmpfs may look like a “RAM disk,” but it is physical memory. Allocating too much leaves the system short on RAM, squeezes the page cache, and gets processes OOM-killed.
- Persistent memory availability. It is not standard equipment on ordinary servers. Fast NVMe can substitute when it is absent, at the cost of lower decode throughput.
- Routing drift lowering hit rate. MoE routing shifts with input distribution. If the hot-expert profile was built from a single dataset, a change in production traffic can reduce tmpfs hit rate.
- Batch size vs. latency. Larger batches can improve throughput but increase time-to-first-token and the number of activated experts.
- Quantization precision vs. quality. 4-bit or lower eases storage pressure, but with routing-sensitive models, overlapping expert responsibilities, or strict quality requirements, sampled output evaluation is needed to avoid “faster, but worse.”
8. Engineering checklist: profile first, then decide placement
For teams that want to run very large MoE models on constrained resources, this checklist is a starting point for resource profiling and placement decisions.
| Data type | Characteristics | Suggested placement | Rationale |
|---|---|---|---|
| Attention + shared experts | Dense path, used by every token | GPU VRAM | Latency-sensitive, prioritize bandwidth |
| Hot routed experts | High hit rate, frequent access | tmpfs, partially in VRAM if possible | Relieves the bandwidth bottleneck |
| Cold routed experts | Low hit rate, large volume | Persistent memory or fast NVMe | Capacity as the floor |
| Routing metadata and indexes | Small, frequently accessed | DRAM or tmpfs | Reduces scheduling overhead |
Start by measuring expert activation frequency. Do not profile from aggregate model parameter counts; profile against real decode load: sample a set of prompts, record the router’s cumulative top-k expert activations token by token, and measure hit rate over a sliding window. Simplified pseudocode:
counter = Counter()for token in sample_batch:router_logits = model.router(hidden_state)topk = router_logits.topk(k)counter.update(topk.tolist())hot_experts = [e for e, c in counter.most_common() if c > threshold]
Once the profile exists, place in order: mark the dense path and put it in GPU VRAM; profile hot experts and cap the tmpfs size; move cold experts to persistent memory or NVMe.
Validate rather than extrapolate: do not rely on theoretical bandwidth or theoretical parameter counts, but benchmark with real prompts, real batch sizes, and the real routing distribution, and record time-to-first-token, decode throughput, CPU utilization, available memory, and OOM logs.
When local hardware genuinely cannot carry the load or elastic scaling is needed, inference services can be deployed via container orchestration, model weights pulled from object storage, and monitoring/alerting used to track throughput, time-to-first-token, and resource usage. These cloud capabilities are an extension mechanism, not a substitute for precise local memory tiering design.
Overall, running a trillion-parameter MoE on limited hardware is not a single-component hardware problem; it is a resource scheduling problem. Understanding the tiering opportunity created by sparse activation — giving the dense path to the GPU, placing sparse experts in tmpfs and persistent memory according to hotness, and layering on quantization, prefetching, and cache scheduling — can yield reproducible, measurable inference performance at well below the cost of an enterprise-scale cluster.
