Running LLMs Locally on a Unified Memory Mini PC: Deployment and VRAM Estimation Guide
This guide covers running large language models locally on a compact unified memory mini PC. It explains when local deployment makes sense, how to check how much memory the GPU can actually use, and how to set up Ollama with longer context windows and secure network access. It also shows how to estimate VRAM needs from model weights and KV cache size, and how to plan running several models on one machine.
1. Why Consider Local Deployment
Cloud APIs bill by token. Tasks such as summarizing long documents, multi-turn conversations, and batch translation consume tokens quickly. A single full code review or a summary of a few dozen pages can use hundreds of thousands of tokens. Beyond cost, there are three other issues. Rate limits during peak hours can interrupt your workflow. When internal documents or unpublished code are involved, sending data to a third-party service carries compliance risk. And when the network is offline or weak, cloud models are unavailable.
Local deployment replaces ongoing pay-per-use spending with a one-time hardware investment, plus electricity, hardware depreciation, and maintenance time. For long-term, high-frequency use, the marginal cost per call is usually lower. For light usage, however, hardware costs can exceed cloud fees. Local deployment is also limited by power consumption, VRAM capacity, and concurrency, so it does not mean unlimited free calls. Once data stays on your machine, you are responsible for backups and access control.
2. Hardware Selection: Start with Unified Memory Capacity
Running LLMs locally is first constrained by video memory. Consumer discrete GPUs typically have 8GB to 16GB of VRAM, which runs 7B-class quantized models smoothly. For models around 30B parameters, you have to trade off quantization quality against the slowdown from offloading when VRAM is insufficient.
Compact mini PCs with unified memory architecture let the CPU and GPU share one high-bandwidth memory pool. Common configurations are 64GB or 128GB. How much memory can be allocated to the GPU depends on the platform, operating system policy, drivers, and inference framework. There is no fixed ratio. Check the vendor’s documentation before buying, and test on the target machine. For example, on a 64GB model, the operating system and other applications use part of the memory, so the amount available to the GPU is usually well below the total.
When choosing hardware, check the following:
- Memory capacity and bandwidth. Bandwidth affects token generation speed. Capacity determines how large a model you can load.
- Whether your inference framework supports the platform’s acceleration backend.
- Cooling and noise. For 24/7 operation, evaluate temperature and fan noise under sustained load.
- Storage. Model files often run 10GB or more each, so plan for at least 1TB of storage with room to expand.
After deployment, you can verify how much memory the GPU can actually use in two ways. First, run ollama ps to see the memory footprint of loaded models and the CPU/GPU allocation split. Second, monitor memory before and after loading a model with a system tool, such as free -h on Linux, Activity Monitor on macOS, or Task Manager on Windows.
3. Deployment Path 1: Ollama Command Line
Ollama is a widely used tool for running models locally. It supports macOS, Linux, and Windows. The steps below use Linux as an example. Commands may change between versions, so refer to the official instructions at ollama.com.
We recommend downloading and reviewing the install script before running it, rather than piping it directly into a shell:
# 1. Download the official install script and review its contentscurl -fsSL https://ollama.com/install.sh -o install.shless install.sh# 2. Run the installer after confirming the contentssh install.sh# 3. Pull a model (check the Ollama model library for valid tags, e.g., qwen2.5:32b)ollama pull qwen2.5:32b# 4. Chat in the terminal to confirm the model worksollama run qwen2.5:32b
Setting the Context Length
Ollama’s default context length can be short, so long-document tasks require a manual increase. Newer versions support the OLLAMA_CONTEXT_LENGTH environment variable, which you can set when starting the service:
OLLAMA_CONTEXT_LENGTH=32768 ollama serve
This variable requires a recent version of Ollama. If Ollama runs as a systemd service, values in the service configuration may override your manual setting. In that case, run sudo systemctl edit ollama, add the following, and restart the service:
[Service]Environment="OLLAMA_CONTEXT_LENGTH=32768"
If the environment variable does not take effect, you can set the context length at the model level in one of three ways:
- In interactive mode, run
/set parameter num_ctx 32768. This applies only to the current session. - Include
"options": {"num_ctx": 32768}in the request body when calling the API. This applies only to that request. - Write
PARAMETER num_ctx 32768in a Modelfile, then runollama createto build a custom model. Every call to that model uses this value.
Use two methods to confirm the setting took effect. First, after loading the model, check the memory usage in ollama ps. Usage should increase as the context gets longer. Second, send a text longer than the default length and check whether the model correctly references content from the beginning of the document.
Network Access and Security
Once the service starts, it serves its API on 127.0.0.1:11434 by default. It also provides OpenAI-compat
