Show HN: I trained a 125M model to autocomplete piano on-device (simedw.com)
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.
117 comments
[ 0.99 ms ] story [ 28.7 ms ] threadYou have trained a model, presumably on other people's work, to improvise on an initial kernel of musical material. In doing so you:
1) remove the opportunity for one to develop their own skills in extending musical ideas 2) rip off other people's work wholesale 3) remove what is the most rewarding part of music (creating and shaping it through refinement and technique).
Or maybe there is some other "spark" deeper within?
When everyone can make anything as soon as they think of it, what will set us apart?
thing go plink
machine hear plink
machine make many more plink
man happy for plink is fun
man not hit machine with club or scream on orange site
man leave cave and touch plant
The closest we've had to realtime orchestration around a melody in the "real world" is probably arranger keyboards though your left hand is still responsible for the chord progression itself.
[1] - https://en.wikipedia.org/wiki/Microsoft_Research_Songsmith
Some details: https://shop.chessbase.com/en/products/ludwig_3_engl
You can still download it for free: https://www.heise.de/download/product/ludwig-58854 (Heise is a renowned German publisher, nothing shady)
I am still waiting for something like this based on generaitive AI.
I can probably squeeze out quite a bit more than 100 notes/sec as well. I haven’t spent much time optimizing inference yet.
Would be fun to get a midi clock going and play some chords on my piano and have my synth start jamming along with the bass and my keyboard doing some performance. Or any combination of the above.
https://www.francoispachet.fr/continuator/
But, but… wouldn't that be… (gasp) DISTILLATION?
Fun project!
Pretraining was obviously a a lot slower, the 125M model took roughly half a day.
Some protocols (like I2C or MIDI) are gonna be with humanity forever, probably.
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.
https://magenta.withgoogle.com/magenta-realtime-2
There are plenty of AI use in music that aren't about an LLM making music in place of the musician, like Suno & co...
One think I didn't see mentioned in the post- maybe I missed it- how large was the data? How many samples did you use to pretrain and post-train
> The final dataset contained a few hundred thousand MIDI files, representing roughly 300 million note events.
One feature request:
Instead of playing the AI-generated audio solely through the iPhone's speakers, add an option to send the audio as midi notes to a device (probably the same one you received the mini notes from).