Ollama’s ability to import Hugging Face GGUF models is a game-changer for running large language models locally, but it’s not as simple as just pointing Ollama at a directory.

Let’s see Ollama import a Llama 3 8B Instruct model from Hugging Face.

First, we need to find the model on Hugging Face. A quick search for "Llama 3 8B Instruct GGUF" will bring up several options. We’re looking for a repository that specifically hosts GGUF-quantized versions. A common and reliable source is "TheBloke," known for providing high-quality quantized models. Let’s pick TheBloke/Meta-Llama-3-8B-Instruct-GGUF.

Once on the repository page, navigate to the "Files and versions" tab. Here you’ll find various GGUF files, differing in quantization levels (e.g., Q4_K_M, Q5_K_M, Q8_0). Lower quantization means smaller file size and less VRAM usage, but potentially a slight decrease in accuracy. For a good balance, Q4_K_M is often a solid choice for 8B models.

The crucial step is not to download the entire repository. Ollama’s import command expects a direct path to the GGUF file itself. So, we’ll copy the direct download link for the Meta-Llama-3-8B-Instruct.Q4_K_M.gguf file. It will look something like https://huggingface.co/TheBloke/Meta-Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct.Q4_K_M.gguf.

Now, open your terminal and execute the Ollama import command. The syntax is ollama create <model_name> --file <path_to_gguf>.

ollama create llama3-8b-instruct-q4km --file https://huggingface.co/TheBloke/Meta-Llama-3-8B-Instruct-GGUF/resolve/main/Meta-Llama-3-8B-Instruct.Q4_K_M.gguf

This command tells Ollama to fetch the GGUF file from the provided URL and create a new model named llama3-8b-instruct-q4km using that file. Ollama will download the file and then ingest it, making it ready for use.

To verify, you can list your local Ollama models:

ollama list

You should see llama3-8b-instruct-q4km in the output. Now, you can run it:

ollama run llama3-8b-instruct-q4km

This process bypasses the need for Git LFS or cloning entire repositories, directly downloading and importing the specific GGUF file. This is significantly more efficient and avoids cluttering your local storage with unnecessary files.

The core problem Ollama solves here is abstracting away the complexities of model management. Instead of manually downloading, converting (if necessary), and configuring models, Ollama provides a unified command-line interface to pull and run them. It handles the underlying file formats, quantization, and even GPU acceleration setup.

The ollama create --file command is designed to ingest a single GGUF file. It reads the model’s metadata from within the GGUF itself and configures Ollama to use it. The name you provide (llama3-8b-instruct-q4km in our example) becomes the identifier you use with ollama run.

The real magic happens in how Ollama manages the model weights and inference. When you run ollama run, it loads the model into memory (CPU or GPU, depending on your system and the model’s requirements). It then processes your prompts, performing the forward pass through the neural network and generating a response. The GGUF format is specifically optimized for efficient loading and inference on commodity hardware, which is why it’s so popular for local LLM deployment.

A common misconception is that you must use ollama pull for Hugging Face models. While ollama pull works for models hosted directly on the Ollama library (like llama3), it doesn’t directly support arbitrary GGUF files from Hugging Face. The create --file command is the key for importing models not yet in the official Ollama registry or for specific quantized versions.

Understanding the ollama create command with a file path is your gateway to the vast ecosystem of GGUF models available on Hugging Face. It empowers you to experiment with different models and quantizations without the overhead of manual conversion or complex setup.

The next step after importing models is often exploring model parameters and system prompts to tailor the LLM’s behavior for specific tasks.

Want structured learning?

Take the full Ollama course →