EDGE FDE
AdvancedLLM Writing-Style LoRA to Core AI
A practical skill for running a personalized model on a phone, not in the cloud. Clean your private writing. Train a LoRA on a Mac. Bake it into a small instruct LLM. Export a portable .aimodel plus tokenizer. Then chat on the device. The writing style is stored in the model file on the phone.
This course is for you if you can run Python on a Mac and ship a small Xcode 27 chat screen. Pair it with Diffusion LoRA to Core AI on device. The same method, for text instead of images.
The real path
Core AI has no documented hot-swap LoRA. Do not build a runtime that attaches a new writing adapter on the device. Train the LoRA on a Mac with MPS, or with CPU if MPS is missing. Merge it into the base. Export with coreai.llm.export, or with torch.export plus coreai-torch. Ship the on-device .aimodel and its tokenizer sidecar.
Lessons
Key concepts
- Clean private writing, train a LoRA on a Mac, merge it into a small instruct LLM, export
.aimodelplus tokenizer, chat offline. - Core AI has no documented hot-swap LoRA.
- Train on MPS or CPU only. Never CUDA.
- Course examples are
qwen3-0.6bandsmollm2instruct presets.
Takeaways
- You can bake your writing style into a model file that stays on the phone.
- You export with
coreai.llm.exportortorch.exportpluscoreai-torch. - The tokenizer sidecar ships with the model. Token ids are part of the contract.
Agent briefs
FAQ
Does the phone run a live writing-style adapter?
No. The device runs a baked copy of a small instruct model. There is no documented runtime adapter you swap in later.
What should the writing LoRA learn?
Style is rhythm, directness, word choice, and answer shape. It is not facts. Strip secrets, tokens, and third-party private detail before training.
How do I pick the base LLM?
Choose a catalog instruct preset that has a Core AI export recipe. Confirm with coreai.llm.export --list-models and --dry-run. macOS and iOS presets differ in compression and context.
How is the writing model exported?
Merge with merge_and_unload() into a new directory and keep the adapter. Export with coreai.llm.export and --platform iOS or macOS, or with torch.export plus coreai-torch. Bundle the .aimodel with the tokenizer sidecar.
What do I evaluate for writing style?
Judge the baked model, not the adapter. Read Mac merged replies and device chat for the same review prompts. Buckets are voice drift, secret leakage, refusal, and formatting.