In this categoryLocal AI · 24
- How to Install Ollama on macOSStart
- How to Install Ollama on Windows
- How to Run Llama 3 Locally with Ollama
- How to Pick the Right Local AI Model for Your Hardware
- Best GGUF Models to Run by VRAM Tier (8GB, 12GB, 16GB, 24GB, 48GB)
- Run LLMs in Your Browser With WebGPU: No Install, No Server (WebLLM)
- How to Use Ollama as a Drop-In OpenAI API
- GGUF vs MLX vs NVFP4: Local AI Quantization Formats Explained
How to Run Your Fine-Tuned Model in Ollama
Take the GGUF file from your fine-tune, write a Modelfile, register it with Ollama, run it locally, and optionally push it to the Ollama registry.
After fine-tuning you have a .gguf file. Ollama is the fastest way to run it — it handles the inference server, the chat API, and model management with one simple CLI. This guide takes you from a GGUF file on disk to a model you can chat with and, if you want, share with others via the Ollama registry.
- Ollama installed on your machine (ollama.com — available for Mac, Linux, and Windows)
- Your fine-tuned GGUF file (from the Unsloth export step)
- The system prompt you used during training, to keep inference consistent with training
Step 1: Install Ollama and verify it works
Step 2: Write a Modelfile
A Modelfile is a short text file that tells Ollama where the GGUF is, what system prompt to use, and how to format prompts. It is similar in concept to a Dockerfile. The FROM line points to your GGUF file using an absolute or relative path. The SYSTEM block injects the same system prompt you used during training, which is important — training with a system prompt and running without it produces worse results.
FROM ./my-llama3-finetuned/model-q4_k_m.gguf
# System prompt — must match what you used during training
SYSTEM """
You are a SQL expert. Write correct, well-formatted SQL for the user's request.
Use PostgreSQL syntax. Return only the SQL, no explanation unless asked.
"""
# Optional: tune sampling parameters
PARAMETER temperature 0.1
PARAMETER top_p 0.9
PARAMETER num_ctx 4096Step 3: Create the model in Ollama
Run ollama create with a name for your model and the path to the Modelfile. Ollama reads the GGUF, registers the model, and sets up the inference configuration. This usually takes under a minute.
Step 4: Run and test your model
Use ollama run for interactive chat or pass a prompt directly as an argument for a one-shot test. The model responds using your fine-tuned weights and the system prompt from the Modelfile.
Step 5: Use the REST API
Ollama exposes a local HTTP API on port 11434 that is compatible with the OpenAI API format. You can call your fine-tuned model from any application that supports OpenAI-compatible endpoints, including LangChain, LlamaIndex, and Open WebUI.
curl http://localhost:11434/api/chat -d '{
"model": "my-sql-llama",
"messages": [
{ "role": "user", "content": "List all products where price is above 100." }
],
"stream": false
}'Step 6: Share the model via ollama push
If you want to share the model with teammates or publish it publicly, push it to the Ollama registry. You need a free account at ollama.com first. The model name must be prefixed with your username.
Result
Your fine-tuned GGUF is now a named Ollama model you can run with a single command, query over a local REST API, or share via the registry. The entire stack from training to inference runs on your hardware with no cloud dependency and no per-token cost.
Local models run better with more VRAM. CompareRTX GPUs on Amazonbefore you upgrade.(affiliate link. We may earn a commission at no extra cost. Disclosure)
Watch related tutorials
9:42
10:30
11:05
9:50
13:30
16:45Weekly local AI drops
New models, what runs on your hardware, and the guides to set them up. One email a week, unsubscribe any time.