Researcher Created AI That Can Rap With Slang And Swearing

Robot rapper

Incorporating rhyme, rhythmic speech, and street vernacular, rapping can indeed be difficult.

This challenge was accepted by a researcher at robotic firm Vicarious AI. Li Yang Ku trained a neural network as a "hobby", to rap by feeding it classic verses from MCs including Jay-Z, Kanye West, Eminem, and Snoop Dogg.

He then entered some of his own rhymes as an input and asked it to complete the rap.

The AI dubbed the ‘Home-made Rap Machine' as Li described it, can rap in an "entertaining" way "but with limited success."

While it did show an understanding of slang terms, like with its ability to respond to the input "cash rules everything around me," from Wu-Tang Clan, with "better than Nicki Minaj.", as well some swearing skills, like answering the line "he opens his mouth, but the words won't come out," from Eminem, with "this is what the fuck you expect."

It is just like many human rappers out there, as the AI can also value its style over content.

"Occasionally it will rhyme if your sentence ends with a common word but most of the time it’s just a weirdo spitting out random sentences with a semi-rapper attitude," wrote Li in a blog post.

Li developed his AI with a different model to those used by the growing number of AI rappers.

What Li did, he created the system so it can generate rap lyrics using a transformer neural network, an architecture designed by Google Brain to deal with sequences in data.

Google explained Transformer as the "core of the leading approaches to language understanding tasks such as language modeling, machine translation and question answering."

The Transformer model is particularly useful for training AIs with language-related tasks, because the model can learn the relationship between each word in a sentence. Knowing this, Li suggests that the model can help its AI work out which words rhyme together, and ultimately produce a smooth flow.

Li created a dedicated website at https://rap-machine.appspot.com/ to showcase this AI.

Machine learning workflow
Machine learning workflow (Credit: Google)

AI cannot do anything from scratch. And how an AI can perform is only as good as the data it was trained with. The more where that came from should be better.

A rapping AI should naturally be trained on rap lyrics, and this is what Li did. And fortunately, the internet is already the world's biggest collection of song lyrics, so there should be no shortage of them.

To train his AI, Li collected around 180,000 lines of rap from 14 different artists. But that number was stripped down to 50,000 lyrics in order to "rhyme" with another line.

"The first line is the input and the second line is the output. Pairs of these sentences are then split into training and evaluation (90:10 split.) The Transformer architecture I used is mostly based on this Google Cloud Platform tutorial on generating poetry," Li explained.

Li then trained his model for 75,000 iterations.

This 'home project' of experimenting with different models and trial and error costed him a few hundred dollars.

Published: 
12/03/2020