Jukebox
# Jukebox: Generating Raw Music Audio with Neural Nets OpenAI introduces Jukebox, a neural network that generates music as raw audio, including rudimentary singing, in a range of genres and artist styles, given a genre, artist, and lyrics as input. The authors argue that modeling audio directly captures voices and timbres that symbolic (MIDI-style) generators miss, and they overcome the extreme sequence lengths of raw audio with a multi-level compression and transformer pipeline. The model is still slow and imperfect, but the release includes weights, code, and a sample explorer. ## Why Raw Audio Is Hard - Symbolic approaches, such as piano rolls, have produced Bach chorales, multi-instrument pieces, and minute-long compositions, but they cannot represent human voices or subtle timbre and expressivity. - A 4-minute CD-quality song (44 kHz, 16-bit) has over 10 million timesteps, compared with 1,000 for GPT-2, so the model must learn very long-range dependencies. - Raw audio is unforgiving of timing errors at every scale, and the diversity of music adds further difficulty. ## Compressing Audio into Discrete Codes - Jukebox uses a VQ-VAE, extending the VQ-VAE-2 architecture with three changes: - **Random restarts** reset underused codebook vectors to encoded hidden states, which prevents codebook collapse. - **Separate decoders** per level reconstruct the input from each level's codes, so the upper levels are actually used. - **A spectral loss** penalizes differences between input and reconstructed spectrograms, helping the model reproduce high frequencies. - Three levels compress 44 kHz audio by 8x, 32x, and 128x, each with a codebook of 2048 entries. The most compressed level keeps pitch, timbre, and volume, though the audio becomes noticeably noisy. ## Generating Codes with Transformers - Three prior models learn the distribution of codes: a top-level prior captures long-range structure and melody (including singing), and two upsampling priors add local timbre and detail. - Each prior is an autoregressive simplified Sparse Transformer with 72 layers of factorized self-attention over 8,192-code contexts, covering roughly 24 seconds (top), 6 seconds (middle), and 1.5 seconds (bottom) of audio. - Generation runs top-down: sample top-level codes, upsample them, then decode to waveform with the VQ-VAE decoder. ## Dataset and Conditioning - The team crawled about 1.2 million songs (600,000 in English), paired with lyrics and metadata (artist, genre, year, moods) from LyricWiki. Training used 32-bit, 44.1 kHz audio, with random left/right downmixing to mono as augmentation. - **Artist and genre conditioning** reduces the entropy of predictions and lets users steer the style at generation time. An unsupervised t-SNE shows related artists and genres clustering together. - **Lyrics conditioning** is difficult because lyrics are unaligned at the song level. The team first used a linear character-to-time heuristic, which fails for fast lyrics such as hip hop. They then extracted vocals with Spleeter and aligned words with NUS AutoLyricsAlign, and added encoder-decoder attention so the model learns a more precise alignment. ## Limitations - Samples show local coherence, plausible chord progressions, and good solos, but they lack larger repeated structures such as choruses. - Downsampling and upsampling introduce audible noise, which better VQ-VAE codes could reduce. - Sampling is very slow, taking about 9 hours to render one minute of audio, so it is not yet suitable for interactive use. Distilling into a parallel sampler is a possible fix. - Training covered mostly English lyrics and Western music. ## Future Directions and Reception - The team is exploring conditioning on MIDI and stem files, which could improve musicality and give musicians more control. - In a trial with 10 musicians, participants did not find Jukebox immediately useful for their creative process, given its current limitations. - The authors are also studying bias and intellectual property issues and are seeking creative collaborators.