Unified Memory Solves the VRAM Problem: A Practical Guide to Local LLM Deployment
A practical guide to deploying large language models on memory-constrained hardware without dedicated VRAM. It explains why integrated GPUs can run LLMs through unified memory, why Mixture of Experts (MoE) models are especially well suited to these platforms, and how to choose hardware, apply quantization, tune performance, and build tool-calling agent workflows. It also flags the security risks of local inference services and helps you decide when local beats cloud.
1. Introduction: The “VRAM Anxiety” of Running LLMs Locally
For a long time, “running large models on your own machine” has been an ideal shared by developers, researchers, and small teams: data never leaves the local environment, there is no pay-per-use billing, and no dependency on the network. But whenever hardware comes up, most people first think of a discrete GPU, because it offers large VRAM, strong compute, and enough capacity to hold models with billions of parameters.
The problem lies precisely in VRAM. The VRAM capacity of consumer discrete GPUs is limited, priced high, and each GB of VRAM often costs several times more than ordinary system memory. To run a larger model, you have to switch to a more expensive card, and costs jump in a stepwise fashion. Cloud inference, by contrast, is cost-effective under a per-token billing model for light usage, but frequent, long-term calls cause the bill to keep accumulating. On top of that, there are the problems of data leaving its origin and network dependency.
A noteworthy shift is that entry-level mini PCs featuring “integrated graphics (iGPU) + large unified memory” are breaking down this barrier. Public benchmarks show that an ordinary Windows mini PC priced at around $700+ can, with the help of a cross-platform graphics compute API and a lightweight inference framework, let the iGPU read system memory directly as VRAM. This allocates more than 21GB of space for model weights and successfully runs two classes of models:
- A Mixture of Experts (MoE) model of around 26 billion parameters, generating at roughly 19.5 token/s;
- An MoE model of about 35 billion total parameters that activates only around 3 billion per token, generating at about 20.8 token/s.
More importantly, this configuration can also support agent workflows with tool-calling capabilities.
Rather than focusing on any specific product, this article distills this real-world case into a general technical question: On platforms with limited memory capacity and no dedicated VRAM, how can you deploy large models—even agents—at low cost and with stability? The sections below cover principles, hardware, configuration, optimization, agents, and selection.
2. How It Works: Why iGPUs Can Run Large Models
2.1 From “VRAM Isolation” to “Unified Memory”
In the traditional “discrete GPU” architecture, the CPU and GPU each own independent memory spaces that are isolated from each other. Model weights on the CPU side must be explicitly copied over the PCIe bus to VRAM before the GPU can use them. Beyond the limit of VRAM capacity itself, PCIe bandwidth (a theoretical ~32 GB/s for PCIe 4.0 x16) becomes an additional bottleneck.
A “Unified Memory Architecture” works differently: the CPU and integrated GPU share the same physical memory pool, mapped into a unified address space. For an iGPU, system memory “is” its VRAM, and the inference engine needs no extra copy—model weights can be read in place. This is exactly why, in the benchmark above, the iGPU could be allocated more than 21GB of “VRAM.”
However, unified memory does not mean unlimited memory; it brings three constraints:
- Capacity is bound by physical memory: weights, the KV cache, runtime overhead, and the operating system all share the same memory pool, so it must be budgeted carefully;
- Bandwidth is determined by the memory channels: dual-channel DDR5-5600 offers a theoretical ~89.6 GB/s, typically lower than a mid-to-high-end discrete GPU at the same price. Some platforms use wide-bus, low-power memory modules with higher bandwidth, better suited to large-memory workloads;
- The sharing mechanism must be “opened up”: many platforms by default carve out only a small chunk of shared VRAM for the iGPU (often just a few GB). Before running a large model, you need to raise the VRAM sharing limit in the driver or firmware settings, or enable “auto allocation,” so the iGPU can make full use of all available memory.
2.2 Open Compute APIs: The Bridge to iGPU Compute
In the past, iGPUs were mostly treated as “graphics cards that can display a picture,” and their general-purpose compute capability was often left idle; programming them usually depended on vendor-proprietary toolchains, which made cross-platform portability costly. Open graphics compute APIs such as Vulkan provide a vendor-neutral, OS-agnostic path for GPU compute. An integrated GPU can use them to run inference on mainstream systems like Windows and Linux without being locked into any single hardware ecosystem.
The significance is freedom in hardware choice:
- The same inference framework and model files can be reused across iGPUs from different vendors and platforms;
- Users are no longer forced to buy a discrete GPU just to “run models”;
- Old devices or entry-level machines can also become compute nodes.
This is exactly the core configuration combination in the benchmark: integrated graphics + unified memory + an open graphics compute API + a lightweight open-source inference framework.
2.3 MoE Architecture: The Perfect Partner for Memory-Constrained Platforms
MoE splits the feed-forward layers into multiple “expert” sub-networks, with a gating network selecting a few experts for each token to participate in the computation. This brings a key property—sparse activation: the model’s total parameters are large, but each token actually involves only a small subset of them.
For memory-constrained platforms, this is a match made in heaven:
| Dimension | Dense model (35B params) | MoE model (35B total / 3B active) |
|---|---|---|
| Weight size after 4-bit quantization | ~17.5 GB | ~17.5 GB (all resident in memory) |
| Weights read per generated token | all ~17.5 GB | only the active ~1.5 GB |
| Pressure on memory bandwidth | very high | about 1/11 of the dense model |
| Context window (8K, fp16 KV cache, excluding runtime) | ~1–3 GB (varies by architecture) | ~1–3 GB (varies by architecture) |
| Fit for this approach | slow generation | suitable, tens of tokens per second |
During decoding, each generated token requires reading all of the currently active weights once—a classic memory-bound task. The model runs on an entry-level iGPU with around 2,000 compute units and a memory bus of only about 128 bits, so compute is limited. A dense model’s decode speed is constrained by memory bandwidth and will fall well below experienced expectations. MoE, by contrast, reads only about 1.5GB of weights per token; combined with memory bandwidth in the tens-of-GB/s range, it can in theory generate a dozen or so tokens per second—and in practice both models ran at around 20 token/s.
Two more points are easy to overlook:
- The prefill phase is very different: processing the input prompt requires computing over all tokens, and since expert routing sends different tokens to different experts, handling a long prompt reads a large amount of weights at once. As a result, the speed of processing long prompts (first-token latency) on such platforms is often poor, and you should keep input length in check for interactive use;
- The extra cost of long contexts: the KV cache grows linearly with context length, and an 8K context under fp16 can consume several GB of additional memory. Once it exceeds physical memory, the system turns to virtual memory swapping, and speed drops off a cliff. At that point you need techniques such as KV cache quantization or sliding-window context to keep it under control.
2.4 Estimating Memory Before Deployment
Before going live, you can do a rough calculation with a few simple formulas, then decide on the model and hardware:
def estimate_memory(total_params_b, quant_bytes, kv_bytes, runtime_gb=4):"""Estimate memory usage after the model is loaded (in GB)."""weights_gb = total_params_b * quant_byteskv_gb = kv_bytes / (1024 ** 3)return weights_gb + kv_gb + runtime_gbdef estimate_decode_tps(bandwidth_gbps, active_params_b, quant_bytes, efficiency=0.45):"""Roughly estimate decode speed: theoretical = effective bandwidth / weights read per token."""theoretical = bandwidth_gbps / (active_params_b * quant_bytes)return theoretical, theoretical * efficiency# Example: dual-channel DDR5-5600, effective bandwidth estimated at 70 GB/stheory, realistic = estimate_decode_tps(70, active_params_b=3, quant_bytes=0.5)print(f"Theoretical {theory:.1f} tok/s, about {realistic:.1f} tok/s after real-world efficiency")kv_8k = 2 * 48 * 8 * 128 * 8192 * 2 # 2(K/V) x layers x KV heads x head dim x seq length x bytesprint(f"8K context KV cache is about {kv_8k / 1024**3:.1f} GB")print(f"Total memory usage is about {estimate_memory(35, 0.5, kv_8k):.1f} GB")
The output is roughly: theoretical 47.0 tok/s, about 21.2 tok/s in practice; an 8K context KV cache of about 1.6 GB, and total memory usage of about 23.1 GB. Real-world speed is usually slightly below the estimate, because of KV cache reads, expert routing and scheduling, operator overhead, and so on.
3. Hardware Selection: Five Key Dimensions
- Memory capacity: 32GB is a good starting point, and a platform with 128GB of memory can handle a 70B-class MoE model when memory bandwidth allows. The criterion is simple: the quantized weight size, the context KV cache, and the runtime and OS overhead combined should not exceed about 80% of available memory, leaving headroom for peaks and fragmentation.
- Memory bandwidth: this is the decisive factor for decode speed. Prioritize dual-channel or higher configurations, high-frequency DDR5, or wide-bus low-power memory. Single-channel memory halves the bandwidth, which means decode speed drops by roughly half too—the most common and most easily overlooked bottleneck on entry-level setups.
- iGPU specifications: the number of compute units and core frequency affect prefill speed. This matters more when a single token activates many parameters, or when handling long prompts and larger batches.
- Power and thermals: mini PCs are prone to thermal throttling under sustained full load. Choose models with sensible cooling designs and support for higher power release, and keep them ventilated.
- Storage and expandability: model weights are often tens of GB, so a fast SSD is recommended to shorten load times. Also confirm whether the memory is expandable, leaving room for a larger model in the future.
4. Software Stack and Configuration
4.1 Choosing an Inference Framework
Prioritize a lightweight inference framework that supports a general GPU backend, quantized weights, and MoE architecture, and confirm the following capabilities:
- Support for open graphics compute APIs (or vendor-proprietary GPU backends);
- Support for low-bit quantization such as 4-bit;
- Dedicated optimization for MoE expert routing, rather than expanding MoE into a dense structure;
- Support for CPU/GPU hybrid offloading, keeping some layers on the CPU side when memory runs short.
4.2 Quantization Strategy
Quantization is a common technique for trading precision for memory and speed. After quantizing weights to 4-bit, a 35B model is about 17.5GB—right in the range where “unified memory can comfortably hold it while a discrete GPU often lacks the VRAM.” In practice:
- Weights: prioritize the 4-bit mid tier; the quality loss is usually small, and it pairs well with 32GB memory platforms;
- KV cache: 8-bit quantization can be used to save memory under long contexts; for precision-sensitive scenarios, keep higher precision;
- Activations: 8-bit quantization is faster, but when both weights and activations are 8-bit, the model size roughly doubles and needs a larger memory budget.
4.3 Example Configuration
The configuration snippet below illustrates what each parameter means; it is not the interface of any specific product:
# Runtime configuration examplebackend = cross-platform-gpu-api # general GPU backenddevice = integrated-graphics # use integrated graphicsprecision = q4_k_m # 4-bit quantization tiern-gpu-layers = 99 # push as many layers as possible to the GPU; lower gradually when memory is tight# Context and batchingcontext-size = 8192 # context window; KV cache grows linearly with itbatch-size = 512 # prefill batch size; too large may squeeze memoryflash-attn = on # enable fused attention kernel to reduce KV cache bandwidth cost# Performancethreads = 8 # number of CPU threads; affects CPU-side layers and MoE routing
4.4 Platform-Side Settings
- Raise the shared VRAM limit: in the driver control panel, set the iGPU shared VRAM limit to a higher tier, or choose auto allocation;
- Confirm the memory channels: check the “Speed” and “Slots used” for memory on the performance page of the task manager; a dual-channel platform usually shows two slots occupied;
- Use the high-performance power mode: avoid the system automatically throttling under load;
- Close background consumers: browser tabs, cloud drive sync, and similar programs occupy precious memory;
- Set up virtual memory: it is recommended to size the page file according to physical memory, to avoid the system crashing outright when memory is exhausted.
5. Performance Optimization Checklist
- Reduce “weights read per token”: the quantization tier, KV cache precision, and whether fused attention is enabled all directly affect decode speed. Test each option to find the best balance between speed and quality;
- Tune the CPU/GPU layer split: pushing more layers to the GPU can improve decode speed but squeezes system memory. When memory is tight, lower
n_gpu_layersgradually to balance “getting it to run” and “getting it to run well”; - Control context length: in agent scenarios, tool outputs are often long, so set a context limit and pair it with a sliding window or summary compression to prevent KV cache bloat;
- Use batching sensibly: keep a small batch size for single-user interactive scenarios; batch offline tasks can use a larger size, but watch the memory ceiling;
- Manage the runtime environment and concurrency: avoid multiple inference processes co-resident on the same machine; agents can reuse a single resident inference service, avoiding reloading the model on every call.
6. From Model to Agent: A Complete Local Deployment Workflow
In the benchmark, this mini PC could not only “chat” but also support a complete agent workflow with tool-calling capability, such as HermesAgent, carrying out a plan–execute–reflect loop. The implementation path usually has three steps:
- Service-wrap the model: use a lightweight framework to wrap the model into an HTTP service that exposes a chat-completion interface consistent with mainstream large-model APIs. On the agent side, you only need to point
base_urlat the local address, with no changes to business code; - Register tools: wrap capabilities such as file read/write, code execution, and web scraping into tools described with a JSON Schema, and let the model choose via function calling;
- Loop scheduling: the agent parses the tool calls returned by the model, executes them, feeds the results back, and issues the next request, until the model gives a final answer.
Three practical points for deployment:
- Match the capability boundary: tool calling and structured output place higher demands on model capability; beyond raw decode speed, pay more attention to how well and reliably the model supports function calling;
- Long-prompt optimization: at each round, the agent replays the full conversation and tool results, so the input grows longer, while this class of platform is slow at prefilling long prompts. Controlling prompt length through context compression, or feeding back only summaries of tool results, can significantly improve loop speed;
- Concurrency and resource reuse: agents often carry multiple tools and contexts at once, so memory usage fluctuates widely; it is advisable to set memory alerts to prevent being dragged down by the system swapping memory out.
7. Security Reminder: Local Inference Is Not “Inherently Safe”
Local deployment often gives the impression that “data is safe as long as it stays on the intranet,” but by default the inference service usually has no authentication. Once the listen address is set to 0.0.0.0, or is forwarded to the public internet by a router, anyone who can reach that address can call your model, consume compute, and even coax the model into executing tools through malicious prompts. Recommended measures:
- Bind only to 127.0.0.1 by default, and add access control when LAN access is needed;
- When exposing to the outside, add a reverse proxy, authentication, and TLS encryption;
- Set permission allowlists and sandbox isolation for the agent’s tool calls, especially for capabilities involving the file system and command execution;
- Use monitoring and alerting tools to keep an eye on VRAM/memory usage and service health.
8. Local or Cloud: Selection Advice
| Scenario characteristic | Local unified-memory solution | Cloud inference service |
|---|---|---|
| Data sensitivity | high; data must not leave local | medium-low; data leaving origin is acceptable |
| Usage frequency | high frequency, long-term, single person or small team | low frequency, on-demand, bursty traffic |
| Model scale | 10B–70B-class MoE models | can cover larger models |
| Concurrency needs | low; mostly serial interaction | high concurrency, multiple users sharing |
| Cost structure | one-time hardware investment + electricity | pay per token or per resource-hour |
| Ops capability | some hands-on ability | want out-of-the-box |
The two are not mutually exclusive. A common practice in production is: local handles high-frequency, sensitive, lightweight inference; cloud handles high-concurrency, ultra-large models, and elastic peaks. If you use cloud capabilities, you can elastically scale inference instances via a container platform, host models and data in object storage, track latency and error rates with log services and monitoring alerts, and decouple asynchronous tasks with message queues. Cloud providers such as Baidu AI Cloud offer general-purpose cloud products covering the scenarios above, which can be combined as needed.
9. Summary
- Hardware: the combination of integrated graphics + unified memory + an open compute API breaks the fixed belief that “running a large model requires dedicated VRAM.” A dual-channel entry-level host with 32GB of memory is enough to run a 35B-class MoE model smoothly;
- Model: MoE’s sparse activation mechanism naturally fits memory-constrained platforms, making “large total parameters, small activation” the optimal solution for running large models on a small machine;
- Configuration: the VRAM sharing limit, quantization tier, CPU/GPU layer split, and context length are the four knobs that most affect the real experience;
- Application: on unified-memory platforms, from chat to agents and from single points to workflows, local AI has moved from “it runs” to “it is usable”;
- Security: before wiring a local inference service into real business, complete authentication and access control first, and do not let “local” become a blind spot for security.
