What is the difference between Core ML and MLX Swift? #187
-
Apple already provides a MLTensor type as part of the Core ML framework. This tensor type is a multi-dimensional array for numerical computing and appears to support CPU and GPU via the MLComputeDevice. So what is the difference between using MLTensor from Core ML versus MLXArray from MLX Swift? Since both of these frameworks focus on Apple devices then why provide two separate frameworks? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
MLXArray predates MLTensor by roughly a year and maybe has a different focus. MLX is built to let people do ML research on Apple Silicon, in particular it is built around training models (all of the gradient computation for example). MLXArray is lazily filled and represents a node in a compute graph. You can perform all manner of numpy-like operations on it. You can certainly do inference and it is very good at that, but I don't think that is the main reason it was built. CoreML is more focused on inference. You can load serialized models. It is very easy to hook up in applications. There are a lot of options for running on different compute devices. They provide applications (CreateML) to do model fine tuning. MLTensor is a lot newer and has the same sort of operations as MLXArray. I don't think it is lazily filled, but it would be perfect for any data processing you might need to feed into your model or process the outputs. You might be able to use it in training, but I don't think it is focused on that and I don't know what its gradient (and in general transform) capabilities are. There are other ML frameworks from Apple over the years too:
There might be more. It just depends what you are trying to do and how you want to go about doing it. |
Beta Was this translation helpful? Give feedback.
MLXArray predates MLTensor by roughly a year and maybe has a different focus. MLX is built to let people do ML research on Apple Silicon, in particular it is built around training models (all of the gradient computation for example). MLXArray is lazily filled and represents a node in a compute graph. You can perform all manner of numpy-like operations on it. You can certainly do inference and it is very good at that, but I don't think that is the main reason it was built.
CoreML is more focused on inference. You can load serialized models. It is very easy to hook up in applications. There are a lot of options for running on different compute devices. They provide applications (CreateML) t…