Running a 35B LLM Locally on Low-Cost Devices: Feasibility and Methods
This article explains when a 35B-parameter large language model can run locally on a low-power device with integrated graphics. It covers how unified memory and quantization determine capacity, how memory bandwidth limits decoding speed, why mixture-of-experts models differ from dense models, how to estimate memory needs, how to choose an inference backend, and the basic deployment steps.
1. Background
More developers want to handle code assistance, document processing, and agent tasks without calling cloud APIs or paying per-use fees. Models with billions of parameters were long assumed to require a discrete GPU and large VRAM. In practice, with a unified memory architecture and a suitable quantization scheme, some mid-sized models can already run on low-power devices with integrated graphics. This article covers the conditions under which this approach works, how to estimate resources, the deployment process, how to measure performance, and the limits of the approach.
2. Hardware Basics: Integrated Graphics and Unified Memory
Integrated graphics have no dedicated VRAM. They usually share system memory with the CPU. The motherboard or driver reserves a small block of video memory, typically from a few hundred MB to several GB. The operating system allocates the rest to the GPU on demand. The GPU’s usable memory ceiling therefore depends on total system memory and the allocation policy, not on the reserved amount.
This structure leads to two direct conclusions:
- The capacity available for model weights is roughly system memory minus the memory used by the operating system and other processes. On a machine with 32GB of RAM, closing large applications could theoretically leave more than 20GB for the model.
- The GPU and CPU access the same physical memory. Inference speed is therefore limited mainly by memory bandwidth, not by GPU compute.
Dynamic allocation is also constrained by system policy. Measure the actual allocatable capacity on the target machine with Task Manager or system tools. Do not rely only on the specifications.
3. Memory Bandwidth and Decoding Speed
When a large language model generates text, it reads the weights from memory once for each token it produces. For a dense model, this means reading all of the weights. The theoretical upper bound on decoding speed can be estimated roughly with this formula:
Theoretical upper limit (tokens/s) ≈ effective memory bandwidth (GB/s) ÷ weight size read per token (GB)
Dual-channel DDR5-5600 memory has a theoretical bandwidth of about 90GB/s. Effective bandwidth is usually only 50% to 70% of the theoretical value. Integrated graphics are therefore better suited to interactive, low-concurrency personal use than to high-throughput server deployment.
4. Model Architecture: Dense Models and Mixture-of-Experts Models
A dense model activates all of its parameters for every inference step. A mixture-of-experts (MoE) model contains many expert subnetworks, but each token activates only some of them. An MoE model can therefore have a very large total parameter count while reading relatively few weights per token.
Consider an MoE model with 35B total parameters and about 3B active parameters per token. With 4-bit quantization, each token reads about 3B × 0.5 bytes ≈ 1.5GB of weights. At an effective bandwidth of 50GB/s, the theoretical decoding limit is about 33 tokens/s. Real runs also include routing computation, attention computation, and KV cache reads, so measured speed is usually lower than the theoretical value. When choosing a model, compare total parameters, active parameters, and architecture together. Comparing total parameter counts alone leads to wrong conclusions.
5. Quantization: Trading Precision for Capacity
Quantization compresses weights from 16-bit floating-point numbers to fewer bits. 4-bit quantization reduces the weight size to about one quarter of the original, at the cost of some loss in precision. For general conversation and code generation, the quality loss from 4-bit quantization is usually acceptable. For tasks such as mathematical reasoning or precise extraction from long documents, compare evaluation results before and after quantization on your target task.
Estimate memory requirements with this formula:
Required memory ≈ parameter count × bytes per parameter + KV cache + runtime overhead
Example code:
def estimate_memory_gb(params_b, bits_per_weight, ctx_len,kv_bytes_per_token, overhead_gb=1.5):weights_gb = params_b * bits_per_weight / 8 # parameter count in billionskv_gb = ctx_len * kv_bytes_per_token / 1e9return weights_gb + kv_gb + overhead_gb# 35B model, 4-bit quantization, weights about 17.5GBprint(estimate_memory_gb(35, 4, ctx_len=8192, kv_bytes_per_token=100_000))
Derive kv_bytes_per_token from the model’s layer count, number of attention heads, and cache data type, using the model’s configuration file. Do not use a rule-of-thumb value.
6. Inference Backends and Hardware Acceleration
An inference backend loads the weights, schedules compute operators, and calls whatever acceleration hardware is available. On integrated graphics devices, common backend types include:
- CPU backend: best compatibility. Performance depends mainly on the CPU instruction set and memory bandwidth.
- Cross-platform graphics compute backend: uses the integrated GPU through a general-purpose graphics compute API. Requires driver support for that API.
- Vendor-specific compute backend: may perform better, but deployment is more complex and depends more heavily on drivers.
Start by getting the workflow running on the CPU backend. Then compare throughput and stability against a GPU backend. The number of GPU offload layers is a key parameter. Offloading more layers uses more shared memory and usually runs faster. Start by offloading all layers, and reduce the number step by step if memory runs short.
7. Deployment Process
- Confirm the system memory capacity and the maximum memory that can be allocated to the GPU.
- Select a model and quantized version, and verify the model’s license.
