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

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.2.1
File Size Uploaded Provenance Actions
troy_cli-0.2.1.tar.gz 16.5 kB With provenance Details for troy_cli-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 38.6 kB

Release files / troy_cli-0.2.1.tar.gz

Download URL troy_cli-0.2.1.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
813e8c654ad7eed6a6a43ef9f6d3712d69659f0f5d0f5b245d4baa5c360077e6
BLAKE2b-256 checksum
How to use checksums
744e623716665dcf59063671c2b77439b5b65cb2d2905a3292bbacd60d4ccef1
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.2.1-py3-none-any.whl

Download URL troy_cli-0.2.1-py3-none-any.whl
Size 22.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f892ee5eb2a611971b5e9686b995459ea398eb3342bbd0fb54d90eac03106386
BLAKE2b-256 checksum
How to use checksums
4e45df04bd72fad4ecf6b724aa4d569012ed6f4ca6385134396a0f3fa2eb1a76
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.2.1

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