ml-explore/mlx-swift-lm

LLMs and VLMs with MLX Swift

What it solves

It provides a Swift package for developers to build applications using large language models (LLMs) and vision language models (VLMs) specifically optimized for the MLX Swift framework.

How it works

The project offers a common API (MLXLLMCommon) and specific implementations for LLMs (MLXLLM), VLMs (MLXVLM), and embedding models (MLXEmbedders). It integrates with various tokenizer and model downloading packages through protocol conformance, allowing developers to load models from sources like Hugging Face. It also includes a bridge (MLXFoundationModels) to integrate MLX models with Apple's FoundationModels framework and a tool for grammar-constrained generation (MLXGuidedGeneration) to ensure outputs follow specific schemas like JSON or EBNF.

Who it’s for

Swift developers building AI-powered tools and applications on Apple platforms who want to leverage MLX for efficient model inference and fine-tuning.

Highlights

  • Support for both LLMs and Vision Language Models (VLMs).
  • Capabilities for both low-rank (LoRA) and full model fine-tuning, including support for quantized models.
  • Grammar-constrained generation to force model outputs into specific JSON schemas or EBNF.
  • Integration with Apple's FoundationModels API for use with LanguageModelSession.
  • Flexible integration with various tokenizer and downloader packages.

Related

  • Project
  • Project
  • Project
  • Project
  • Project