Local LLM Inference: A Guide to CPU, GPU, and NPU Configuration
Learn how to assess runtime support, budget memory, configure CPU–GPU offloading, and validate NPU execution for local LLM inference. This guide distinguishes same-model acceleration from task-level orchestration and explains how to measure performance, troubleshoot bottlenecks, and maintain a reliable fallback configuration.
1. Available Hardware Does Not Automatically Mean Joint Acceleration
Local large language model applications typically provide model management, chat interfaces, inference settings, and local serving capabilities. For developers, their main value is the ability to test models, validate application prototypes, and perform selected data-processing tasks on their own devices.
The desktop interface, however, is only the entry point. The underlying inference engine and its device backends determine which hardware performs the computation. Configuring a CPU, GPU, and NPU to work together therefore starts with checking capabilities—not changing settings.
Three common execution patterns must be distinguished:
- Single-device execution: Most model computation runs on the CPU, GPU, or NPU, while other devices handle supporting tasks.
- Layer offloading: Some model layers run on the GPU, while the remaining layers stay on the CPU. This is useful when GPU memory cannot hold the entire model.
- Heterogeneous task orchestration: Different devices handle different models, requests, or processing stages. For example, the CPU organizes inputs, the GPU runs a generative model, and the NPU executes another supported lightweight model.
These patterns are not interchangeable. In particular, task-level orchestration does not mean that a single generative model is being jointly computed across all three devices.
Simultaneous increases in CPU, GPU, and NPU utilization do not prove that three-device acceleration is enabled. To identify the actual execution path, examine model-loading logs, device assignments, and resource usage during inference.
2. Understand Each Device’s Role
CPU: General-Purpose Execution and Coordination
The CPU is well suited to tasks with frequent branching, complex control logic, or operations that are difficult to move to an accelerator. In local LLM applications, it commonly handles text preprocessing, tokenization, request scheduling, data preparation, and output assembly.
The CPU may also perform model computation directly when hardware acceleration is unavailable or an accelerator backend does not support certain operators. Its strength is broad compatibility, while its performance on large matrix operations is typically affected by memory bandwidth, core count, and instruction support.
More threads are not always better. Excessive threading can increase scheduling overhead and cache contention, or make the desktop less responsive. Leave capacity for the operating system and choose thread settings through measurement.
GPU: Large-Scale Parallel Computation
GPUs typically accelerate matrix multiplication and other operators suited to parallel execution. For larger generative models, the GPU is often the main source of local inference performance.
GPU acceleration is constrained by available GPU memory. Model weights, context caches, and execution buffers all consume memory. If a full model exceeds the budget, options include using a smaller model, choosing a supported quantization format, reducing context length, or offloading only some layers.
Partial offloading also has a cost: intermediate data must move between the CPU and GPU, and device synchronization adds latency. Offloading more layers often improves performance, but gains are not necessarily proportional across all models and backends.
NPU: Specialized Acceleration Requires a Complete Software Stack
An NPU is optimized for specific neural network workloads. Its suitability depends on supported operators, data types, memory architecture, and compilation tools.
Using an NPU often requires the following steps:
- Verify that the device driver and runtime are available.
- Check whether the model architecture and data types are supported.
- Convert or compile the model into a representation the target runtime can execute.
- Confirm restrictions on input shapes, context length, and dynamic dimensions.
- Validate output correctness and performance on the target device.
An NPU is not a general-purpose drop-in replacement for a GPU. Operating-system recognition of an NPU does not mean that every local LLM application can use it—or that an existing model file can be loaded directly onto it.
3. Check Capabilities Before Configuring Devices
Identify the Actual Inference Backend
Inspect the application’s runtime settings, device list, documentation, and loading logs. Answer these questions:
- Does it support CPU inference?
- Does it provide a GPU compute backend?
- Can devices be assigned by layer or operator?
- Does it explicitly provide an NPU backend?
- Does its NPU support cover generative models or other model types?
- Can multiple backends cooperate within the same inference graph?
- Do unsupported operators produce an error or fall back to the CPU?
If the application exposes only GPU offloading settings, with no NPU device selection or backend information, a generic toggle cannot make the NPU participate.
Verify Model Compatibility
Being able to download a model does not mean the current application can run it. Local loading depends on the model architecture, file format, tokenizer configuration, quantization format, and backend operator coverage.
For NPU deployment, also verify that conversion is complete, the target data type is supported, long contexts are usable, and generation does not encounter execution restrictions.
“Supports local models” should not be interpreted as “supports all models.” Start with an architecture and file format explicitly supported by the runtime, then validate more advanced configurations incrementally.
Check Hardware Conditions
Before configuration, check system RAM, GPU memory, available storage, cooling, and power settings. Mobile devices may limit sustained performance in power-saving mode, and prolonged workloads can trigger thermal throttling.
Record resource usage from other applications during testing. Otherwise, the same settings may produce very different results under different background loads, making tuning results difficult to interpret.
4. Budget Memory Before Assigning Devices
Model Weights Are Only Part of the Requirement
A rough estimate of weight storage is:
Model weight size in bytes ≈ Parameter count × Average storage bits per parameter ÷ 8
This formula is useful for estimating the model’s scale, but it does not replace measurement. Quantized models may also include scale factors, group information, alignment padding, and other metadata.
Total runtime memory includes context caches, temporary compute buffers, execution graphs, and input/output data. Model file size should therefore not be treated as the GPU memory requirement.
Context Caches Can Drive Memory Growth
Autoregressive generative models typically retain attention-related caches to avoid repeated computation. Cache size depends on the model architecture, context length, cache data type, and number of concurrent sequences.
A model that works for short conversations may not remain stable when processing long documents. Increasing context length or concurrency can cause a model to load successfully but run out of memory during generation.
Leave Headroom for the System and Runtime
Avoid allocating system RAM or GPU memory to its limit. Desktop rendering, background applications, temporary buffers, and runtime memory fragmentation can all require additional capacity.
On unified-memory systems, CPU and GPU memory should not be treated as two independent pools. They may share the same physical memory and compete for both capacity and bandwidth.
5. Build a Stable CPU–GPU Configuration
Step 1: Establish a Reproducible Baseline
Choose a moderately sized model that is explicitly supported. Fix the prompt, context limit, and output length. Where practical, first test CPU execution to confirm that the model loads and completes generation.
Record loading time, time to first token, generation speed, memory usage, and output correctness. Keep these test conditions consistent for subsequent changes.
Step 2: Increase GPU Offloading Gradually
If the application supports layer offloading, start conservatively and gradually increase the number of layers assigned to the GPU. Reload the model and inspect the logs after each change.
Do not monitor GPU memory only during model loading. Test inputs close to the intended context length and verify that enough memory remains available during generation.
If additional offloading reduces rather than improves speed, investigate memory pressure, frequent data transfers, backend fallback, or resource contention from other applications.
Step 3: Tune CPU Threads and Batch Size
Even when the GPU performs most computation, the CPU may still prepare data and execute some operators. Too few threads can limit how efficiently work reaches the GPU; too many can increase contention.
Batch size should also match the workload. Larger batches can sometimes improve input-processing efficiency, but usually require more memory and may not provide the best latency for single-user interaction.
Step 4: Verify the Execution Path
Use several signals to confirm that the GPU is performing model computation:
- Logs show model layers or operators assigned to the GPU.
- GPU memory usage changes after loading in a way consistent with the model size.
- Compute activity is visible during inference.
- Latency or throughput changes reproducibly compared with the baseline.
Device utilization alone is unreliable because desktop rendering and other applications also use the GPU.
6. Validate NPU Integration Separately
First Confirm Independent NPU Execution
If the runtime explicitly supports an NPU, begin with a model within its supported scope. Do not immediately attempt a three-device configuration.
Validate the following:
- Conversion or compilation completes successfully.
- Key operators actually execute on the NPU.
- Frequent CPU fallback does not occur.
- Changes in input length do not cause execution failures.
- Outputs meet the task’s correctness requirements.
- Compilation, loading, and sustained execution costs are acceptable.
Some configurations show NPU activity while the CPU still performs the core computation. Check operator assignments rather than relying on utilization readings.
Same-Model Cooperation Requires Explicit Runtime Support
Distributing one model across the CPU, GPU, and NPU requires runtime support for graph partitioning, tensor transfers, synchronization, and memory management. Each device must also support the required data layouts and operators.
Enabling three separate backends does not automatically create this cooperation. Cross-device transfers and format conversions can offset the benefit of additional compute capacity.
Use same-model heterogeneous execution only when the runtime explicitly supports it and testing demonstrates that it is effective.
Task-Level Cooperation Is Often Easier to Implement
When a system cannot distribute one model across all three devices, task-level separation is an alternative: the CPU handles workflow control, the GPU runs the generative model, and the NPU executes a separate, validated auxiliary model.
Auxiliary tasks might include text classification, embedding computation, or other neural network processing. Their suitability for the NPU still depends on actual runtime support.
This approach connects independent tasks through application-level scheduling, making validation, fault isolation, and fallback easier to manage.
7. Evaluate More Than Generation Speed
Record at least the following metrics:
- Time to first token: Measures the user’s initial wait.
- Input-processing speed: Matters for long prompts.
- Sustained generation speed: Measures decoding efficiency.
- Peak memory usage: Determines the workload size the system can support.
- Concurrent throughput and tail latency: Affect multi-request serving.
- Sustained power consumption and temperature: Influence long-running performance.
- Output quality and stability: Help detect unacceptable changes caused by quantization or conversion.
The first run may include compilation, cache initialization, or other setup work. Record it separately from subsequent runs. Repeat each test several times rather than drawing conclusions from a single peak result.
Keep the model, context length, prompt, generation settings, and output length as consistent as possible. If conversion requires a different quantization format or model representation, document the difference so that changes caused by multiple variables are not mistaken for hardware acceleration gains.
8. Common Problems and Troubleshooting
The Model Loads, but Acceleration Is Minimal
Check whether the hardware backend is actually active, whether operators fall back to the CPU, and whether device transfers are the bottleneck. For small models or short tasks, startup and synchronization overhead can mask acceleration benefits.
Long Inputs Cause Out-of-Memory Errors
Check context-cache usage and batch size first. Reduce the context limit, concurrency, or batch size, or use a lower-memory configuration supported by the runtime.
The System Has an NPU, but the Application Cannot Select It
This usually indicates that the application has not integrated the relevant backend or that the current model is unsupported. Investigate the software stack before repeatedly changing general performance settings.
All Three Devices Are Busy, but Performance Is Worse
Possible causes include frequent cross-device transfers, memory bandwidth contention, operator fallback, and thermal throttling. Reduce cross-device boundaries and return to a simpler execution configuration for measurement.
9. Maintain a Secure Configuration With a Fallback
Obtain model files and extensions from trusted sources, and avoid executing bundled code that has not been reviewed. When enabling a local service, restrict its listening scope and apply appropriate access controls so that the interface is not unintentionally exposed to untrusted networks.
Before regular use, preserve a tested, stable configuration. Record the model version, runtime version, device assignments, context limits, and resource budget. If an advanced configuration fails, fall back to CPU execution or a validated CPU–GPU setup.
The goal is not to keep every device highly utilized. It is to find an appropriate balance among correctness, latency, throughput, power consumption, and maintenance effort.
Confirm capabilities, establish a baseline, tune one setting at a time, and verify the results with logs and measurements. That is the reliable path to configuring local heterogeneous inference.
