liveBook · Manning

Fine-tuning

As explained in Build Applications with Local AI Models on a Mac

Fine-tuning is the process of further training a pretrained model on selected examples to adapt its behavior or capabilities.

Fine-tuning means training a pretrained model further on your own examples. It can help a general-purpose model learn a specialized domain, a new language, or a more consistent way of responding. Think of it as sending the model back to school—not merely giving it instructions for one conversation. section 16.6 section 16.6.1

Table 16.2 Choosing among system prompts, RAG, and fine-tuning

Approach

When to use

Examples

System prompts

Changing the AI’s personality or format

“Be a detective” / “Answer in JSON”

RAG

Adding specific knowledge

Company docs, research papers

Fine-tuning

Changing the model’s fundamental behavior

Teaching new languages, specialized domains, consistent style

Check the simpler options first: use a system prompt to change personality or output format, and RAG to provide documents. Consider fine-tuning when the model’s underlying behavior needs to change. section 16.6.1

Teach a response pattern

A training example can pair “Summarize this customer support ticket in one sentence” with a one-sentence answer. Another can pair a request to explain “vector database” for a beginner with a plain-language answer. The pairs demonstrate both the requests to handle and the answers to produce. section 16.6.3

A practical route from examples to a locally running model is:

  • Prepare training examples, often as input/output pairs, and select a base model. Smaller models are generally easier and faster to fine-tune. section 16.6.3
  • Train with a framework such as Unsloth, often in a Python notebook with GPU access. Confirm that your model architecture, training method, and export path are supported. section 16.6.4
  • Export the trained result as a GGUF file. Put that file and a Modelfile together, make the Modelfile’s FROM path point to the actual GGUF, and preserve the chat template used during training. section 16.6.4
  • In that folder, run `ollama create my-custom-model -f Modelfile`, then `ollama run my-custom-model`. Test its responses and refine the examples or training as needed. section 16.6.4 section 16.6.3

Unsloth handles training and GGUF export; Ollama runs the resulting model locally. Unsloth can reduce training time and GPU memory use, but results depend on the model, hardware, and settings. Hosted GPU access and completion time are not guaranteed. section 16.6.4

How Build Applications with Local AI Models on a Mac covers it

How deep it goes
Outlines data preparation, training, export, local deployment, and iteration; leaves training implementation at a high level.
Examples
Uses customer-support summarization and beginner-friendly rewriting pairs, alongside legal, medical, and translation specialization scenarios.
What it assumes
Assumes a running chatbot and access to training examples; introduces fine-tuning and notebook-based training without detailing model-training internals.
What you can do after
Apply it via Unsloth and Ollama to train on personal examples, export a GGUF, and run a custom model locally.
How it connects
Contrasts fine-tuning with system prompts and RAG, then connects it to Unsloth, GGUF, Modelfiles, and Ollama.

Also explained in

Compare how 37 books explain fine-tuning →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Applications with Local AI Models on a Mac. The section links point to the parts of the book it draws on.