Running this model on Apple Silicon Macs (unofficial port, MPS and MLX)

#2
by jonnyArt - opened

Thank you for releasing Karpo Decision. We wanted to run it on Macs and found that the first decide() call fails there, because the sliding-window layers use a flash-attention call that PyTorch only provides for CUDA (aten::_flash_attention_forward is not implemented for MPS or CPU).

We wrote a small unofficial port and are sharing it in case it helps other Mac users:

Checked against your published 31B results (340 requests, 1,606 questions, up to 8,072 tokens; request hashes and token counts all matched):

Run Questions Top answer changed Mean difference Largest difference
PyTorch on MPS, bfloat16 1,606 1 0.0011 0.103
MLX 8-bit 1,606 2 0.0016 0.079
MLX 4-bit (145 of the requests) 681 3 0.0067 0.183

Not checked: images, requests longer than 8,072 tokens, and the Decision Index score of the quantized copies. The port is not affiliated with or endorsed by MachinePulse; if you would like it named or described differently, tell us and we will change it.

MachinePulse org

Thanks for putting this together and for sharing the detailed validation! We appreciate you catching the CUDA-only attention path and helping make Karpo Decision usable on Macs. The comparison results are very helpful, especially with the testing scope and limitations clearly documented. Describing it as an unofficial community port works for us.

If you’re interested, we’d welcome a PR for the PyTorch attention fallback so we can review it for inclusion upstream. Thanks again for sharing both the port and the MLX conversions with the community!

Sign up or log in to comment