Running LLMs Locally on Unified Memory: Sizing, Speed, and 128GB vs 512GB Selection

    Unified memory lets CPUs and GPUs share a single memory pool, making local LLM inference practical, but capacity alone does not determine whether a device will work well. This article explains how to estimate model memory, how prefill and decode are limited by compute and memory bandwidth, and where 128GB and 512GB devices differ in real workloads. It provides formulas, a capacity comparison, and a selection checklist for matching local hardware to model size, quantization, context length, and usage patterns.

    When running large models locally, memory is usually the first constraint. Unified memory devices let the CPU and GPU share the same memory pool, which provides a path to local inference. This article covers three things: how to estimate the memory a model occupies, what limits prefill and decode speed, and where 128GB and 512GB devices differ in practice. It does not cite performance numbers that lack test conditions; readers can use the formulas here to estimate their own requirements.

    How Much Usable GPU Memory Does Unified Memory Provide?

    On discrete GPUs, VRAM and system memory are separate. Model weights must be placed in VRAM before they can be computed at high speed. If VRAM is insufficient, inference either cannot start, or it repeatedly swaps data between memory and storage, causing a sharp drop in speed.

    In a unified memory architecture, the CPU and GPU access the same physical memory. This avoids copying data between two memory pools, but it introduces new constraints. First, the upper limit of memory available to the GPU is determined by the operating system, driver, and inference framework, and is usually lower than total physical memory. Second, the system and other applications also use this memory, so the space available for the model must subtract that usage. Third, when memory pressure is too high, the system begins paging, and inference speed drops noticeably. Limits and tuning methods vary widely across platforms, so check the relevant system documentation before buying.

    It is also important to distinguish capacity from bandwidth. Capacity determines whether a model fits; bandwidth determines the upper bound of decode speed. Both matter.

    Estimate Weight Footprint First, Then Context

    Weight footprint can be estimated with a simple formula:

    Weight footprint (GB) ≈ parameters (billions) × bit width ÷ 8

    By this formula, a 70B model at 4-bit occupies about 35GB, a 100B model at 2-bit occupies about 25GB, and a 1T model at 2-bit occupies about 250GB. For the same 100B model, FP16 weights occupy about 200GB.

    This result is only a lower bound for three reasons. First, in real quantization formats, the average bit width per weight is usually higher than the nominal bit width because scaling parameters must be stored, and some layers may retain higher precision. Second, the inference framework itself needs buffers. Third, context consumes KV cache, which grows with context length and can be calculated as follows:

    KV cache (bytes) ≈ 2 × layers × KV heads × head dimension × context length × bytes per element

    In long-context scenarios, KV cache can consume memory comparable to the weights. Therefore, when judging whether a model can run, add weights, KV cache, and system usage together, and leave some headroom to avoid running at the memory boundary.

    The impact of 2-bit quantization on accuracy depends on model structure and task type and cannot be generalized. For tasks such as text summarization and code completion, some models may be acceptable, but for reasoning, mathematics, or tasks with strict formatting requirements, the loss may be significant. Before choosing a quantization scheme, compare the original model and the quantized model on your own task data.

    Where Prefill and Decode Speed Come From

    LLM inference has two stages. Prefill processes all tokens in the input prompt at once, and its computation can be highly parallel, so it is mainly limited by compute. Decode generates output tokens one by one; each generated token requires reading the model’s active weights from memory once, so it is mainly limited by memory bandwidth.

    Decode speed can be estimated with a rough upper bound:

    Decode speed upper bound (tokens/s) ≈ memory bandwidth (GB/s) ÷ weights read per token (GB)

    Assume a device has 400GB/s of bandwidth (this is only an example, not a measured value for any specific device). Running a 25GB dense model gives a theoretical upper bound of about 16 tokens/s. Actual speed will be lower because of compute overhead, cache misses, framework scheduling, and other losses. For mixture-of-experts (MoE) models, only some experts are activated per token, so the weights actually read are far smaller than the total weights. As a result, decode speed may be noticeably higher than that of a dense model with the same total parameter count.

    This relationship has a direct implication: a model fitting in memory does not mean it will feel smooth to use. With bandwidth fixed, larger models decode more slowly.

    Prefill speed also affects experience. First-token latency is approximately prompt length divided by prefill speed. For example, processing an 8,000-token prompt at a prefill speed of 200 tokens/s requires about 40 seconds before the first token. Readers who frequently analyze long documents or large codebases should include prefill speed in their selection criteria.

    What Changes Between 128GB and 512GB

    Many selection discussions equate memory capacity directly with model size, but that mapping is not rigorous. A more accurate approach is to compare two devices with the same model, the same quantization method, and the same context length.

    The table below gives a rough comparison by weight footprint, excluding KV cache and system usage:

    Model and quantization (approx. weight footprint) 128GB device 512GB device
    100B, 2-bit (approx. 25GB) Fits easily, with ample headroom Fits easily, with ample headroom
    100B, 4-bit (approx. 50GB) Fits, with comfortable headroom Fits, with very large headroom
    100B, 8-bit (approx. 100GB) Fits, but with little headroom Fits, with comfortable headroom
    500B, 4-bit (approx. 250GB) Does not fit Fits, with reasonable headroom
    1T, 2-bit (approx. 250GB) Does not fit Fits, with reasonable headroom

    The difference in the table is mainly capacity; it is not necessarily a difference in speed. For the same 100B, 4-bit model, decode speed on each device is determined by its own memory bandwidth. Larger memory capacity does not automatically make decode faster. The main advantage of a 512GB device is that it can hold larger models or higher bit widths, and it has room to retain longer contexts or keep multiple models resident at the same time.

    Selection Guidance

    Selection depends on the usage scenario. The following guidance can help:

    • Single user, primarily interactive, and able to accept quantization loss: a 128GB device is usually sufficient. Portable machines have limited thermal headroom and sustained power, so long high-load inference may throttling; verify with testing.
    • Need for larger models, higher bit widths, or multiple models resident: a 512GB device is more suitable, at the cost of higher price and larger size.
    • High concurrency, batch processing, full precision, or stable service levels: a single local device is usually insufficient; consider a server cluster or the cloud.

    Once the direction is clear, proceed with the following checklist:

    1. Estimate weight footprint using the formula, add KV cache and system usage, and leave headroom.
    2. Evaluate the quantized model on your own task data, comparing accuracy, format adherence, and code pass rates.
    3. Measure first-token latency and decode speed, and record prompt length, context length, and output length.
    4. Confirm that the inference framework supports the target model and quantization format, such as llama.cpp (GGUF format) and MLX. Frameworks update quickly, so check the current version.
    5. Test temperature, power, and throttling under sustained load.
    6. Confirm privacy and offline requirements, and determine whether data is allowed to leave the machine.

    Public performance data is comparable only when it includes the device model, parameter count, quantization method, context length, batch size, framework version, and memory usage. Numbers missing these conditions can only serve as trend references.

    Working with the Cloud

    Local devices are suitable for privacy-sensitive, latency-sensitive single-user tasks. Batch processing, sudden peaks, and high-concurrency requests are better suited to the cloud. When choosing a cloud service, compare unit compute cost, scaling speed and elasticity, GPU models and supply stability, region and compliance requirements, data residency, storage and network costs, and monitoring and failure recovery capabilities.

    In summary, a 128GB device is suitable for single-user local inference, while a 512GB device is suitable for scenarios that require larger models or more headroom. Neither can replace high-concurrency serving. Before selecting hardware, define task scale, precision requirements, and budget limits.