Run Llama Locally on Windows Without Internet
In this article
To run Llama locally on Windows without internet, you need to download the model files and a compatible runner (like Ollama or llama.cpp) while online, then use them fully offline. The simplest method is using Ollama: install it, pull the model, and it works offline afterward. This guide covers that and the llama.cpp alternative.
What You'll Need
- A Windows PC (64-bit, Windows 10 or 11 recommended)
- At least 8 GB of RAM (16 GB or more for larger models)
- Free disk space: 5–10 GB for a 7B model, more for larger ones
- An internet connection only during the initial download phase
- Admin rights to install software (for Ollama installer)
Step-by-Step
Method 1: Using Ollama (Easiest)
- Install Ollama while online. Go to
ollama.comand download the Windows installer. Run it and follow the setup wizard. Ollama installs as a background service. - Open a command prompt or PowerShell. Press
Win + R, typecmd, and press Enter. - Pull a model while online. Type
ollama pull llama3.2(or any model name likellama3.1,mistral). This downloads the model to your local disk. Wait for the download to finish. - Test the model. Type
ollama run llama3.2and ask a question. If it responds, the model works. - Disconnect from the internet. Turn off Wi-Fi or unplug Ethernet. Open a new command prompt and run
ollama run llama3.2again. It should work exactly the same. - Use it offline anytime. Ollama automatically uses the local model files. No internet is required for inference.
Method 2: Using llama.cpp (More Control)
- Download llama.cpp. Go to the official GitHub releases page for llama.cpp and download the latest Windows build (e.g.,
llama-bXXXX-bin-win-avx2-x64.zip). Extract it to a folder likeC:\llama. - Download a GGUF model. Visit Hugging Face and search for a model in GGUF format (e.g.,
TheBloke/Llama-2-7B-GGUF). Download the.gguffile (usually the Q4_K_M version for balance). Save it in the same folder as llama.cpp. - Open a command prompt in that folder. Navigate to the folder where you extracted llama.cpp, then type
cmdin the address bar and press Enter. - Run the model. Type
main.exe -m model.gguf -p "Hello" -n 50(replacemodel.ggufwith your file name). This generates a short response. For an interactive chat, usemain.exe -m model.gguf --interactive. - Disconnect from the internet. The model runs entirely from local files, so it works offline without any changes.
Common Mistakes
- Choosing a model too large for your RAM. A 70B model requires ~40 GB RAM. Stick to 7B or 13B for typical 16 GB systems.
- Forgetting to pull the model before going offline. Ollama won't have the model files if you didn't pull it first.
- Using the wrong file format. llama.cpp needs GGUF files, not PyTorch or safetensors.
- Not closing the Ollama service before using llama.cpp. Both can conflict over GPU resources. Close Ollama from the system tray first.
- Assuming all models work with llama.cpp. Some models require specific build flags. Stick to well-known GGUF conversions.
Tips
- Use
ollama listto see all downloaded models and their sizes. - For llama.cpp, use the
--threadsflag to set CPU threads (e.g.,--threads 8). - If you have an NVIDIA GPU, download the CUDA version of llama.cpp for faster inference.
- Keep your models in a separate folder so you can back them up easily.
- Use quantization (Q4_K_M, Q5_K_M) to reduce memory usage with minimal quality loss.
Troubleshooting
If Ollama doesn't start after installation: Check the system tray for the Ollama icon. If missing, restart the service by running net start ollama in an admin command prompt.
If the model doesn't load: Run ollama pull modelname again while online to verify the download. Check disk space.
If llama.cpp gives a 'not found' error: Make sure you're in the correct folder and the model file name is exact. Use dir to list files.
If inference is very slow: Close other programs, reduce the model size, or lower the context length with --ctx-size 512.
If you get a GPU error: Run llama.cpp without GPU by using the CPU-only build, or update your GPU drivers.
If Ollama still tries to access the internet: It won't after the model is pulled, but check your firewall logs. If it's blocked, it will still work because inference is local.
Frequently Asked Questions
Do I need an internet connection every time?
No. After the initial download, all inference runs locally. You can disconnect completely.
Can I use the same model on Ollama and llama.cpp?
Ollama uses its own format, but you can export models. It's easier to download separate files for each.
How much disk space do I need?
A 7B model in Q4 quantization is about 4 GB. A 13B model is about 8 GB. Plan for double that if you want multiple models.
Will this work on Windows 11?
Yes, both Ollama and llama.cpp support Windows 10 and 11.
Can I run Llama on a laptop with 8 GB RAM?
Yes, but use a 3B or 7B model with low quantization (Q4). Close other apps to free memory.
Is there a GUI interface?
Ollama has a command-line interface. For a chat UI, you can install a frontend like Open WebUI while online, but it requires Docker, which adds complexity. The command line is simplest.