mlx-swift-lm  by ml-explore

LLMs and VLMs for Swift developers with MLX

Created 6 months ago
376 stars

Top 75.5% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

MLX Swift LM is a Swift package suite enabling developers to integrate Large Language Models (LLMs) and Vision Language Models (VLMs) into applications using MLX Swift. It simplifies model deployment by offering seamless Hugging Face Hub integration, supporting both low-rank (LoRA) and full model fine-tuning, and accommodating quantized models. This empowers Swift developers to leverage advanced AI capabilities directly within their projects.

How It Works

The project provides modular Swift packages (MLXLLM, MLXVLM, MLXLMCommon, MLXEmbedders) built on top of MLX Swift, Apple's accelerated machine learning framework. It abstracts complex model loading, inference, and fine-tuning processes through high-level APIs. This approach allows for efficient, on-device execution of LLMs and VLMs, particularly on Apple Silicon hardware, offering a performant and accessible path for integrating AI features into native applications.

Quick Start & Requirements

  • Installation: Add https://github.com/ml-explore/mlx-swift-lm/ as a Swift Package dependency in Package.swift (using main branch or a specific release like 2.29.1). Alternatively, add to Xcode Project Dependencies with a Branch rule set to main.
  • Prerequisites: A Swift development environment. MLX Swift is optimized for Apple Silicon.
  • Example Usage:
    let model = try await loadModel(id: "mlx-community/Qwen3-4B-4bit")
    let session = ChatSession(model)
    print(try await session.respond(to: "What are two things to see in San Francisco?"))
    
  • Documentation: Links to MLX Swift Examples and specific library documentation (MLXLLMCommon, etc.) are implied.

Highlighted Details

  • Direct integration with the Hugging Face Hub for easy access to thousands of LLMs and VLMs.
  • Supports both Low-Rank Adaptation (LoRA) and full model fine-tuning.
  • Includes support for running quantized models, reducing memory footprint and improving performance.
  • Offers implementations for a variety of LLM and VLM architectures.

Maintenance & Community

No specific details regarding contributors, sponsorships, or community channels (like Discord/Slack) are provided in the README snippet.

Licensing & Compatibility

The license type is not explicitly stated in the provided README content. This requires further investigation for commercial use or closed-source integration.

Limitations & Caveats

The project relies on MLX Swift, which is primarily optimized for Apple Silicon hardware. Specific performance characteristics or limitations on other platforms are not detailed. The absence of explicit licensing information is a significant caveat for adoption.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
46
Issues (30d)
17
Star History
93 stars in the last 30 days

Explore Similar Projects

Starred by Pietro Schirano Pietro Schirano(Founder of MagicPath), Awni Hannun Awni Hannun(Author of MLX; Research Scientist at Apple), and
2 more.

mlx-swift-examples by ml-explore

0.6%
2k
Swift examples for MLX models
Created 2 years ago
Updated 1 day ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Elie Bursztein Elie Bursztein(Cybersecurity Lead at Google DeepMind), and
8 more.

h2o-llmstudio by h2oai

0.1%
5k
LLM Studio: framework for LLM fine-tuning via GUI or CLI
Created 3 years ago
Updated 3 days ago
Feedback? Help us improve.