Skip to main content

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

Metadata

Release files for mlx-ssd 0.1.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 mlx-ssd 0.1.0
File Size Uploaded Provenance Actions
mlx_ssd-0.1.0.tar.gz 8.1 kB With provenance Details for mlx_ssd-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mlx-ssd 0.1.0
File Interpreter ABI Platform Actions
mlx_ssd-0.1.0-py3-none-any.whl Python 3 none any Details for mlx_ssd-0.1.0-py3-none-any.whl

Total release size: 17.2 kB

Release files / mlx_ssd-0.1.0.tar.gz

Download URL mlx_ssd-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b596062d175c9e762c300988d938ee0933a8177139773b913d400dbc2c2b3d9c
BLAKE2b-256 checksum
How to use checksums
6e5cd63ac190b59581c014f96925e8a3601342ebf3f15b0fdb6467191c083f5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 3, 2026.

Transparency log

Release files / mlx_ssd-0.1.0-py3-none-any.whl

Download URL mlx_ssd-0.1.0-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
795dc8174e09a03ee630bcaa2ec152e8c00fcbbe5b0dfbe09af09cb8a0971425
BLAKE2b-256 checksum
How to use checksums
4ecdce8c9078b17fb11bfb8bf9908de4b20ea11935cae85c7532fd4219871518
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 3, 2026.

Transparency log

Security for mlx-ssd 0.1.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mlx_ssd-0.1.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 Apr 3, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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