
Fine-tuning a small language model for RAG in a browser on a Mac
Fine-tuning Qwen3-0.6B on a Mac so it stops making things up when it summarizes my blog in your browser. What worked, what didn't, and how to do it for your own site.

Fine-tuning Qwen3-0.6B on a Mac so it stops making things up when it summarizes my blog in your browser. What worked, what didn't, and how to do it for your own site.

My blog does semantic search in your browser. Now it also runs a (small) language model in your browser.
Seven years ago I used Google's text-to-speech API to create audio versions of my posts. Now I can run an 82-million-parameter open weight model locally on my laptop, for free.

This blog now has semantic search that runs entirely in your browser. No server, no API keys, no 23 MB transformer. The whole model is a 4 MB lookup table, and extends the existing keyword search with semantic capabilities.

The all-you-can-eat AI coding era is over. So what do you do on the 22nd of the month, when the token budget's gone and there's over a week of work left? Here's a local coding agent (Pi plus Qwen3-Coder on a MacBook) that's decent enough for the routine stuff and runs for free (if you have enough RAM).

Everyone's building AI agents that send emails and book flights. How about one that fights monsters in a dungeon? Here's how you can too.

Our keyword search engine can't find 'alcoholic beverage disaster in England' even though the London Beer Flood is right there. In this post, we add semantic search using sentence-transformers embeddings and cosine similarity to find documents by meaning, not just matching words.
A few years ago I wrote a full-text search engine in 150 lines of Python. The Wikipedia data source it relied on has since been discontinued, and the tooling around it was showing its age. I wanted to (finally) write a follow-up about semantic search, but I realized that I had to get the old repository in a working state first. It's now using Hugging Face (🤗) datasets, uv, ruff, pytest, and GitHub Actions, without touching the core search logic.
I haven't really touched my blog since 2019. The theme was ancient, jQuery was everywhere, and I kept putting off the inevitable migration. Then I decided to let an LLM do it. Here's what happened when Claude Code spent an evening trying to modernize my setup.

Full-text search is everywhere. From finding a book on Scribd, a movie on Netflix, toilet paper on Amazon, or anything else on the web through Google (like [how to do your job as a software engineer](https://localghost.dev/2019/09/everything-i-googled-in-a-week-as-a-professional-software-engineer/)), you've searched vast amounts of unstructured data multiple times today. What's even more amazing, is that you've even though you searched millions (or [billions](https://www.worldwidewebsize.com/)) of records, you got a response in milliseconds. In this post, we are going to build a basic full-text search engine that can search across millions of documents and rank them according to their relevance to the query in milliseconds, in less than 150 lines of code!