A West Virginia teen taught himself how to build a rapping AI using Kanye West lyrics

Robbie Barrat
Robbie Barrat
Image: Robbie Barrat
We may earn a commission from links on this page.

Robbie Barrat started building AI on a bet.

His high school programming club was arguing about whether artificial intelligence could ever accomplish tasks better than humans. Barrat thought the answer was obvious. A few of his peers, however, weren’t so easily convinced and asked for proof by the club’s next meeting.

“All of the sudden I had a week to make a neural network that could rap,” Barrat said.

The next time the club met, he had done it.

Barrat’s story is possible because Silicon Valley has decided AI is becoming indispensable, and big companies need to cultivate more talent to fill the growing demand—Google, Facebook, Microsoft, IBM and other giants like GE are shelling out multi-million dollar salaries for AI programmers.

To upend the perceived shortage of talent, tech companies have begun to evangelize for open-source AI code, or software that’s free to use, modify, and improve upon. If it’s free to play with, and easy to learn about through communities working to improve the open source code, the assumption is that more people (and younger people) will start to get interested in working with AI.

In short, Silicon Valley is looking for people like Barrat.

Robbie Barrat
Robbie Barrat
Image: Robbie Barrat

Barrat, a 17-year-old who stresses that he’s growing up on a rural farm in West Virginia away from anything resembling a tech hub, taught himself how to code and build AI programs using entirely open-source software. His laptop runs Linux, an open-source operating system preferred by coders for its versatility, and he uses open-source machine learning library PyBrain to train his neural networks (though he’s figuring out how to use Google’s open-source TensorFlow). He’s read open-source textbooks.

The rapping AI was his first project, although he learned Python by building simple programs to do things like play Tic-Tac-Toe. Barrat says he ended up writing most of the original code in an afternoon, and spent the next few days optimizing the results. The most current iteration is trained on 6,000 Kanye West lines and can now generate speech that raps the words written by the AI, complete with semi-appropriate pauses.

“Originally it just rearranged existing rap lyrics, but now it can actually write word-by-word,” Barrat said.

He got the full AI-researcher experience when he realized his data wasn’t formatted correctly, causing the algorithm to spit out “garbage.” That’s when he learned that understanding what went wrong inside a neural network was tougher than he thought.

“We’ve got to figure out the way to make more transparent machine learning models,” Barrat said. “If we’re able to make progress into seeing into the thought process of a neural network, I think it’s going to teach us a lot about Go, or language, or the structures that we aren’t able to pick up on yet.”

But Barrat says it was really open-source that made his rapping AI possible. He wanted to build it, and Googling and downloading open software eventually let him figure it out.

Silicon Valley is still figuring out how to cultivate young talent. Google has a number of programs like Made with Code, meant to encourage and mentor teen girls to work in tech, and Google’s CS First initiative works to help build coding clubs within schools. Facebook built a site called TechPrep, which uses an easy series of questions to connect kids and adults to free coding courses online. Microsoft has free Hour of Code camps at Microsoft Stores, where children can learn how to code using Minecraft. Microsoft also uses its stores as base camps for kid-friendly camps and coding classes.

But for all their efforts, there is still a major deficit of coding talent: 2015 numbers indicate there are 10 times as many computing jobs open than there were graduates with computer science degrees. And even after students get a degree in computer science, only two-thirds actually stay in the field.

Barrat isn’t sure that he’ll go on to work in tech—he still loves pure math. But for now, the ability to work with AI for creative projects is fun after he gets home from school.

“It’s not like I’m being assigned these for school, it’s just that I like to work on projects that incorporate math, computer science, and more artistic elements,” Barrat said. “I got a neural network to write piano melodies. I’ve been trying to get [neural networks] to generate abstract art. I don’t know if you can call teaching a neural network to make rap songs artistic, but I like to think that you can.”