feat: add MLX backend prototype for PolarQuant, TurboQuant, and KV cache compression#52
Open
dipeshbabu wants to merge 1 commit intoTheTom:mainfrom
Open
Conversation
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.
This PR adds a first MLX backend for the Python TurboQuant prototype on Apple Silicon.
Scope is intentionally limited to the existing Python path:
PolarQuant,QJL,TurboQuant,TurboQuantMSE, andKVCacheCompressormlxinstall pathScope
The repo README and roadmap explicitly call out MLX support as a desired contribution, but a full runtime/inference integration would be too large for a first MLX PR.
This PR targets the part of the project that is already backend-shaped today:
That provides a clean phase-1 MLX contribution and a base for later Apple Silicon work.
Changes
New
turboquant/mlx_backend.pyMLXPolarQuantMLXQJLMLXTurboQuantMLXTurboQuantMSEMLXKVCacheCompressorMLX_AVAILABLEto_numpy()tests/test_mlx_backend.pymlxis not installedbenchmarks/benchmark_mlx_backend.pyUpdated
turboquant/__init__.pypyproject.tomlmlxextraREADME.mdValidation
benchmarks/benchmark_mlx_backend.pyUpdated
turboquant/__init__.pypyproject.tomlmlxextraREADME.mdValidation
Validated locally in this environment with:
I could not run the real MLX backend in this environment because MLX is not available here, and
pytestwas not installed locally. The testfile is included and will run on an MLX-capable setup.
Notes
This is a Python prototype/backend contribution only.
Not included in this PR: