Does the “MoE Cache” Speed Up Models Too Big for VRAM? GLM-5.3-Flash on an RTX 5060 Ti

This page contains advertising (affiliate links). See our Privacy Policy for details.

When a large model does not fit in your GPU, a Mixture of Experts (MoE) model gives you another option: keep the weights of its “experts" in RAM and compute them on the CPU. In an MoE model, only a few of the “experts" inside the model work on each input. In llama.cpp this is the -cmoe (–cpu-moe) option. In October 2026, llama.cpp gained an “MoE cache" (–moe-cache-mib), which copies the most-used experts from RAM into VRAM and keeps them there. If you give part of the VRAM to this cache, how much does the writing speed change? I measured it on a real machine.

As of 28 October 2026.

Sponsored

What I measured

I ran GLM-5.3-Flash (an MoE model, 93GB) with -cmoe on an RTX 5060 Ti (16GB VRAM) connected to a mini PC (EVO-X2) by OCuLink. While changing the MoE cache size, I measured the writing speed [tok/s], the input processing time [ms] and the VRAM usage [MiB]. Running without the cache is the baseline, and I compare each cache size against it.

The writing speed is the number of tokens generated per second [tok/s] (a token is one of the small pieces that text is split into). A larger number means faster writing.

I did not evaluate the quality of the answers (how good the text is).

Sponsored

Purpose: what the MoE cache does to speed, VRAM and input time

This measurement answers three questions. First, what is the writing speed [tok/s] when the cache size is set to 2,200 / 4,400 / 6,600 / 8,800 MiB? Second, how much does the VRAM usage grow with the amount given to the cache? Third, does the cache change the input processing time?

Method

What I used

ItemDetail
MachineEVO-X2 (mini PC). Main memory is about 122GiB
GPUNVIDIA GeForce RTX 5060 Ti (16GB VRAM). Connected by OCuLink (PCIe Gen4 x4). Measured with only this GPU visible (CUDA_VISIBLE_DEVICES=1)
Softwarellama.cpp b11946 (official CUDA 12.8 build). I used llama-server
ModelGLM-5.3-Flash (GGUF distributed by unsloth, quantization UD-IQ1_S, split into 3 files, about 93GB in total)
Launch options-ngl 99 -cmoe -fa on -c 4096 -t 16 –no-warmup. With the cache, the size [MiB] is given to –moe-cache-mib

-cmoe keeps the expert weights in RAM and computes them on the CPU. –moe-cache-mib sets how much of those weights [MiB] is copied into VRAM. b11946 includes a change to how the cache replaces its entries: the old method, LRU (discard the entry that has gone unused the longest), was improved to a method called 50/50 SLRU.

The total size of the model weights differed from the weights I used in an article published on 23 October under different conditions (93,077,724,536 bytes in the 23 October article and 93,087,245,088 bytes as listed by the distributor this time, a difference of about 9.5MB). The distributor may have updated the files. I confirmed that the weights used this time match the hash value (sha256) published by the distributor.

How I measured

ItemSetting
Input and output473 input tokens (the first sentence changed every time to avoid reusing the previous computation), 128 generated tokens, temperature 0
Number of runs6 runs each. The first run is treated separately because it is measured right after launch. Of the remaining 5, I dropped the fastest and the slowest and took the median of the middle 3
Writing speed [tok/s]predicted_per_second in the timings returned by llama-server
Input processing time [ms]prompt_ms in the same timings (the time to process the 473 input tokens)
VRAM [MiB]Maximum usage reported by nvidia-smi (this GPU only)
Transfer recordDuring the measurement with a 4,400 MiB cache, I recorded the GPU’s PCIe receive rate [MB/s] and utilization [%] 15 times with nvidia-smi dmon
Sponsored

Results

–moe-cache-mib [MiB]Writing speed, median of the middle 3 [tok/s]Ratio to baselineFirst-run writing speed [tok/s]Input processing time, median of the middle 3 [ms]Max VRAM [MiB]
None (baseline)17.8461.0017.35411,1288,487
2,2002.774about 0.162.76811,70110,663
4,4003.943about 0.223.95311,34212,863
6,6004.428about 0.254.43810,96915,063
8,800Failed at launch because GPU memory (the CUDA0 buffer) could not be allocated (OOM). Could not be measured

Without the cache, the writing speed was 17.846 tok/s. With the cache, it was 2.774 tok/s at 2,200 MiB, 3.943 tok/s at 4,400 MiB and 4.428 tok/s at 6,600 MiB, all slower than the baseline. A larger cache tended to be faster, but the speed recovered only to about a quarter of the baseline.

I re-measured 4,400 MiB to be sure (3 runs, median). The result was 3.955 tok/s, the same level as the first measurement.

The input processing time was about 11,000 ms (about 11 seconds) under all four conditions, with no visible difference from the cache. Under these conditions, the cache did not affect the processing of the 473 input tokens.

Even without the cache, VRAM usage peaked at 8,487 MiB. This is probably because, even with -cmoe, the non-expert weights, such as attention (the layers that read the context), and the computation buffers are placed on the GPU. With the cache, VRAM usage grew by close to the specified size (about 2,180 MiB more with 2,200 MiB specified, about 4,380 MiB more with 4,400 MiB, and about 6,580 MiB more with 6,600 MiB). 8,800 MiB on top of 8,487 MiB exceeds the 16GB of VRAM, which is probably why the launch failed. I have not confirmed the exact cause of the failure.

