Running a 35B MoE on a 6GB RTX 3060: the OOM was not where I expected
In my previous two posts, I looked at how FreeToken runs a 35B MoE on an 8GB GPU and what changes when the VRAM budget drops to 6GB (both in Chinese). After reading about the design and other people’s working configurations, I wanted to try it on my own hardware.
I had an RTX 3060 Laptop with 6GB of VRAM and 32GB of system RAM available. The plan was to run the same Qwen3.6-35B-A3B-NVFP4 model, then see how much performance I could get out of that machine.
Getting one answer was only the first goal. Once it worked, I wanted to check whether the GPU was doing the expert computation, whether more of the available VRAM would help, and which settings actually improved generation speed without making the next request run out of memory.
I expected an installation, a model download and some parameter tuning. Instead, the Windows client and then WSL took me through conversion errors, a weight-loading failure and several different memory problems. Eventually the model answered, but most expert computation was on the CPU. That was where getting it to launch stopped being enough: I still wanted to use the 3060 sitting in the laptop.
This post follows that hands-on attempt, from finding a working GPU path to testing how much more speed the cache and transfer settings could buy. It also explains why I stopped short of filling the remaining VRAM.
Where this round of tuning ended
The configuration I kept uses 896 expert cache slots and asynchronous staging. On a fixed short prompt, measured decode improved from 3.56 to 5.17 tokens/s. Short Chinese, arithmetic and chunked-input checks also completed.
That is a usable configuration from the profiles I tested, not a claim that I found the maximum possible performance of a 3060. A larger cache was slightly faster, but left less memory headroom.
The roughly 45% improvement compares two configurations that both contain the local compatibility patch, not unmodified upstream main. The original offload path failed during host-memory registration on this setup. With that distinction in place, here is the hardware and what actually failed.
The machine matters
| Component | Tested configuration |
|---|---|
| GPU | RTX 3060 Laptop, 6GB |
| CPU | Ryzen 7 5800H, 8 cores / 16 threads |
| Physical RAM | 32GB |
| OS | Windows 10 with WSL2 |
| WSL allocation | 24GB RAM and 24GB swap |
| WSL kernel | 6.6.114.1-microsoft-standard-WSL2 |
| NVIDIA driver | Windows KMD 616.56; WSL NVIDIA-SMI 615.65.06 |
| Checkpoint | nvidia/Qwen3.6-35B-A3B-NVFP4, using an existing FTW |
| Source baseline | 9ef3651309fe4058672f2cc92069238dea06be1b plus local changes |
| Workload limits | 1024-token context, one request, 128-token prefill chunks |
The Windows desktop client previously reported v0.2.0-beta.17. The WSL engine reported 0.1.2. Those are different version identifiers; neither alone describes the modified source that ran this test.
The expert library occupied 16.93 GiB of host memory. This was never a claim that the entire model fits into 6GB, or that 16GB of system RAM would be enough. Framework allocations, buffers and the operating system need memory too.
The misleading part of “out of memory”
The decisive error was:1
RuntimeError: cudaHostRegister failed: out of memory
That operation registers host memory for CUDA access. It is not a GPU-weight allocation. Reducing the KV cache can free VRAM without fixing this failure.
I tried both allocation paths: an ordinary mmap followed by cudaHostRegister, and direct pinned allocation through cudaHostAlloc. In separate probes on this machine, both failed after roughly 1 GiB had been allocated successfully.
That is an observation, not a universal WSL limit. NVIDIA’s CUDA on WSL guide documents limited pinned system memory availability, but does not specify the same 1GB ceiling for every machine.
The Windows page file had also been disabled. After it was configured, the earlier VM exits did not recur in subsequent tests. Large CUDA pinning requests still failed. Windows commit capacity, WSL swap, pinned memory and VRAM were separate problems here. Adding swap did not turn it into pinned memory or VRAM.
I also stopped using the engine’s occasional near-zero throughput log lines as a benchmark. A reporting interval can include a long idle period. All numbers below come from timing client-side streamed requests; there is no controlled CPU-only comparison in this post.
Move a few experts, rather than pinning the library
The existing GPU offload machinery expects device-readable pinned source banks. On a cache miss, it gathers expert rows into GPU cache slots. The host library was simply too large for the observed pinning budget.
The compatibility path leaves the library in ordinary pageable RAM:1
2
3
4
5Pageable expert library in RAM
-> CPU gathers the requested expert bytes
-> small pinned staging buffer
-> H2D transfer and GPU cache scatter
-> expert matrix computation on CUDA

