techlist.io
OpenAI2019-04-244 min read

Curated summary

MuseNet

Read original(opens in new tab)

MuseNet: Generating Multi-Instrument Music with a Transformer

OpenAI's MuseNet is a deep neural network that generates 4-minute musical compositions for up to 10 instruments and blends styles from country to Mozart to the Beatles. Rather than being programmed with music theory, it learned harmony, rhythm, and style by predicting the next token across hundreds of thousands of MIDI files, using the same general-purpose transformer approach as GPT-2. The post presents the model's controls, architecture, data encoding, and limitations, and shows that the same long-context modeling that works for text also works for music.

Style Blending and Conditioning

  • The model can merge styles, such as starting from the first six notes of a Chopin Nocturne and generating a pop arrangement with piano, drums, bass, and guitar.
  • A simple mode offers pre-generated samples by composer or style, while an advanced mode lets users interact with the model directly and produce new pieces.
  • Composer and instrumentation tokens are prepended to training samples, so at generation time a prompt (such as a Rachmaninoff opening or a Journey-style band setup) steers the output.
  • t-SNE visualizations of the embeddings show how the model groups composers and styles by cosine similarity.

Limitations

  • Requested instruments are strong suggestions, not guarantees, because each note is sampled from probabilities across all notes and instruments.
  • Unusual pairings, such as Chopin with bass and drums, produce less natural results. Choosing instruments close to the composer's or band's typical sound works better.

Architecture and Long-Term Structure

  • MuseNet is a 72-layer Sparse Transformer with 24 attention heads and full attention over a 4096-token context, using the recompute and optimized kernels from the Sparse Transformer work.
  • The long context lets it keep structure over long spans, as seen in its Chopin and Mozart imitations.
  • Music is a useful test domain because it sits between text and images. It has text-like fluid token structure, yet errors in long-range structure, such as broken rhythm, are easy to hear, whereas a text model's brief tangent is less obvious.

Training Data and Encoding

  • Data came from ClassicalArchives and BitMidi, several online collections spanning jazz, pop, African, Indian, and Arabic styles, and the MAESTRO dataset.
  • The team tested chordwise encodings (one token per simultaneous note combination) and note-onset encodings with byte pair encoding compression.
  • Time was marked either relative to tempo (in beats) or in absolute seconds.
  • The final encoding combines pitch, volume, and instrument into a single token, balancing expressiveness and conciseness.
  • Augmentations included transposition (reduced later in training to keep notes within instrument ranges), volume scaling, timing changes for the absolute-time encoding, and mixup in the token embedding space.
  • An inner critic predicts whether a sample is from the dataset or from the model's own past outputs, and this score is used to select samples at generation time.

Embeddings

  • A learned timing embedding gives all notes sounding simultaneously the same time signal.
  • Per-note embeddings within a chord approximate relative attention, letting the model learn patterns like "note 4 looks back at note 3."
  • Two structural embeddings locate the sample within the piece: one divides the piece into 128 parts, and the other counts down from 127 to 0 as the end token approaches.

Conclusion

MuseNet shows that a general-purpose next-token transformer, given the right encoding, conditioning, and long context, can produce coherent multi-instrument music in many styles. The post invites musicians to experiment with the demo and contribute MIDI data, and notes that a live concert of previously unheard MuseNet pieces was streamed on April 25, 2019.

Continue with another curated summary.