# This 100% private AI model is insane… let's fine-tune it <!-- ref: @content/youtube/david-ondrej/2026-05-28-local-fine-tuning-and-dataset-creation version: 3 updated_at: 2026-10-31T19:02:15.691Z --> David Ondrej (2026-05-28): Fine-tuning historically had two blockers: building a dataset was slow and manual, and the training loop was painful to run locally. *Synthesized from David Ondrej on David Ondrej, 2026-05-28.* David Ondrej walks end-to-end through fine-tuning an open-weight model on a laptop — and, more usefully, through generating the training dataset that makes the fine-tune worth doing. ## Core Thesis Fine-tuning historically had two blockers: building a dataset was slow and manual, and the training loop was painful to run locally. Ondrej argues both are now solved by Unsloth Studio, a free open-source tool that handles model download, training, and — through its "recipes" feature — dataset synthesis from your own documents. His larger claim is about defensibility: a public checkpoint is the same checkpoint everyone else has, so the durable advantage is a proprietary dataset and the model trained on it. ## Key Insights - **Install is a one-liner from the quickstart docs**; the studio then serves a local web UI at `localhost:8888`. The first-run password prompt is not an account — it exists only to stop others on the same Wi-Fi from reaching your local server. - Unsloth is not just a trainer. It doubles as a local chat client (an LM Studio / Ollama alternative), and it republishes fixed versions of models from Alibaba, Meta, Google, Mistral, and Microsoft — Ondrej stresses the team works directly with those labs to fix post-release bugs, so the Unsloth re-upload is a different artifact from the raw vendor upload. - **Their dynamic 2.0 quantization adjusts the quantization type per layer** with a custom scheme per model, rather than compressing a fixed subset of layers. The practical effect is running a stronger model on the same hardware. - **You cannot train a GGUF.** GGUF is a compressed single-file inference format — Ondrej's analogy is a zip of the model — shrunk for running, not learning. Fine-tuning requires the uncompressed **safetensors** variant. He is emphatic about picking the pure repo with no MLX or GGUF suffix. - Context on the format: GGUF is built around llama.cpp, both created by Georgi Gerganov to get models like Llama 3 70B onto consumer GPUs instead of rented H100s. Ondrej notes Gerganov's team joined Hugging Face in **February 2026**, consolidating the local-AI stack. - **Model sizing**: he trains **Qwen 3.6 27B** (dense), which he rates the strongest model in the 4B–40B class per artificialanalysis.ai's open-source leaderboard, and which needs roughly **24–32GB of RAM or VRAM** to run. The safetensors download is **51GB**. His machine has 128GB. For everyone else he recommends **Qwen 3.5 9B**, which he says runs on essentially any non-ancient computer. Unsloth publishes over **1,300 models**, from 9B up to 122B and 397B. - **The dataset choice matters more than the model choice.** Hugging Face carries over **1 million datasets** against ~2.9 million models. His demo uses `finance-alpaca` — roughly **69,000 rows** in instruction/output format, about **40MB** on disk. - **Four dataset shapes teach four different skills**: single-turn instruction Q&A (the default, most common, and what he recommends when unsure), multi-turn conversational, domain-expert on proprietary data, and reasoning/tool-use with chain-of-thought and function calls. - **Volume floors**: at least 1,000 examples ideally, with roughly 200–300 as the absolute minimum. His 68,000-row set is far past sufficient. - **Training loss is the only signal that matters mid-run.** It measures how well the model predicts the next token on your data; if it isn't falling, nothing is being learned. He watches it live in the UI and cross-checks against the launching terminal's logs. - **His demo run is deliberately tiny** — context length reduced to **1,024**, batch size **1**, only **20 steps** — and he says so plainly: a real fine-tune needs more steps, a larger context window, multiple epochs, and hours rather than minutes. - **A live Apple Silicon caveat**: an MLX bug can fail training on M-series chips even with tens of GB of VRAM free — he had 80GB+ available when it failed. It's a metal-allocation issue, not a memory or Unsloth issue. The workaround is dropping to a 9B model or renting A100/H100 time. - **The recipes tab generates datasets from your own files.** Presets include text-to-Python, text-to-SQL, PDF document QA, OCR document extraction, and a GitHub crawler that turns issues and PRs into instruction/answer pairs. The PDF QA graph has four nodes: provider, provider column, LLM structured output, and document file. - **The generation step deliberately uses a bigger model than the one being trained.** This is distillation — a large model writes the answers, the small model learns to imitate them. Ondrej names it as an open secret of the industry and flags the terms-of-service question explicitly rather than glossing it, while also noting the symmetry with how frontier labs assembled their own training corpora. - **Provider config detail that breaks silently**: the OpenRouter base URL must end in `/v1`. He funds it with **$5–10** in credits and caps the key at **$50**. - **Model selection for generation is a cost decision, because you make one API call per row.** He starts with Sonnet 4.6, hits live Anthropic elevated-error incidents, switches to Gemini 3.5 Flash, and then revises his recommendation to **DeepSeek V4 Pro** as the best intelligence-per-dollar default — with V4 Flash as the cheaper, weaker fallback. - **The chunking mechanic**: an 80-page PDF is split into chunks, and each chunk yields question/answer pairs — so an NVIDIA annual report becomes a **10,000-row** dataset. Run a 5-record test run first to inspect the generated pairs before committing to the full run. - Once generated, the dataset appears under "local" in the train tab, and can be pointed at any model size. ## Actionable Takeaways 1. Install Unsloth Studio via the quickstart one-liner, open `localhost:8888`, and set a local password on first launch. 2. Pick your base model from artificialanalysis.ai's open-source section by size class, then find the Unsloth re-upload on Hugging Face — copy-paste the exact repo string rather than typing it, and take the **safetensors** variant, never GGUF or MLX. 3. Start with Qwen 3.5 9B unless you have 32GB+ of VRAM; 27B pulls a 51GB download and can trip the MLX bug on Apple Silicon. 4. Keep the CUDA method setting for local hardware, and for a first pass reduce context length to 1,024, batch size to 1, and steps to ~20 just to confirm the pipeline runs. 5. Watch training loss from step one. A flat loss means stop and fix the configuration; a falling loss means the run is real. 6. For your own dataset: recipes → new recipe → start from a learning recipe → PDF document QA. Configure the provider with `https://openrouter.ai/api/v1` (the `/v1` is required) plus a spend-capped key, set the generation model to DeepSeek V4 Pro, attach one PDF, and save each node individually. 7. Always do a 5-record test run and read the generated Q&A pairs before launching a 1,000+ record run — the pairs are what the model actually learns. 8. Source the PDF from something only you have: an SOP, a sales-call export, an ad-performance log, client conversations, or call transcripts. Public data produces a public-grade model. ## Notable Quotes > "Having your own data sets, having your own fine-tuned models, that is still a huge moat that most people don't know how to do." — David Ondrej > "It's shrunk down for running, for inference, not for the training." — David Ondrej, on GGUF > "You give it great examples and the model will learn those examples and become really really good at that specific domain." — David Ondrej > "This is literally how well the model has learned the data set." — David Ondrej, on training loss --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*