Lurker News
I trained a 125M-parameter transformer to autocomplete piano performances in real time (~108 notes/sec on an iPhone 15).

The idea is basically GitHub Copilot or Tabnine, except instead of prompting it with code, you prompt it by playing a few notes on a MIDI piano. The model then continues what you played, entirely on-device.
The app is free if anyone wants to try it. Happy to answer questions about the model, training, Core ML, or the many things that didn't work.

Comments (117) 65 threads

Earlier comments
butlike#
Question as a musician: Do you find satisfaction in the piece it created in-and-of-itself (subtracting the satisfaction from making the tool itself)?
gaya3bollineni2 replies#
Running a 125M model on-device at that speed is impressive. How much did you have to optimize the model to get that performance on an iPhone?
simedw#
The biggest speed improvement came from changing the note representation when I switched to compound note events: roughly 5× fewer autoregressive passes per note.

For the current model I’m using Core ML, which optimizes the kernels the first time you run it. I haven’t actually spent that much time tuning performance beyond that.

Naitik88#
The answer about changing the note representation was interesting. Sometimes a change in how the problem is represented ends up giving a much bigger improvement than trying to optimize the model itself.
leobg#
I don’t have MIDI. How about whistling or playing the piano via microphone? Sounds easy. Another 6 month rabbit hole? :)
ingvay7#
This is amazing. Great inspiration to train a model for a midi electric guitar solo. Though with bends, vibratos, mutes, harmonics, dive bombs etc as part of the event feed, it may possibly create way more events than this which means more training I suppose.

Load more comments