How to import a GGUF file into Ollama with a Modelfile

Two commands run a GGUF file you already have. What Ollama showed after the import, and the second copy of the file it makes on disk.

0:00

If you already have a GGUF file on your Mac, you can run it in Ollama without downloading it again. Write a one line Modelfile that points at the file, then run ollama create. We did this with the 17.65 GB Gemma 4 31B QAT Q4_0 file from Google’s model card, and it loaded first time.

How do I import a GGUF file into Ollama with a Modelfile?

  1. Find the full path to the file, such as /Users/you/models/gemma-4-31B-it-QAT-Q4_0.gguf.
  2. In an empty folder, make a file called Modelfile containing one line: FROM /Users/you/models/gemma-4-31B-it-QAT-Q4_0.gguf
  3. Run ollama create gemma4-31b-qat-q4 -f Modelfile. The name is yours to choose.
  4. Run ollama run gemma4-31b-qat-q4 to chat with it, or send requests to the local server.

The server must be running first. If ollama create says it cannot connect, start it with ollama serve.

How do I check the import worked?

Run ollama show gemma4-31b-qat-q4. Ours reported:

Field What Ollama showed
Architecture gemma4
Parameters 30.7B
Context length 262144
Embedding length 5376
Quantization Q4_0
Capabilities completion, tools, thinking
Stop token <turn|>

The capabilities and the stop token were filled in for us from the file, so we wrote no template. The line to look at is Capabilities. It is what tells you the model can think, which matters for turning thinking off.

Does Ollama copy the model file?

Yes. After the import, Ollama’s own store at ~/.ollama/models/blobs held a 17,651,000,768 byte file, the same size as the original, and the folder measured 16 GiB. You now have two copies on disk, so check you have the space before importing a large model.

Why import a file instead of pulling a model?

To run exactly the same weights in two programs. We used one file in LM Studio and in Ollama, so any difference in speed or behaviour came from the software and not from the model.

What context length will an imported model use?

Not the 262,144 that ollama show lists. That is the most the model supports. On our 48 GB Mac, Ollama chose 32,768 on its own. The reasoning and the memory it used are in our test of Ollama’s default context.

What does Ollama show once the imported model is loaded?

After the first request, ollama ps listed our import with a size of 19 GB, a processor line of 100% GPU and a context of 32,768. It also showed when the model would unload: four minutes from then. Three things in that one line are worth reading. The size is larger than the 17.65 GB file, because a loaded model needs working memory on top of its weights. The processor line tells you the whole model fitted on the graphics side of the chip, which is what you want on a Mac. And the context is the window Ollama picked for you, not the most the model supports.

How long does an imported model take to load?

Our first request after the import waited 8.2 seconds for the 17.65 GB file to load. That happens once. When we later changed the context window, the next request waited 2.6 seconds while the model reloaded, and from then on the load step took about 0.24 seconds a request. If Ollama has unloaded the model, which it does after four minutes of quiet, the next request pays for the load again.

How do I send a request to the imported model from a script?

Post a JSON body to /api/chat on port 11434 of your own machine. This is the body we used for the timed runs, with the name we gave the import:

{"model": "gemma4-31b-qat-q4", "messages": [{"role": "user", "content": "Your prompt"}], "stream": false, "think": false, "options": {"temperature": 0, "num_predict": 600, "num_ctx": 65536}}

The reply carries the answer and the figures you need to time it: the number of tokens written, how long the writing took, the number of tokens in the prompt, how long the model spent reading it, how long the load took, and the reason it stopped. Speed is the tokens written divided by the writing time. A stop reason of “length” means the token limit cut the reply short.

Does an imported model think by default?

Ours did. On the very first run, with no settings changed, Gemma 4 31B wrote 600 tokens, of which 2,229 characters were thinking, and the answer was cut off at 72 words when it reached the limit. Ollama read the thinking capability from the file and switched it on without being asked. If you import a thinking model and your first replies come back short or empty, that is why. Setting "think": false in the request turns it off.

Which settings can I change for each request?

We changed four, all in the body shown above. think turns the model’s reasoning on or off. Inside options, num_ctx sets the context window, num_predict sets the most tokens the model may write, and temperature sets how much the wording varies, which we held at 0 so that runs could be compared. We did not put settings in the Modelfile itself. Ours had the one line that points at the file, and everything else was set at request time.

Is an imported file as fast in Ollama as in LM Studio?

Yes, to within about 2%: the same file wrote at 11.50 tokens a second in Ollama and 11.74 in LM Studio, each the middle of 15 runs, as set out in our Ollama vs LM Studio speed test.

What should I check before importing a large GGUF file?

  1. Disk space for a second copy. Ollama stored its own 17.65 GB copy of our file, so the model then took about 35 GB.
  2. Memory. Ollama listed 19 GB for the loaded model, and its process measured 22 GB after one run on our 48 GB Mac.
  3. That the server is running, or the create step cannot connect.
  4. The name you give it. It is what you will type in every command and every request, so keep it short and say what the build is.
  5. The context window after the first run. Read it from ollama ps and raise it per request if your work needs more.

What did the first run after the import look like?

It is worth timing the first request, because it tells you whether the import is healthy. Ours took 60 seconds in all. Of that, 8.2 seconds went on loading the model and 1.5 seconds on reading a 78 token prompt. The rest was writing, at 11.92 tokens a second, until the reply reached the 600 token limit. A writing speed in that range, with the processor line showing 100% GPU, means the model is running where it should. A speed several times lower would suggest part of it had fallen back to the slower side of the chip, usually because memory ran short.

Google has also released a small Gemma model for search rather than chat, which Ollama lists as well: Google DeepMind releases EmbeddingGemma 2.

How we tested

Ollama 0.32.6 on a Mac with an M4 Pro chip and 48 GB of memory, macOS 27.0.1, on 3 October 2026. The steps above are the ones we ran. We used the local server, not ollama run, for the timed tests. The method is on how we test.

Sources

  1. Google's Gemma 4 31B QAT model card
Cite this page

Hill. "How to import a GGUF file into Ollama with a Modelfile". Onticpost, published 4 October 2026, updated 24 October 2026. https://onticpost.com/import-gguf-ollama-modelfile-gemma-4/

Updated 24 October 2026. This address stays the same when the piece is updated.

Share this

Subscribe to our newsletter

Checked: what AI can do for your business, checked by humans. Free, every Friday. One email a week, leave any time.

Free, every Friday. We send a link to confirm first. Our privacy policy says what we keep.