MLX training & LoRA fine-tuning for the
qubes-genieintent model — exports to GGUF.
Part of Qubes Genie. This repo is the training half, and it runs on your Mac, not in a qube:
[Mac · M3 Max] dataset → mlx-lm LoRA → fuse → convert to GGUF
│
▼
[qube · CPU] llama.cpp loads the .gguf ← qubes-genie
Training and inference are deliberately split: training eats Metal + unified memory,
inference eats pure CPU. Their only interface is the exported .gguf file. Keeping
MLX's heavy dependencies here means they never touch the inference qube.
An M3 Max with 128 GB unified memory uses that memory as VRAM — fine-tuning a 3B model is comfortable, and LoRA on a 7B is well within reach. No external GPU needed.
This repo also owns the thing everything else depends on: the intent schema and the training data. You can't collect data without first pinning down what an intent is — so the schema is the natural starting point of the whole system, and it lives here next to the data that must conform to it.
schema/intent.schema.json ← the contract: actions, valid templates, features
data/seed.jsonl ← natural-language → intent pairs (validated against it)
scripts/validate_dataset.py ← gate: every sample's intent must match the schema
The template enum (dev, media, im, tools, gpg, vault, mcp, vpn, gentoo-dev) is exactly
the set from qubes-salt-config/salt/templates/*
— the model can only ask for environments that actually exist. qubes-genie constrains its
decode to this schema (GBNF); qubes-mcp consumes intents that match it. Validate before
committing data:
python scripts/validate_dataset.py data/*.jsonl- Dataset — pairs of natural-language request → intent JSON (can start synthetic)
- Fine-tune —
mlx_lm.lora(LoRA) on the base 3B - Fuse —
mlx_lm.fusemerges the adapter into the weights - Convert — llama.cpp's converter → GGUF, then quantize to Q4
- Hand off — drop the
.ggufintoqubes-genie
MLX · mlx-lm · LoRA · llama.cpp conversion tools. Runs on macOS / Apple Silicon.
🚧 Skeleton. Training is an optimization, not a prerequisite — the system runs on a stock model + few-shot first; fine-tune here only when intent accuracy needs it.
MIT