Back to browse
GitHub Repository

Ruby Bindings for the MLX Framework

45 starsRuby

MLX-Ruby – Ruby Bindings for Apple's MLX ML Framework

by skryl·Feb 16, 2026·1 point·1 comment

AI Analysis

●●SolidWizardryDark HorseNiche Gem

Full MLX power in Ruby: lazy arrays, Metal GPU, transformer layers—but Ruby adoption risk.

Strengths
  • Native C++ extension gives genuine parity with upstream MLX (grad, vmap, jvp, compile transforms) vs. wrapper approximations
  • Working examples (LLaMA, Stable Diffusion, LoRA fine-tuning) prove production viability on Apple silicon
  • Declarative Ruby DSL for model definition is more ergonomic than low-level bindings
Weaknesses
  • Ruby ecosystem for ML is tiny compared to Python; adoption depends entirely on Ruby community buy-in
  • Requires Metal toolchain + CMake + C++20 compiler—non-trivial onboarding, especially for Ruby developers accustomed to simpler installs
Category
Target Audience

Ruby developers on macOS, indie ML practitioners

Similar To

PyTorch · TensorFlow · JAX

Post Description

Hi HN, I ported the Python MLX bindings to Ruby (https://github.com/ml-explore/mlx).

GitHub: https://github.com/skryl/mlx-ruby

MLX-Ruby is a native C++ extension that wraps the upstream MLX runtime, giving Ruby full access to the array framework, neural network layers, optimizers, and Metal GPU acceleration on Apple silicon.

What’s included: ∙Lazy arrays with dynamic graph construction ∙Function transforms: grad, value_and_grad, vmap, jvp, vjp, compile ∙Full NN module system: Conv2d, Linear, Embedding, Transformer layers, RNNs, etc. ∙Optimizers: Adam, AdamW, SGD, and more ∙A Ruby DSL for declarative model definition, training loops, and checkpointing ∙CPU and Metal GPU support

Working examples (https://github.com/skryl/mlx-ruby-examples): ∙LLaMA inference ∙Stable Diffusion ∙Whisper ∙Transformer language model ∙LoRA fine-tuning

Similar Projects

AI/ML●●●Banger

iPhone ANE holds LLM tok/s while MLX and LiteRT thermal-throttle

LiteRT beats MLX on Gemma memory while CoreML sips power on the Neural Engine.

Dark HorseBig BrainSolve My Problem
mlboy
1011d ago