Ollama VPS Requirements: CPU, RAM & Model Sizes
In this article
- Background: What Ollama Is and How It Uses Hardware
- How Model Size Translates to RAM Requirements
- CPU Requirements: Cores, Clock Speed, and Memory Bandwidth
- How to Choose a VPS for Ollama
- Common Problems and How to Avoid Them
- Comparison: CPU-Only vs GPU VPS
- Costs and Budget Considerations
- Frequently Asked Questions
This guide explains what CPU, RAM, and storage you need to run Ollama on a VPS, and how those requirements scale with model size. You'll learn how to match a VPS to the models you want to run, and how to avoid the most common performance pitfalls.
Background: What Ollama Is and How It Uses Hardware
Ollama is a tool for running large language models (LLMs) locally. It downloads models, runs them via a command-line interface or API, and handles the low-level GPU/CPU inference. When you run Ollama on a VPS, the hardware is shared and fixed, so you must choose a VPS that matches the model's needs. The key insight is that LLM inference is memory-bandwidth-bound: the model weights must be read from RAM or VRAM for every token generated. This means RAM capacity and memory bandwidth matter more than raw CPU clock speed for most models.
How Model Size Translates to RAM Requirements
Model size is usually quoted in parameters (e.g., 7B, 13B, 70B). A 7B model with 4-bit quantization uses roughly 4–5 GB of RAM; the same model in 16-bit uses about 14 GB. As a rule of thumb, multiply the parameter count by 2 bytes for 16-bit, or by 0.5–0.6 bytes for 4-bit quantization. For example:
- 7B model, 4-bit: ~4–5 GB RAM
- 7B model, 16-bit: ~14 GB RAM
- 13B model, 4-bit: ~8–9 GB RAM
- 13B model, 16-bit: ~26 GB RAM
- 70B model, 4-bit: ~40–45 GB RAM
- 70B model, 16-bit: ~140 GB RAM
These numbers include a small overhead for the context window and runtime. The actual RAM usage also depends on the context length (the number of tokens the model can process at once). A longer context uses more memory for the attention cache, so if you plan to use 32k or 128k context, add 1–2 GB extra.
CPU Requirements: Cores, Clock Speed, and Memory Bandwidth
For CPU-only inference, the CPU's memory bandwidth is the bottleneck, not the number of cores. A single-core VPS with high memory bandwidth will outperform a many-core VPS with slow RAM. In practice, you want at least 4 vCPUs for a 7B model, 8 vCPUs for a 13B model, and 16+ vCPUs for a 70B model, but the exact speed depends on the RAM type (DDR4 vs DDR5) and the number of memory channels. A VPS with 4 vCPUs and 8 GB RAM can run a 7B 4-bit model at roughly 5–10 tokens per second. Doubling the vCPUs to 8 might get you 8–15 tokens per second, but the gain is not linear because memory bandwidth is shared. If you have a GPU on the VPS, the CPU matters less; the GPU does the heavy lifting, and the CPU just feeds it data.
How to Choose a VPS for Ollama
Follow these steps to pick a VPS that fits your needs:
- Decide which models you want to run. Start with the largest model you plan to use regularly. If you're just experimenting, a 7B model is a good starting point.
- Calculate RAM. Use the table above. Add 2–4 GB for the OS, Ollama runtime, and context cache.
- Choose CPU count. For CPU-only, get at least 4 vCPUs for a 7B model, 8 for 13B, and 16 for 70B. For GPU, 2–4 vCPUs is often enough.
- Consider GPU. If you want fast responses (30+ tokens/sec), get a VPS with an NVIDIA GPU that has at least 8 GB VRAM for a 7B model, 16 GB for 13B, and 48 GB for 70B (4-bit).
- Check storage. Models are large. A 7B 4-bit model is about 4 GB; a 70B 4-bit model is about 40 GB. Ensure you have at least 2x the model size in SSD space.
- Test with a small model first. Rent a cheap VPS with 4 GB RAM, run a 3B model, and see if the speed is acceptable before scaling up.
Common Problems and How to Avoid Them
The most frequent mistake is buying a VPS with enough RAM but too little memory bandwidth. For example, a 4-vCPU VPS with 8 GB RAM might run a 7B model, but if the RAM is shared with other tenants, you might get only 2–3 tokens per second. Another common issue is running out of RAM during inference because the context length is set too high. Ollama defaults to a 2048-token context, but if you increase it to 8192, memory usage can double. Also, be aware that some VPS providers throttle CPU after a certain usage level; this makes inference slower over time. To avoid these issues, monitor memory usage with free -h and CPU usage with top, and start with a small context length.
Comparison: CPU-Only vs GPU VPS
CPU-only VPS are cheaper and more widely available, but they are slow for large models. A 7B model on a good CPU might give you 10 tokens per second, which is usable for chat but not for real-time applications. GPU VPS are faster but cost significantly more. For example, a VPS with an NVIDIA T4 (16 GB VRAM) can run a 13B 4-bit model at 30–50 tokens per second, but the hourly cost is roughly 5–10x a CPU-only VPS. If you're building a production API, a GPU VPS is usually worth the cost. If you're just testing, a CPU-only VPS with 8 GB RAM is fine.
Costs and Budget Considerations
VPS pricing varies widely, but as a general guide, a 4 vCPU / 8 GB RAM VPS costs around $20–$40 per month. A 8 vCPU / 16 GB RAM VPS costs $40–$80. A GPU VPS with 16 GB VRAM starts around $100–$200 per month. To save money, consider using a provider that bills by the hour so you can spin up a VPS only when you need it. Also, note that some providers offer free tiers with 1–2 GB RAM, which are too small for any useful model (even a 1B model needs ~1 GB). You can also run Ollama on a local machine if you have a decent CPU/GPU, and only use a VPS for remote access.
Frequently Asked Questions
Can I run Ollama on a 2 GB RAM VPS? No, the smallest useful model (like a 1B parameter model) needs at least 1 GB just for weights, plus OS overhead. You'll run out of memory quickly. Stick to 4 GB minimum.
How much RAM do I need for a 7B model? For a 4-bit quantized 7B model, you need at least 6 GB of free RAM (model + overhead). For 16-bit, you need about 16 GB. Always check the model's page on Ollama's library for exact sizes.
Does Ollama use GPU if available? Yes, Ollama automatically uses NVIDIA GPUs if CUDA is installed. It will fall back to CPU if no GPU is found. On a VPS, you must ensure the GPU drivers are installed and that the GPU is visible to the container.
What is the fastest CPU for Ollama? There's no single answer, but CPUs with high memory bandwidth (like AMD EPYC or Intel Xeon with many channels) perform best. In general, a modern 8-core CPU with DDR5 RAM will give you around 10–15 tokens per second for a 7B model.
Can I run multiple models on one VPS? Yes, but they share RAM. If you run a 7B and a 13B model simultaneously, you need RAM for both. Ollama keeps models in memory until you unload them, so you might need to manually unload a model to free RAM.
How do I check if my VPS is fast enough? Run a simple benchmark: load a model and generate 100 tokens, then measure the time. A speed of 5 tokens per second is acceptable for chat; 20+ is good for real-time use. If it's too slow, consider a GPU or a larger VPS.