Skip to main content

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.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for troy-cli 0.3.0
File Size Uploaded Provenance Actions
troy_cli-0.3.0.tar.gz 17.8 kB With provenance Details for troy_cli-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for troy-cli 0.3.0
File Interpreter ABI Platform Actions
troy_cli-0.3.0-py3-none-any.whl Python 3 none any Details for troy_cli-0.3.0-py3-none-any.whl

Total release size: 41.7 kB

Release files / troy_cli-0.3.0.tar.gz

Download URL troy_cli-0.3.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
329785a180f941612e043a9f8c84f6d514946ecab367929234a6267a0ede9b20
BLAKE2b-256 checksum
How to use checksums
333d4876996e5b853c65d227072bebd183a8af396f773ba1bee91c56aeee1939
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 12, 2026.

Transparency log

Release files / troy_cli-0.3.0-py3-none-any.whl

Download URL troy_cli-0.3.0-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d536da00af910619be845d6a6231d3605771a1db4462c0b71efa82f6f19e864
BLAKE2b-256 checksum
How to use checksums
2c8c6f5fdee7b138b0263b5ad83c3ecc030bce7e9e4d2249f6d2301ff36da889
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 12, 2026.

Transparency log

Security for troy-cli 0.3.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.

Select from 2 files

Attestation for troy_cli-0.3.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 12, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page