The CPU still copies bytes and prepares indices. It does not perform the expert matrix multiplications on this path. Expert computation for all 40 layers runs on CUDA, with weights arriving on demand rather than staying resident as a complete 35B model.
Each bank stages up to eight experts at a time. More misses are handled in chunks. Byte views preserve packed NVFP4 values and the FP8/FP16 scale banks exactly; this copy step is not another quantization pass.
There are costs. CPU gathering adds a copy, PCIe transfers still happen, and dynamic routing requires synchronization. CUDA graphs and overlapping prefill are disabled in the working configuration. This is a practical fallback for this memory constraint, not a claim of the fastest possible offload design.
Removing waits without corrupting the buffer
The first version used blocking H2D copies. It was easy to reason about: once the copy returned, the host buffer could be reused. It also made the CPU wait for each bank’s transfer.
Switching to non_blocking=True introduces a lifetime problem. If the CPU overwrites a pinned source before DMA finishes reading it, the GPU may receive a different expert’s bytes. A plausible-looking answer would not catch that reliably.
The optimized path uses one CUDA stream. Reading the next miss count waits for preceding work on that stream. Copies, cache scatters and expert computation remain ordered on it. Within a call that needs more than eight experts, there is an explicit wait before the same bank’s host buffer is reused for another chunk.
Tests compared exact bytes for packed uint8 values, FP8 scales and FP16 scales. They covered empty misses, scattered cache slots, more than eight misses, whole-layer prefill, and twenty queued buffer-reuse iterations. The graph-capture path remains disallowed.
What using more VRAM actually bought
Each profile used the same prompt and model, greedy sampling, disabled thinking, and one active request. A 32-token-limit warmup preceded two 96-token-limit measurements. Each measured response reported 95 output tokens.
Decode speed below is approximately (completion_tokens - 1) / time between first and last nonempty streamed chunks. It excludes time to first token.
| Expert slots | Staging | Mean decode | Peak VRAM | Mean TTFT |
|---|---|---|---|---|
| 512 | Synchronous | 3.56 tok/s | 4516 MiB | 6.46 s |
| 896 | Synchronous | 3.88 tok/s | 5158 MiB | 6.58 s |
| 1024 | Synchronous | 3.93 tok/s | 5374 MiB | 6.88 s |
| 896 | Asynchronous | 5.17 tok/s | 5158 MiB | 5.81 s |
| 1024 | Asynchronous | 5.24 tok/s | 5374 MiB | 6.70 s |

I kept 896 slots. The 1024-slot asynchronous profile was only about 1.2% faster and used another 216 MiB. With just two measurements per profile, that small difference is not compelling evidence of a useful gain.
The chosen configuration used around 84% of nominal VRAM in the fixed-prompt benchmark. After additional input shapes, usage reached 5248 MiB with 747 MiB reported free. Runtime buffers change; a single memory screenshot is not a permanent bound.
VRAM occupancy is also not compute utilization. Sampled GPU utilization, including prefill and waiting, averaged about 35.5% for the baseline and 36.5% for the chosen profile. Generation got faster; the GPU did not become fully saturated.
These are observations from one short workload on one laptop. They are not a long-context test, a statistical performance study, or a quality evaluation. Repeated outputs were not universally identical: the larger synchronous and asynchronous profiles produced the same set of two output hashes. Exact copy tests and behavioral checks support the implementation, but do not establish model-wide numerical equivalence.
The working command
This command requires the local compatibility patch. The two staging environment variables are not presented as upstream-supported options. Use a compatible existing FTW directory; model conversion from a clean machine was not revalidated in this experiment.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16export CUDA_VISIBLE_DEVICES=0
export FREETOKEN_PAGEABLE_OFFLOAD=1
export FREETOKEN_STAGING_ASYNC=1
export FREETOKEN_MAMBA_SSM_DTYPE=float16
export PYTORCH_ALLOC_CONF=expandable_segments:False
export TVM_FFI_CUDA_ARCH_LIST=8.6
ft serve \
--model /path/to/Qwen3.6-35B-A3B-NVFP4-FTW \
--attention-backend triton --nvfp4-backend triton \
--moe-backend offload --moe-cache-size 896 \
--kv-reserve-tokens 1024 --expert-load serial \
--memory-ratio 0.95 --max-running-requests 1 --graph 0 \
--max-seq-len-override 1024 --num-tokens 1024 \
--max-extend-length 128 --max-output-tokens 256 \
--disable-moe-prefill-overlap --host 127.0.0.1 --port 1919
Wait for /health to report ok, then make an actual generation request. After the final restart, arithmetic returned 42, a Chinese request returned 运行正常。, and a 296-token prompt split into multiple chunks correctly recalled 7391. All ended with finish_reason=stop. WSL swap remained unused during the observed checks.
The working limits remain 1024 context tokens, one request and at most 256 output tokens. Nothing here proves that a larger context or concurrent requests will fit.
Before sending this upstream
The working and optimized versions were archived separately. A contribution should isolate pageable GPU staging from the unrelated conversion and loader changes made earlier in this debugging session.
Issue #55 already discusses pinned-pool exhaustion. The useful addition here is a bounded-staging GPU fallback for hosts where pinning the source banks is impractical. It needs discussion and review, not a claim that it has been accepted.
FreeToken’s contribution guide asks for current-main validation, real-hardware tests and honest A/B measurements. The code was developed with AI assistance; the submitting author still needs to understand and explain the buffer lifetime rules. The local speed comparison must not be relabeled as an upstream-main benchmark.
For this write-up, I inspected main snapshot af71ba43206e124f5ff6419b47ee36c6e9981078. Host-memory budgeting has changed, so the filtered old patch does not apply cleanly to the engine. The cache and logging hunks pass a text-only application check. This is source inspection, not a latest-main end-to-end test; the working service was left untouched.
The part I would repeat on the next machine is the order of investigation: identify which allocation failed, make one correct path work, and only then spend the remaining VRAM. That saved more time than another round of guessing memory ratios.