Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

How to Run LLMs Locally with Ollama: RAM & VRAM Setup

· 4 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Running large language models locally using Ollama provides complete data privacy, offline functionality, and zero subscription costs. This guide explains how to configure your system’s RAM and VRAM to ensure smooth operation of AI models without crashing or excessive latency.

What You'll Need

  • A computer running macOS, Linux, or Windows 10/11.
  • Ollama installed on your system.
  • Sufficient system memory (RAM) and graphics memory (VRAM). For most modern models, at least 8GB of unified memory (Apple Silicon) or 6GB+ VRAM (NVIDIA) is recommended for basic usage, though 16GB+ is ideal for larger models.
  • A stable internet connection for the initial model download.

Step-by-Step

  1. Install Ollama: Visit the official Ollama website and download the installer for your operating system. Run the installer and follow the on-screen prompts. On Windows, ensure you allow the application to make changes to your device if prompted by security settings.
  2. Verify Installation: Open your terminal (Command Prompt or PowerShell on Windows, Terminal on macOS/Linux) and type ollama --version. If installed correctly, it will display the current version number. This confirms the backend service is accessible.
  3. Understand Memory Allocation: Ollama automatically manages GPU offloading. It attempts to load as much of the model into your VRAM as possible for speed. If the model exceeds VRAM capacity, it spills over into system RAM. Ensure your system has enough total memory to handle the largest model you intend to run.
  4. Pull a Model: In your terminal, pull a lightweight model first to test your setup. Type ollama pull llama3.2 or ollama pull qwen2.5. These are efficient models that require less than 4GB of memory, making them safe starting points for systems with limited resources.
  5. Run the Model: Once downloaded, start the chat interface by typing ollama run llama3.2. The model will initialize, loading weights into your available memory. You can now interact with it directly in the terminal.
  6. Monitor Resource Usage: While the model is running, open your system’s task manager or activity monitor. Observe the "Memory" and "GPU" tabs. If your system becomes unresponsive, the model may be exceeding your available RAM, causing heavy swapping to your storage drive.
  7. Adjust Quantization if Needed: If you experience performance issues, switch to a smaller quantized version of a model. For example, use ollama run llama3.2:1b instead of the full version. Smaller variants require significantly less RAM and VRAM while retaining core reasoning capabilities.

Common Mistakes

Users often attempt to run massive models like Llama-3-70B on machines with only 8GB of RAM. This causes immediate failure or extreme slowness because the system cannot hold the model weights in active memory. Another frequent error is ignoring background applications; browsers and IDEs consume significant RAM, leaving insufficient space for the LLM.

Tips

Close unnecessary applications before launching Ollama to free up maximum RAM. On NVIDIA systems, ensure your GPU drivers are updated to the latest stable version, as older drivers may not support newer CUDA optimizations used by Ollama. If you have multiple GPUs, Ollama will distribute the load automatically, but verify that all cards are detected in your system BIOS/UEFI.

Troubleshooting

If Ollama fails to start, check if another instance is already running in the background. Restarting your computer usually clears stuck processes. If you receive an "Out of Memory" error, reduce the context length or switch to a smaller model variant. On Windows, ensure that hardware acceleration is enabled in your browser if you are using the web UI, as this affects how VRAM is shared between the browser and Ollama.

Frequently Asked Questions

Can I run Ollama on a laptop without a dedicated GPU?

Yes, but it will rely entirely on your CPU and system RAM. Performance will be slower compared to GPU acceleration, but it is fully functional for smaller models like Qwen2.5 or Phi-3.

How much RAM do I need for a 7B parameter model?

For a standard 7B model, you generally need at least 8GB of RAM for the model weights plus additional memory for the operating system and other tasks. 16GB is the comfortable minimum for smooth operation.

Does Ollama use my CPU if I have an NVIDIA GPU?

Yes, but primarily for inference calculations that don't fit in VRAM. Ollama prioritizes GPU usage. If VRAM is full, it moves layers to system RAM and uses the CPU to process those specific layers.

How do I delete a model I no longer need?

Open your terminal and run ollama rm <model-name>. This frees up disk space and prevents the model from being accidentally loaded during startup.

Is it safe to run local LLMs?

Yes, running models locally keeps your data private as it never leaves your machine. However, always download models from trusted sources like the Ollama library to avoid malicious code injection.