Skip to main content

SlickML fine-tuning toolkit: composable strategies, objectives, and metrics for LLMs

Project description

slick-tune logo

SlickTune ๐Ÿงฉ: Composable LLM fine-tuning by SlickML

Fine-tuning is an orthogonal stack โ€” swap any axis without rewriting the others:

model  ร—  strategy  ร—  objective  ร—  data  ร—  metrics

๐Ÿง  Philosophy

slick-tune is a small, composable toolkit for teaching LLMs new facts and behaviors with Transformers + PEFT + TRL. LoRA / QLoRA are PEFT adapters; full FT updates every weight. The goal is the same SlickML spirit: prototype fast ๐ŸŽ, keep axes orthogonal, and measure whether the model actually learned your facts ๐Ÿ”Ž.

๐Ÿงฉ Abstractions

flowchart TB
  subgraph inputs [Inputs]
    modelId[model_id]
    dataJsonl[data JSONL]
  end

  subgraph axes [Composable axes]
    strategyNode["Strategy: LoRA / QLoRA / Full"]
    objectiveNode["Objective: SFT then DPO / GRPO"]
  end

  subgraph core [Tuner fit]
    tuner[Tuner]
    loadStep[load model and tokenizer]
    applyStep[strategy.apply]
    trainStep[TRL trainer]
    metricsStep[MetricsTracker]
  end

  subgraph outputs [Outputs]
    checkpoint[adapter or checkpoint]
    metricsFile[metrics.json]
    probeRate[probe pass rate]
  end

  modelId --> tuner
  dataJsonl --> tuner
  strategyNode --> tuner
  objectiveNode --> tuner
  tuner --> loadStep --> applyStep --> trainStep --> metricsStep
  trainStep --> checkpoint
  metricsStep --> metricsFile
  checkpoint --> probeRate
Axis Responsibility Phase 1
Strategy How weights change (PEFT vs full) LoRAStrategy, QLoRAStrategy, FullStrategy
Objective What is optimized / data contract SFTObjective (DPO stubbed)
Data Examples โ†’ chat messages load_sft_jsonl
Metrics Comparable run stats MetricsTracker
Probe Did the model learn your facts? slick-tune probe

๐Ÿ“Œ Quick Start

from slicktune import LoRAStrategy, SFTObjective, Tuner

Tuner(
    model_id="HuggingFaceTB/SmolLM2-135M-Instruct",
    strategy=LoRAStrategy(r=8),
    objective=SFTObjective(),
    output_dir="outputs/sft_lora",
).fit("examples/data/about_amir.jsonl")

๐Ÿ‘ค Personal โ€œabout meโ€ loop (recommended)

  1. Edit examples/data/about_amir.jsonl with facts about you (or keep the SlickML starter facts) โœ๏ธ.
  2. Edit examples/data/about_amir.probes.jsonl with questions and a must_contain substring that should appear after training ๐ŸŽฏ.
  3. Train a strategy on a tiny instruct model ๐Ÿงช.
  4. Probe the checkpoint โ€” pass rate shows whether fine-tuning stuck โœ….
before FT  โ†’  model guesses / hallucinates about you
after FT   โ†’  probe answers contain your facts

๐Ÿ›  Installation

Install Python >=3.10,<3.13 and uv, then simply run ๐Ÿƒโ€โ™€๏ธ:

uv sync

QLoRA (CUDA + bitsandbytes only) ๐Ÿ”ฅ:

uv sync --extra qlora

Task runner is Poe the Poet (same idea as slick-ml, with uv instead of Poetry). Install the CLI once ๐Ÿƒโ€โ™€๏ธ:

uv tool install poethepoet
poe greet

Developer workflow (format / check / test) lives in CONTRIBUTING.md ๐Ÿง‘โ€๐Ÿ’ป๐Ÿค.

๐Ÿš‚ Train each strategy

Default demo model: HuggingFaceTB/SmolLM2-135M-Instruct (small enough for laptop smoke tests) ๐Ÿ’ป.

๐ŸŸข LoRA + SFT (default โ€” works on Mac MPS / CPU / CUDA)

uv run slick-tune train \
  --strategy lora \
  --data examples/data/about_amir.jsonl \
  --output outputs/sft_lora \
  --epochs 20

uv run slick-tune probe \
  --model-dir outputs/sft_lora \
  --probes examples/data/about_amir.probes.jsonl

Or: poe train-lora / poe probe-lora / uv run python examples/run_sft_lora.py

๐Ÿ”ต QLoRA + SFT (CUDA required)

uv sync --extra qlora
uv run python examples/run_sft_qlora.py

On Apple Silicon, use LoRA instead โ€” bitsandbytes 4-bit needs CUDA ๐ŸŽ.

๐ŸŸ  Full fine-tuning + SFT

uv run python examples/run_sft_full.py

Heavier on memory; prefer LoRA for iteration ๐Ÿ’พ.

๐Ÿ“ฆ Data formats

SFT JSONL (any of these per line) ๐Ÿ“:

{"messages":[{"role":"user","content":"..."},{"role":"assistant","content":"..."}]}
{"prompt":"...","response":"..."}
{"instruction":"...","input":"...","output":"..."}

Probe JSONL ๐Ÿ•ต๏ธ:

{"prompt":"Who is Amirhessam Tahmassebi?","must_contain":"SlickML"}

๐Ÿ—บ Roadmap

Phase Scope
0โ€“1 (now) Skeleton, SFT + LoRA/QLoRA/full, metrics, personal probe loop
2 DoRA / AdaLoRA, richer eval
3 DPO / ORPO / KTO
4 GRPO / verifiable RL
5 Merge (TIES/DARE), multi-adapter
6 Optional PPO / multimodal

๐Ÿง‘โ€๐Ÿ’ป๐Ÿค Contributing to slick-tune

You can find the details of the development process in our Contributing guidelines. We strongly believe that reading and following these guidelines will help us make the contribution process easy and effective for everyone involved ๐Ÿš€๐ŸŒ™.

Conventions in short: @dataclass classes, numpydoc docstrings, full type hints via ruff (ANN) + mypy, assertpy in tests (see .cursor/rules/).

โ“ ๐Ÿ†˜ ๐Ÿ“ฒ Need Help?

Please join our Slack Channel to interact directly with the core team and our small community. This is a good place to discuss your questions and ideas or in general ask for help ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ง ๐Ÿ‘ซ ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ฆ.

Project details


Download files

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

Source Distribution

slicktune-0.1.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distribution

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

slicktune-0.1.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file slicktune-0.1.0.tar.gz.

File metadata

  • Download URL: slicktune-0.1.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for slicktune-0.1.0.tar.gz
Algorithm Hash digest
SHA256 82d3ccf9871e78eded4905d5f693547f7e2f72b6156993091da58fbab390e922
MD5 96652e5f12abea4c9dde7b9c1c74a812
BLAKE2b-256 f96926ae9cc602bfeebfd8425eb20a930503a3ba3141df1c34f552be8d7bd7f7

See more details on using hashes here.

File details

Details for the file slicktune-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: slicktune-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for slicktune-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 27c259fdcbda45800c88d008d119871414e33683c9ffef62013e69b95d76e718
MD5 88e29e5ec1f5a26fa38b5fac35e5fffd
BLAKE2b-256 cd152095cee33f361ceb6dce7e74969c542fd473816adb2864814df842d9e464

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page