Show HN: I trained a 125M model to autocomplete piano on-device
434 points - today at 12:04 PM
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.
You can also listen to the transcript of four Russian composers, including Rachmaninoff, playing this pattern recognition and generation game at a dinner party in the late 1800’s: https://youtu.be/PlFPOWuwBHI?is=EKBK7QQkJs4MsTCU
Composers at the time could do this just by looking at sheet music and audiating, without using a piano.
jasonjmcgheetoday at 2:45 PM
I think this is a great project and very HN. Not sure why the comments are so focused on the deliverable- you learned way more and had a much more interesting experience.
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
joshuamerrilltoday at 6:16 PM
Classical pianist and software product designer here.
I see so much in common with this project and the numerous AI-based UX design tools out there. Whether it's music or UI, now that the "generation" portion of the work costs zero, all that remains is taste.
And so much of taste comes from exploring and killing off possibilities that turn out to be dead-ends. I love the idea that models like these will help us find the dead ends faster, or even produce a gem here and there.
P.S. if you want another uncanny version of Fur Elise, listen to Beethoven's own 1822 revision: https://www.youtube.com/watch?v=s24TtiGgb6k. His 1810 version that we all know was simpler and more balanced. But for what it's worth, Beethoven didn't publish either of them.
goda90today at 1:34 PM
Reminds me of this project to generate every melody possible algorithmically in order to fight music copyright lawsuits.
https://allthemusic.info/
karmelappletoday at 3:09 PM
Hearing the start of FĂĽr Elise, and then it being taken in an incredibly different direction, is surprisingly disconcerting.
ghm2199today at 3:15 PM
Interesting. I do feel letting a machine generating notes is taking the joy out of improvisation, is it not?
I think one of the great, early, joys of learning a piano is gaining the following intuitions: The seemingly harder path of learning sheet is actually faster. Your mind _should_ learn to think in two dimensions Spatial — where fingers go — and Time — pitch and tempo – ** when learning. The _internalization_ of Space and Time queues guide the fingers in a dance that is vastly satisfying. This skill leads you to the final part of the journey that is improvisation and the one more exciting than what i am on now.
---
**
Space: Your finger placement on keys right, e.g. knowing how to go from landmark/anchor notes(mid-c, G, F etc) and then go to the others above and below it. Crudely this is some what like typing from your landmark f and j qwerty keyboard
Time: The out singing/verbalizing of the notes/beats on a time measure as you play them(per the time measure). e.g. you can say out loud 1-2-3-4 for 4/4 measure, if the measure has quarter notes say out loud. And `1-e-and-a-2-e-and-a-3-e-and-a-4-e-and-a` for a 4/4 with 1/16th note granularity. Do this as you play the notes and you get a sense of tempo.
timmbtoday at 1:30 PM
Reminds me of Francois Pachet’s Continuator (all the way back in 2003, using hierarchical markov models)
Ah, MIDI files. The only type of music you could realistically download from the internet back in the day, and you had to wake up at ungodly hours so that your dialup modem would not rack up a massive phone bill.
heikkilevantotoday at 1:15 PM
I would love something like that, except that I play the melody, and it produces proper 3-4 part accompaniment, preferably in good baroque style. Extra bonus if it could also write it into a file in a format suitable for music editing programs.
If you like such creative AI work, I would recommend looking at the other "NeurIPS Creative AI Track 2025" submissions as well.
devonsolomontoday at 1:25 PM
This is really fun. Scaler 3 starts with a chord progression and lets you break it down into musical performances and parts. Useful for ideation when producing.
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.
sagebirdtoday at 3:20 PM
FĂĽr Elsevier Journal Access Library pass out candy for safety this halloween your baby off milk shake it off.
rajivayyangartoday at 6:00 PM
The results strike me as comparable or worse than you could get with a Markov model. I think it reveals the gap in understanding between LLMs and music. I think you need to either:
- Set up a pipeline to decompose music into, say, harmonic sequences and melodic sequences, and then have the LLM work on some more fundamental or more high-level layer of musical composition and then re-translate it back into actual sounds.
- Develop a better dataset and train the LLM more natively on musical examples.
Does anybody know of a project that has produced more convincing results?
axoltltoday at 7:18 PM
Looks neat! I'd love for it to feed the MIDI notes back into my player piano instead of playing out of my iPhone's (comparatively tinny) speakers though.
evalystaitoday at 12:29 PM
The idea is awesome! :) However there's definitely much room for improvement, first of all rythm and composition (so there's some sense of musical form).
Also consider checking their decisions about representation, etc
Tepixtoday at 2:46 PM
Oh, a cool idea! I just tried it, works pretty well. Kudos!
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).
butliketoday at 4:08 PM
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)?
davidajacksontoday at 1:37 PM
How would you expand this to support elements like attack ("velocity of the key-down" in piano speak), grace notes, timing etc. Would each of those be part of this model or another model? How would you model an arbitrary element (pedal, duration, etc...)
Ohentistoday at 5:58 PM
It occurres to me that the relationship between pitches usually matters more than the pitches themselves. Perhaps the pitches could be encoded in a vector like what is typically done for position.
isoprophlextoday at 12:32 PM
Amazing idea! Gonna hook this up to my little synthesizer and blast some square wave arpeggiated ML music!
dandakatoday at 7:06 PM
I would love to see a jamming partner. So I could play along him on the same piece.
subhajeet2107today at 1:21 PM
This is so amazing, can you improve the quality of generation at the cost of notes per seconds ? No one can play 108 notes/sec anyways, maybe you can train the model to do CoT for better quality
Congratulations! It is amazing!!! Can you do the same with a song and give different drums to see which one fits better?
dyzonetoday at 5:48 PM
I wonder if training SOTA models on this will make them more humane?
luciana1utoday at 6:06 PM
next step is a model that autocompletes the part where you actually practice. mine just sits there judging my scales.
arkmmtoday at 1:51 PM
Very cool! Can you say a little bit about the size of the DPO training examples and how long training took?
theschwatoday at 3:06 PM
Would you be willing to share about how much it cost to train a model like this?
yoouareperfecttoday at 12:26 PM
This is really awesome thanks for sharing
the_black_handtoday at 2:20 PM
Cool work. I tried using LLMs to parse sheet music and they are really bad.
bilsbietoday at 3:45 PM
Should tokens be multiple
Midi notes? Why or why not?
deletedtoday at 3:38 PM
bubblegumcrisistoday at 7:00 PM
This is disgusting. I'm sorry. All the positive comments. It's like Waymo's posts on HN. Incomprehensible to me.
I guess no one actually wants to learn about harmony, about voicing, and voice leading, spend the hours. No one wants to learn how to actually play an instrument. I guess no one is willing to do the work.
They want to just press some keys and declare that they made what the computer generated.
This is all so depressing for me.
I think in the near future, the world will divide, and all of the people who wish to think and do, will put up a wall separating themselves from the hu-bots that infest the rest of the planet. It's alright I guess. I hope there isn't a slaughter of one side or the other.
abidlabstoday at 3:54 PM
Are the weights of the model available?
noman-landtoday at 3:43 PM
This is honestly astonishing and the first "AI music" I've heard that has the potential to sound beautiful. I always thought that MIDI would be a perfect format for this. Glad to see this person make it happen!
jwrtoday at 1:34 PM
> Eventually I used Gemini 3.5 Flash for pairwise evaluation
But, but… wouldn't that be… (gasp) DISTILLATION?
Fun project!
aghilmorttoday at 2:35 PM
really incredible work! great use case, impeccable learning strategy, congrats!
amarbirsinghtoday at 3:47 PM
Pretty Impressive!!
micromacrofoottoday at 4:21 PM
I too am currently learning to play Sonatina in G Major, it's a fun one! the end is surprisingly tricky