On-Device LLM Inference on 64 GB Unified Memory: Model Selection, Quantization, and Scheduling
This article explains how to run large language models on a 64 GB unified-memory device. It covers choosing a model and quantization level, estimating weight and KV cache memory with simple formulas, freeing system memory safely, splitting work between a headless compute node and an office machine, and deciding when to send requests to the cloud. All memory figures are formula-based estimates, not measured results. Validate them on your own device with your inference framework before deployment.
1. Calculate Weight Memory First
Weight memory can be estimated with a simple formula. Multiply the parameter count by the bit width and divide by 8 to get the size in bytes. For example, a 35B-parameter model quantized to 6 bits has weights of about 35 × 6 ÷ 8 ≈ 26 GB. Actual model files are usually a few percent larger, because the embedding layer and quantization metadata are not compressed to the full bit width.
The table below lists common configurations for three scenarios.
| Scenario | Model configuration | Estimated weight memory | Recommended use |
|---|---|---|---|
| Daily interaction | 35B MoE, about 3B parameters active per inference step, 6-bit | About 26 GB | Code completion, logic organization |
| High-precision code generation | 26B, 8-bit | About 26 GB | Business code writing, where a low hallucination rate matters |
| Offline deep generation | 27B, 6-bit | About 20 GB | Architecture design documents, long technical reports |
Sparse activation in an MoE model only reduces the compute per inference step. It does not reduce the memory that stays resident. In a 35B MoE model, all experts usually must remain in memory during inference. “Only 3B parameters active per step” therefore does not mean that only 3B worth of memory is used.
After adding the KV cache, activations, and the inference framework’s own overhead to the weights, the daily interaction configuration uses closer to 30 GB or more. If you also run a browser, an IDE, and other large applications, the available headroom shrinks noticeably.
8-bit quantization usually loses much less accuracy than FP16, but it is not lossless. Evaluate code generation quality with the test cases in your own project. Useful metrics include the compile pass rate, the unit test pass rate, and the number of lines that need manual edits each time. These metrics say more than a general claim that quantization is “nearly lossless.”
