Skip to content

How-ToRAM

How to Run Multiple Models at Once in Ollama

How Ollama keeps several models loaded and handles parallel requests, with the defaults for OLLAMA_MAX_LOADED_MODELS, OLLAMA_NUM_PARALLEL and OLLAMA_MAX_QUEUE, how to change them, and how Ollama places models across multiple GPUs.

By , Systems & Technical Editor

3 min read

How to Run Multiple Models at Once in Ollama

If you use a chat model, a coding model and an embedding model side by side, you may want Ollama to keep more than one in memory rather than swapping them in and out. Ollama has three server settings that control this. This guide explains them using Ollama's FAQ.

The defaults

According to Ollama's FAQ:

  • OLLAMA_MAX_LOADED_MODELS is the maximum number of models that can be loaded at the same time, provided they fit in available memory. The default is 3 x the number of GPUs, or 3 for CPU inference.

  • OLLAMA_NUM_PARALLEL is the maximum number of parallel requests each model handles at once. Most backends default to 1; on Apple's MLX on Metal, an unset value lets Ollama choose a conservative default based on memory. More parallel requests need more memory.

  • OLLAMA_MAX_QUEUE is how many requests Ollama queues when busy before rejecting more. The default is 512.

There's one exception: Ollama says Windows PCs with Radeon GPUs currently default to a maximum of one loaded model because of VRAM reporting limits in ROCm. You can raise it, but Ollama warns not to load more models than fit in VRAM.

Step 1: See what's loaded now

Run ollama ps. It lists the models currently in memory and, in the Processor column, whether each is 100% on the GPU, 100% on the CPU, or split between them. If a second model pushes the first out, or shows a CPU/GPU split, you've hit your memory limit rather than the model-count limit.

Step 2: Change the settings

Set the variables on the Ollama server. On Windows, quit Ollama, search Settings for environment variables, choose Edit environment variables for your account, add for example OLLAMA_MAX_LOADED_MODELS = 2 and OLLAMA_NUM_PARALLEL = 2, then restart Ollama from the Start menu. On Linux, add Environment="OLLAMA_NUM_PARALLEL=2" lines under [Service] with systemctl edit ollama.service, then run systemctl daemon-reload and systemctl restart ollama. On a Mac, use launchctl setenv and restart the app.

Step 3: Keep the models resident

Ollama's FAQ says models are kept in memory for 5 minutes by default before being unloaded. To stop them dropping out between requests, see our guide to keeping Ollama models loaded.

How Ollama uses more than one GPU

Ollama's FAQ says that when loading a model it checks the VRAM the model needs against what's free. If the model fits entirely on one GPU, it loads there, which usually gives the best performance because less data crosses the PCI Express bus. If it doesn't fit on one GPU, it's spread across all available GPUs. To limit which cards Ollama can use, set CUDA_VISIBLE_DEVICES (NVIDIA) or ROCR_VISIBLE_DEVICES (AMD) on the server, as described in Ollama's GPU documentation.

How much memory you need

Every loaded model needs its own weights and context cache, and each parallel request adds more. If you're short, try smaller quantisations, a shorter context length or a quantised K/V cache (set with OLLAMA_KV_CACHE_TYPE). Our VRAM guide for local AI explains the trade-offs.

Our verdict

Ollama already allows several models at once by default if they fit in memory, so the real limit is usually VRAM. Raise OLLAMA_NUM_PARALLEL only if several apps or users hit the same model at once, and check with ollama ps that everything still sits on the GPU.

The bottom line

Ollama already allows several models at once by default if they fit in memory, so the real limit is usually VRAM. Raise `OLLAMA_NUM_PARALLEL` only if several apps or users hit the same model at once, and check with `ollama ps` that everything still sits on the GPU.

Sources

  1. 01Ollama, GPU documentation (GPU selection)
  2. 02Ollama, FAQ (concurrent models, parallel requests, multiple GPUs and server configuration)

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

How to Fix Slow Token Generation in llama.cpp

How-To

How to Fix Slow Token Generation in llama.cpp

How to fix slow llama.cpp text generation by confirming GPU offload with -ngl and setting -t to your physical core count or lower, with the llama.cpp developers' own example showing the effect of each setting.

Marcus Thorne2 min

How to Check a Driver Version in Windows 11

How-To

How to Check a Driver Version in Windows 11

How to check any device's driver version in Windows 11 through Device Manager's Driver tab, and how to see an NVIDIA graphics driver's version by typing nvidia-smi in Terminal.

Marcus Thorne2 min

How to Choose Which GPU Ollama Uses (or Force CPU)

How-To

How to Choose Which GPU Ollama Uses (or Force CPU)

How to make Ollama use a specific graphics card with CUDA_VISIBLE_DEVICES (NVIDIA), ROCR_VISIBLE_DEVICES (AMD ROCm) or GGML_VK_VISIBLE_DEVICES (Vulkan), how to force CPU-only with an invalid ID, and how to check the result with ollama ps.

Marcus Thorne2 min