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 serve             # OpenAI-compatible API at localhost:8080/v1
troy export -f gguf    # ship it to llama.cpp / Ollama / LM Studio

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)
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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

troy_cli-0.2.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

troy_cli-0.2.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file troy_cli-0.2.0.tar.gz.

File metadata

  • Download URL: troy_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for troy_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a2834198748f7e9ddd75f553e2ef761a4e9a80a8f755ab625fd36dac42bee75a
MD5 4623fdacf5bcaad071cc11db46ff2739
BLAKE2b-256 858d494d12d528cc042e54d682fa54539e6535456c26ca28fdaf37fac4bc0de1

See more details on using hashes here.

Provenance

The following attestation bundles were made for troy_cli-0.2.0.tar.gz:

Publisher: release.yml on avirajkhare00/troy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file troy_cli-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: troy_cli-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for troy_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0014f0bd2b781b3597e2130d784768ab5bd612aa96040c6ac5981f2a6cf636a6
MD5 a69fa03ab25fa2583e71a3a39c2e1e6b
BLAKE2b-256 0ad770da8768ea8b2b14454264a62f67d83b32a85609ed6b3dc81c4b97326422

See more details on using hashes here.

Provenance

The following attestation bundles were made for troy_cli-0.2.0-py3-none-any.whl:

Publisher: release.yml on avirajkhare00/troy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.2

2 files

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