Ramesh Inampudi

AI and agents

Fine-Tuning a 2B Offline Chat Model on One Mac

By Ramesh Inampudi · 2026-11-22 · 4 min read

Most chat assistants send every word you type to a server. For everyday questions, drafts and planning, that is a lot of trust to hand over. I wanted a model small enough to run on a laptop or phone, with no network needed at inference time. IRx-1 is my attempt: a ~2B parameter chat model, fine-tuned and quantized to 4-bit, built end to end on a single Apple Silicon Mac.

Why I built it

I had three goals: speed, privacy, and a model that felt like mine rather than generic boilerplate. I also wanted to prove to myself that a useful model does not need cloud GPUs or a massive pretraining run. Starting from an open-weight ~2B base model and fine-tuning it with LoRA/QLoRA made that realistic on one machine.

There was a fourth goal as well. I wanted the model to act as the natural-language front end for a developer tool of mine, xGAIR.

What it does

It is published in two forms on Hugging Face: an MLX model and a GGUF build for other local runtimes.

It is not a frontier model. It will not match large hosted models on hard multi-step reasoning, deep coding problems or breadth of world knowledge, and its knowledge is fixed at training time. That gap comes from parameter count and pretraining scale, and fine-tuning does not erase it.

How it works

The training data is a deliberate mix of four sources, each combined into one train/validation split by combine_data.py:

  1. Personal conversation history. prepare_data.py parses a claude.ai conversation export into instruction/response pairs, each capped at a 6-message context window. The export itself is gitignored and never committed.
  2. Style distillation. A separate local model answers about 50 diverse everyday prompts with reasoning narration suppressed, giving a clean formatting and quality baseline.
  3. General breadth. A balanced 400-example sample across 8 task categories from databricks-dolly-15k, which is human-written and CC-BY-SA-3.0.
  4. Tool use. 69 hand-authored examples that teach the model to turn free-form language into structured tool calls, grounded in xGAIR's actual tool schemas rather than freely generated.

Training runs as QLoRA through MLX on the same Mac (finetune.sh). merge_and_quantize.sh then fuses the LoRA adapters into the base model. That produces the MLX release. For GGUF, a small script, fix_gguf_mlx_conversion.py, prepares the fused model before convert_hf_to_gguf.py does the conversion.

Quick start with MLX:

pip install mlx-lm

Then load ikppramesh/irx-1 with mlx_lm, build the prompt with the tokenizer's chat template (passing enable_thinking=False), and call generate.

What I learned

Redact, then exclude

Training on personal chats means handling sensitive content. I scrub every message with regexes for credentials, API keys, tokens, connection strings and PII. But regex cannot safely catch everything, such as full names in non-Latin scripts or birth, health and identity details. So I exclude whole conversation topics instead of partially redacting them, and I verified the exclusion with a full-text scan of the entire export, not just conversation titles. If you fine-tune on your own data, I would make this a hard rule: partial redaction leaves traces.

Fine-tuning does not reliably inject facts

An earlier version included roughly 10 general-knowledge Q&A examples about xGAIR. Testing showed they were not enough signal to override the base model's existing prior on the term. It hallucinated, confusing "xGAIR" with an unrelated real acronym. I dropped them. Light fine-tuning is good for style and skills, such as parsing intent into tool calls, but it is an unreliable way to add facts. For facts, I would reach for retrieval instead.

Do not enable native tool calling in chat apps

The base architecture supports a native <tool_call> format, but my fine-tuning never trained or reinforced it. In my testing, the same query was answered cleanly with no tools registered, yet misfired a call to an irrelevant dummy tool when one was present. If a chat app such as LM Studio shows a "failed to parse tool call" error, turn off tool or function calling for this model.

Prompting and sampling matter at this size

Conclusion

IRx-1 shows that a private, offline, personalized model is within reach of one person with one Mac. The reusable lessons are about data more than compute: mix sources for different purposes, exclude sensitive topics rather than half-redacting them, use fine-tuning for style and skills instead of facts, and test your model inside the apps that will actually host it. Questions or feedback are welcome at hello@iramesh.com.