Troy
Fine-tune LLMs on your MacBook with one YAML file.
Troy is a command-line tool for fine-tuning and preference-tuning language models locally on Apple Silicon. No CUDA, no cloud, no training pipeline — write a config, run one command, and train on the machine you already own.
Built on MLX and mlx-lm, Apple's ML framework for Apple Silicon. Unified memory means a 36 GB MacBook fine-tunes models that need a workstation GPU anywhere else.
Requirements
- Apple Silicon Mac (M1 or later)
- macOS 14+
- Python 3.10–3.12
Install
brew install avirajkhare00/troy/troy
# or: pipx install troy-cli
Quickstart
troy doctor # check your Mac: chip, memory, MLX, what you can train
troy init # create troy.yaml + sample data
troy train # fine-tune (LoRA/QLoRA via MLX)
troy chat # talk to the result
troy eval # did it work? base-vs-tuned loss + samples
troy serve # OpenAI-compatible API at localhost:8080/v1
troy export -f gguf # ship it to llama.cpp / Ollama / LM Studio
troy push you/model # upload to the Hugging Face Hub
The config is the interface
base: mlx-community/Qwen3-0.6B-4bit
task: sft # or: dpo, orpo
data:
train: ./data/train.jsonl # alpaca, sharegpt, chat, completions, text — auto-detected
val_split: 0.1
training:
epochs: 3
lr: 1e-5
batch_size: auto # sized from your Mac's unified memory
lora:
r: 8
alpha: 16
output: ./output
Commands
| Command | Purpose |
|---|---|
troy init |
Create a config from a template (chat, dpo, orpo) |
troy doctor |
Hardware + dependency check, with model-size guidance |
troy train |
LoRA fine-tuning: SFT, DPO, or ORPO — text, or vision with [vision] extra |
troy chat |
Interactive REPL (or -p for one-shot) with your adapter |
troy eval |
Base-vs-tuned val loss, perplexity, side-by-side samples |
troy serve |
OpenAI-compatible API server for your model |
troy export |
Fuse the adapter; export MLX or GGUF |
troy push |
Upload adapter or fused model to the Hugging Face Hub |
troy data inspect |
Dataset stats and format detection |
What Troy can train on your Mac
| Unified memory | Max model (4-bit QLoRA) |
|---|---|
| 8 GB | ~1.5B |
| 16 GB | ~4B |
| 24 GB | ~8B |
| 36 GB | ~14B |
| 64 GB | ~32B |
| 128 GB | ~70B |
DPO without a second model
DPO normally keeps a frozen reference copy of the model in memory. Troy zeroes the LoRA scales to recover the reference model from the policy model itself — no second copy, which matters on unified memory.
Data formats
Auto-detected from the first record: Alpaca (instruction/output),
ShareGPT (conversations), chat (messages), prompt/completion,
plain text, and preference pairs (prompt/chosen/rejected) for DPO.
Files: .jsonl, .json, .csv.
License
Apache-2.0
Metadata
Release files for troy-cli 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| troy_cli-0.4.0.tar.gz | 23.6 kB | With provenance | Details for troy_cli-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| troy_cli-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for troy_cli-0.4.0-py3-none-any.whl |
Total release size: 52.7 kB
Release files / troy_cli-0.4.0.tar.gz
| Download URL | troy_cli-0.4.0.tar.gz |
|---|---|
| Size | 23.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b089187ce937b2b214cc099ea4a2916ad679ef88cb844aefc8e29e72891e453
|
|
BLAKE2b-256 checksum How to use checksums |
53270ec32fb7ddc9c867236dcdce9c8bce3d0635b336029237d913c51e91abb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logRelease files / troy_cli-0.4.0-py3-none-any.whl
| Download URL | troy_cli-0.4.0-py3-none-any.whl |
|---|---|
| Size | 29.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1faa184c6a500b1bf3b2343431b871f57a249c44099e741f827eccb2c650f4ba
|
|
BLAKE2b-256 checksum How to use checksums |
d2306da0e6a1dca52efae5b47de290ee6ec2c1d07a522ecb9664a7e34f1f1379
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logSecurity for troy-cli 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for troy_cli-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.