Offloading Qwen4-35B's 12GB n-gram table to SSD costs only ~5% speed, rasbt finds

rasbt · x · 2026-12-05

Sebastian Raschka continues his memory analysis of Qwen4-35B-A3B: it uses 12GB more RAM than Qwen3.8-35B-A3B (no n-gram), mostly due to a 20B-entry n-gram table.

He tested llama.cpp's --lazy-mode on to offload that table to SSD on a DGX Spark: loaded RAM dropped from 32.0 to 21.2 GiB (-10.8 GiB), peak inference RAM from 32.7 to 21.8 GiB. Speed cost was modest: generation fell from 57.5 to 54.7 tok/s (-5.0%) with 512-token input, and only -0.8% to -3.5% with 4096-token input. Conclusion: outsourcing the n-gram table incurs little token/sec penalty, making the model viable on memory-constrained hardware.

Original post →

More from Infra

Infra channel →