Why this checklist is what you deliver
You deliver a baked language model, the tokenizer it was exported with, the notes that can rebuild both, and a device measurement. A notebook is not that package. A runtime adapter is not that package.
The sibling course, Diffusion LoRA to Core AI on device, is the same method for images. Complete both if you want both methods.
The steps, one box at a time
WritingPrivate and prepared
WritingPrivate and prepared
LoRACheckpoint reviewed
WritingPrivate and prepared
LoRACheckpoint reviewed
Core AIMerge and export
WritingPrivate and prepared
LoRACheckpoint reviewed
Core AIMerge and export
ChatModel and tokenizer load
Environment setup
curl -LsSf https://astral.sh/uv/install.sh | sh
mkdir -p writing-style-lora && cd writing-style-lora
uv init --python 3.11
uv venv
uv add torch torchvision transformers peft datasets accelerate safetensors coreai-torch
uv run python -c "import torch; print(torch.__version__); print('MPS:', torch.backends.mps.is_available())"
uv run coreai.llm.export --help
xcodebuild -version
Data and model
- Keep your writing local, licensed, cleaned, and free of secrets.
- Record example format, deduplication, train and validation split, and human review prompts.
- Record exact base, tokenizer, context limit, and target platform.
- State that Core AI has no documented hot-swap LoRA.
Training evidence
- Run on MPS when supported, otherwise CPU. Do not rely on CUDA.
- Save PEFT checkpoints, hyperparameters, package lock, device metadata, and evaluation outputs.
- Compare base and adapter samples for voice, whether it follows the request, meaning, and memorization.
Merge, export, and device
- Merge or fuse the adapter into the base before export. Keep the adapter.
- Use documented
coreai.llm.export, ortorch.exportpluscoreai-torch. - Bundle and checksum the
.aimodelwith the tokenizer sidecar. - Use current Core AI language APIs. Label illustrative integration. Test the macOS or iOS preset you exported.
- Complete lesson 07: Mac and device JSONL, open codes, axial buckets, code secret scan, and a binary voice judge with a confusion matrix.
Failure modes
- Calling the adapter the product. The product is the baked model plus tokenizer plus the notes that rebuild them.
- Missing secret scan or missing device latency. Either gap makes the claim untested.
- Describing a runtime LoRA swap. That is not a documented Core AI path.
- Losing the adapter or the tokenizer. You cannot rebuild or load correctly.
Done when
- Your writing, adapter, merged model, export, tokenizer, device measurement, and lesson 07 eval artifacts all exist.
- The device run used the baked resource only.
- A new engineer can rebuild from the notes without guessing flags.
- You can point to the sibling diffusion course as the same method for images.
Keep learning
PyTorch to Core AI in Xcode · From the metal to the model · Core AI models, typed · Model architectures in plain English · Diffusion LoRA to Core AI on device
Key concepts
- The package is baked model, tokenizer, rebuild notes, device measurement, and lesson 07 eval.
- Data must be local, licensed, cleaned, and secret-scanned.
- Ship merge, export, checksums, Xcode 27 prepare-once, and the platform preset you tested.
- Keep the adapter and tokenizer for rebuild.
Takeaways
- The adapter alone is not the product.
- Missing secret scan or device latency is an untested claim.
- A new engineer should rebuild without guessing export flags.