Skip to main content

Simple Self-Distillation training pipeline for MLX models

Project description

mlx-ssd

mlx-ssd is a practical MLX CLI implementation of simple self-distillation for code generation models on Apple Silicon.

Method

This project follows the method introduced in:

Ruixiang Zhang, Richard He Bai, Huangjie Zheng, Navdeep Jaitly, Ronan Collobert, Yizhe Zhang.
Embarrassingly Simple Self-Distillation Improves Code Generation.
arXiv:2604.01193, 2026.
https://arxiv.org/abs/2604.01193

Implementation by Amirani Labs.

Core flow:

  1. Sample responses from a base model with train-time decoding settings.
  2. Fine-tune on those self-generated samples.
  3. Evaluate/run with eval-time decoding settings.

Dataset defaults:

  • --problems microsoft/rStar-Coder
  • --dataset-config seed_sft
  • --dataset-split train
  • Records must contain a non-empty question field.

This repository is an independent implementation and is not the original paper repository.

Presets

Presets encode paper-aligned hyperparameters (Table 3 mapping) for supported model families.

mlx-ssd sample --model mlx-community/Qwen3-4B-Instruct-4bit --preset qwen3-4b-instruct --output ./ssd_data
mlx-ssd train --model mlx-community/Qwen3-4B-Instruct-4bit --preset qwen3-4b-instruct --data ./ssd_data --output ./ssd_model
mlx-ssd run --model ./ssd_model/fused --preset qwen3-4b-instruct --prompt "Write a function that..."

Usage

Install:

pip install -e .

Three-stage flow:

# 1) Sample
mlx-ssd sample \
  --model mlx-community/Qwen3-4B-Instruct-4bit \
  --problems microsoft/rStar-Coder \
  --dataset-config seed_sft \
  --dataset-split train \
  --output ./ssd_data \
  --batch-size 16 \
  --temperature 1.6 \
  --top-k 20 \
  --top-p 0.8 \
  --limit 10

# 2) Train
mlx-ssd train \
  --model mlx-community/Qwen3-4B-Instruct-4bit \
  --data ./ssd_data \
  --output ./ssd_model \
  --iters 2500

# 3) Run
mlx-ssd run \
  --model ./ssd_model/fused \
  --temperature 1.1 \
  --top-k 20 \
  --top-p 0.8 \
  --prompt "Write a function that..."

One-command flow:

mlx-ssd distill \
  --model mlx-community/Qwen3-4B-Instruct-4bit \
  --preset qwen3-4b-instruct \
  --output ./my-better-qwen

Local smoke test (quick validation):

mlx-ssd sample \
  --model mlx-community/SmolLM2-135M-Instruct \
  --problems microsoft/rStar-Coder \
  --dataset-config seed_sft \
  --dataset-split train \
  --output ./.smoke/data \
  --batch-size 4 \
  --temperature 0.8 \
  --top-k 20 \
  --top-p 0.8 \
  --max-tokens 64 \
  --limit 5

Apple Silicon

mlx-ssd itself is the Apple Silicon implementation: it is built on mlx-lm and targets local MLX workflows.

License

MIT

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

mlx_ssd-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

mlx_ssd-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mlx_ssd-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mlx_ssd-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b596062d175c9e762c300988d938ee0933a8177139773b913d400dbc2c2b3d9c
MD5 1b24b307d4324fa35df8bf252b97cdbb
BLAKE2b-256 6e5cd63ac190b59581c014f96925e8a3601342ebf3f15b0fdb6467191c083f5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_ssd-0.1.0.tar.gz:

Publisher: publish.yml on AmiraniLabs/mlx-ssd

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

File details

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

File metadata

  • Download URL: mlx_ssd-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mlx_ssd-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 795dc8174e09a03ee630bcaa2ec152e8c00fcbbe5b0dfbe09af09cb8a0971425
MD5 966a1ed78213957c197849623a579da8
BLAKE2b-256 4ecdce8c9078b17fb11bfb8bf9908de4b20ea11935cae85c7532fd4219871518

See more details on using hashes here.

Provenance

The following attestation bundles were made for mlx_ssd-0.1.0-py3-none-any.whl:

Publisher: publish.yml on AmiraniLabs/mlx-ssd

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

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