Implement MLX backend support for Apple Silicon#47
Draft
Conversation
Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com>
Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com>
Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for MLX backend in the project
Implement MLX backend support for Apple Silicon
Oct 19, 2025
ericcurtin
pushed a commit
that referenced
this pull request
Oct 30, 2025
* Add /models/prune Uses docker/model-distribution#78. Signed-off-by: Dorin Geman <dorin.geman@docker.com> * feat(tests): add ResetStore test to verify store reset functionality --------- Signed-off-by: Dorin Geman <dorin.geman@docker.com> Co-authored-by: Ignacio López Luna <ignasi.lopez.luna@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements full MLX backend support for the Docker Model Runner, enabling optimized inference on Apple Silicon (M1/M2/M3 chips) using Apple's MLX framework. This addresses issue #XXX which requested MLX backend implementation.
What Changed
MLX Backend Implementation
Added a complete MLX backend (
pkg/inference/backends/mlx/mlx.go) that:mlx-lmpackage on first usemlx_lm.serverto provide a standard OpenAI-compatible inference APIIntegration
main.goto conditionally register the MLX backend on compatible platforms./mlx-envand reused across runsUsage Example
Technical Details
Requirements:
Backend Interface:
All required methods are fully implemented:
Install(): Sets up Python environment and installs mlx-lmRun(): Executes model inference via mlx_lm.serverGetRequiredMemoryForModel(): Estimates memory based on model sizeStatus(),GetDiskUsage(): Track backend stateSecurity:
Testing
mlx_test.goDocumentation
Updated README.md with a dedicated MLX backend section including:
Related Issues
Closes #XXX (MLX backend feature request)
As noted in the issue comments, safetensors support in OCI artifacts was a prerequisite, which is already implemented in the codebase. This PR completes the MLX backend implementation.
Original prompt
Fixes docker#90
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.