Sponsored

Discussion: why the cache was slower here, and how much VRAM it can use

Why was it slower under these conditions?

This measurement alone cannot pin down the cause. Here is what I observed. During the measurement with a 4,400 MiB cache, the GPU’s PCIe receive rate was 4,293 to 7,761 MB/s across the 15 records. The link was Gen4 x4, and GPU utilization was 94 to 100%. The theoretical one-way limit of PCIe Gen4 x4 is about 7.9GB/s, and many records came close to it (12 of the 15 were at or above 6,280 MB/s).

This suggests that copying experts that are not in the cache from RAM to VRAM may be capped by the OCuLink link. In the baseline (no cache), the CPU reads the experts directly from memory and computes them, so this transfer does not happen. However, the log does not show the share of requests served from the cache (the hit rate), so I have not confirmed it. Nor have I confirmed that the transfer is the cause.

If the transfer cap is the main cause, the gap should shrink on a connection with more bandwidth (PCIe x16). I have not checked this.

Cache size and writing speed

As the cache grew, the writing speed rose from 2.774 to 3.943 to 4.428 tok/s. It gained about 1.2 tok/s from 2,200 MiB to 4,400 MiB, and about 0.5 tok/s from 4,400 MiB to 6,600 MiB. These three points alone do not show what happens with a larger cache (8,800 MiB failed).

Room in VRAM

Even on a 16GB GPU, 8,487 MiB is already in use without the cache. Under these conditions, the largest cache I confirmed to work was 6,600 MiB (max VRAM 15,063 MiB). I did not measure sizes between 6,600 and 8,800 MiB. A GPU with less VRAM leaves even less room for the cache.

Sponsored

What I did not check this time

I did not check the following in this measurement.

The only connection tested was OCuLink (PCIe Gen4 x4). I have no results from a machine with the GPU plugged directly into a PCIe x16 slot.

The only model was GLM-5.3-Flash at UD-IQ1_S (a quantization of about 1.56 bits). I did not measure other MoE models or other quantizations, and I did not isolate whether the low-bit quantization affected the result.

The only GPU was the RTX 5060 Ti. I did not measure the RTX 3060 (12GB VRAM) in the same machine or its integrated GPU.

I did not check the cache hit rate. For the launch failure at 8,800 MiB, I only looked at the end of the log (the memory allocation failure) and did not investigate the cause in detail.

I used one input pattern only: 473 tokens in and 128 tokens out. I did not measure long inputs or long outputs, and I did not evaluate the quality of the answers.

Summary: on this OCuLink setup, the MoE cache slowed writing down

What I looked atResult (RTX 5060 Ti 16GB, OCuLink, GLM-5.3-Flash UD-IQ1_S, -cmoe)
Writing speed [tok/s]No cache 17.846 / 2,200 MiB 2.774 / 4,400 MiB 3.943 / 6,600 MiB 4.428
Input processing time [ms]About 11,000 ms. No difference visible with or without the cache
Max VRAM [MiB]No cache 8,487 / 2,200 MiB 10,663 / 4,400 MiB 12,863 / 6,600 MiB 15,063. Launch failed at 8,800 MiB
Transfer observation (4,400 MiB)PCIe receive 4,293 to 7,761 MB/s, Gen4 x4, GPU utilization 94 to 100%. The transfer may be capping the speed (hit rate not confirmed)

Under these conditions, turning on the MoE cache lowered the writing speed to about 0.16 to 0.25 times the speed without it. The input processing time did not change, and VRAM usage grew by close to the specified size (about 2,180 to 6,580 MiB).

Sponsored

When you try it on your own machine

These numbers apply only to these conditions. The table below lists what improves and what limits come with turning the cache on.

What to look atResult this time
Writing speedUnder these conditions it went down with the cache on (17.846 → 2.774 to 4.428 tok/s). The larger the cache, the smaller the drop
Input processing timeNo change (about 11,000 ms)
VRAMGrows by the specified size. 8,487 MiB is used even without the cache
Connection bandwidthOn PCIe Gen4 x4, the receive rate rose close to the limit. A machine with x16 was not measured

To check the difference on your own machine, measure once with -cmoe alone, then add –moe-cache-mib and compare the writing speed with the same input. With a different connection (x4 or x16) or a different model, the result may be the opposite.

Sponsored

Reference: figures reported by the proposer (different conditions from the main tables; I have not reproduced them)

The proposal for this feature (llama.cpp Pull Request #29887) includes speeds reported by the proposer. Their conditions differ from mine, so I keep them out of my tables above, and I have not reproduced them.

ItemReported by the proposerDifference from my measurement
GPURTX 4090 and RTX 5090Mine is an RTX 5060 Ti (16GB VRAM)
ConnectionPCIe 4.0 x16Mine is OCuLink (PCIe Gen4 x4)
ModelQwen3.8-Flash-Next (Q4_0)Mine is GLM-5.3-Flash (UD-IQ1_S)
Writing speed25.0 → 39.4 tok/s (about 1.57 times, 4090, 6.4GB cache) / 30.8 → 54.5 tok/s (about 1.77 times, 5090)Mine went down with the cache

These values are copied as written in the PR. With conditions this different, they cannot be said to contradict my results.

Sponsored