125M-parameter model autocompletes piano on iPhone in real time
Original: Show HN: I trained a 125M model to autocomplete piano on-device
Why This Matters
Demonstrates viable on-device generative music AI at consumer hardware speeds, advancing edge AI deployment for creative applications.
Developer Simon Edwardsson trained a 125M-parameter transformer model to autocomplete live piano performances on-device, achieving ~108 notes/sec on an iPhone 15. The free app, RollTab, connects to a MIDI keyboard and generates continuations in real time after 14 development iterations.
Simon Edwardsson built RollTab, a free iOS/iPadOS app that autocompletes piano performances in real time using a 125M-parameter transformer model running entirely on-device. The model achieves approximately 108 notes per second on an iPhone 15, with no cloud dependency. Development took nearly a year and 14 distinct experiments before reaching a quality Edwardsson deemed publishable.
The key technical challenges centered on three areas: MIDI tokenization, data cleaning, and post-training. For tokenization, Edwardsson tested multiple representations before settling on a compact NOTE(pitch, delta_onset, duration, velocity) format that encodes each note in a single token rather than the three-to-four tokens required by note-on/note-off or factored grammar approaches. This both preserved context window space and eliminated 'hanging note' drift common in smaller models.
Training data was cleaned aggressively to retain piano-relevant content from multi-track MIDI files. Additionally, Direct Preference Optimization (DPO) post-training was applied, which Edwardsson cites as one of the largest quality improvements. Audio samples demonstrate continuations of pieces including Pokémon's Pallet Town, Final Fantasy VI's Terra's Theme, and Für Elise from short prompts of 8 to 16 notes.