liveBook · Manning

Unsloth

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

A software library that accelerates and streamlines fine-tuning of language models while aiming to reduce memory use.

Unsloth is a Python library for fine-tuning a base language model on your own examples. Its optimized workflow aims to reduce training time and GPU memory use, though gains depend on the model, hardware, and settings. It handles training and export; Ollama handles local serving. section 16.6.4

To turn domain-specific examples into a local custom model:

  • Choose a supported base model and prepare examples, such as conversations, documents, or input/output pairs. Check support for its architecture, training method, and GGUF export. section 16.6.4 section 17.7.1
  • Run an Unsloth notebook cell by cell to fine-tune the model. Google Colab can provide a hosted GPU, but free access and completion time are not guaranteed. section 16.6.4
  • Export the trained result as a quantized GGUF file. Copy it and a Modelfile to your local machine, make the Modelfile’s FROM path match the file, and preserve the training chat template. section 16.6.4
  • Use ollama create to register the model, then ollama run to try it locally. section 16.6.4 section 17.7.1
model.save_pretrained_gguf("my_model", tokenizer, quantization_method="q4_k_m")

This notebook call exports the fine-tuned model to GGUF using q4_k_m quantization; the exported file is the handoff to Ollama. section 16.6.4

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

How deep it goes
Outlines data preparation, notebook training, GGUF export, and Ollama deployment, without detailing Unsloth’s optimization internals.
Examples
Uses conversations, documents, and input/output pairs as training examples, plus GGUF export and Ollama commands.
What it assumes
Starts with a selected base model and your own training examples; explains notebook execution and the tools’ separate roles.
What you can do after
Apply it via Unsloth and Ollama to fine-tune, export, register, and run a custom model locally.
How it connects
Connects fine-tuning to Google Colab, GGUF quantization, Modelfiles, and Ollama.

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.