In 1964, the Beatles released their iconic song “I Want to Hold Your Hand”. Since then, the Fab Four have become one of the most influential bands in music history. Now, fifty years later, you can generate your own Beatles lyrics using AI. In recent years, artificial intelligence (AI) has made significant advances in the field of natural language processing (NLP), which has resulted in the development of AI systems that can generate human-like text. One application of this technology is the generation of text and music lyrics using AI.AI-generated text is not just a gimmick; it has a variety of applications in the real world. For example, AI can be used to generate product descriptions, blog posts, and even music lyrics. In this article, we’ll take a look at how AI can be used to generate text, with a focus on music lyrics.
Human or machine generated text
This is actually the first paragraph we wrote ourselves. The text above was all written by an algorithm called GPT-3 by Open AI by instructing it to write an article about generating text for Beatles songs. With the recent release of Chat-GPT the introduction of this article can even be improved. Over the last 20 years, text analytics has really taken off (as the AI already said). Where 20 years ago analyzing your customer satisfaction research using word counts was state of the art, and google translate was completely literal, and therefore often nonsensical, nowadays it actually gives you valid output. Text analytics on customer satisfaction surveys or reviews can now help you derive the drivers and the sentiment of your customers. That way you can really improve your satisfaction or NPS by identifying actionable insights. You can train your chatbot by having it read all your F.A.Q.’s and help pages. This will improve the relevance of the answers the chatbot is giving to its users.
In terms of text generation, have you noticed how good Whatsapp can predict what you are typing? Or how accurate the suggestions of Outlook are on how to respond to your email? With its foundation in deep learning algorithms and its increasing computing power text generation has really taken a flight in the last 5 years. This has been driven in part by the development of neural networks, which are a type of AI that is designed to mimic the way the human brain learns. With this technique we trained an algorithm to speak “Beatle”. Based on an input prompt, it creates Beatles lyrics for you, complete with a title and cover. Curious what this looks like? Take a look at the following example below or try it yourself:
Showcase our demo on Hugging Face spaces
Using Hugging Face, a datascience platform and community that provides many integrated tools to build, train or deploy models based on open-source code, we fine-tuned a pre-trained model to behave “Beatles-like” with some additional training on the original Beatles lyrics. Besides that, a pre-trained summarization model is used to create a matching title. And finally, a deep learning, text-to-image model is used to create the song cover. We demo the result of our efforts in a Hugging Face Space. These spaces are integrated with Gradio, a tool that wraps a python function so it can be launched almost anywhere: a jupyter notebook, a colab notebook, on your own website or hosted on a Hugging Face Space.
Evaluate our model
All of us are by no means ‘Professors in Beatleness’. To judge to what extent our model to generate Beatly lyrics is any good, we’ve set up an evaluation plan. Evaluating NLG models is not that obvious: There is no ‘ground truth’ to compare the generated lyric with. In our blog on evaluating NLG models, we explain different methods to evaluate these types of models. And we apply some of them to our own lyrics. Our approach is twofold: use popular metrics to evaluate NLG models and ask Beatles fans their honest opinion on our ‘Beatly’ (or not so ‘Beatly’) lyrics.
This evaluation results in some interesting insights: Popular evaluation metrics indicate that our model is performing quite well. Both BLEURT and BERT-score reported an f-score higher than 0.7 which indicates that the generation quality of our songs was decent. However, we also asked a critical crowd of Beatles fans what they think of the lyrics we generated. Based on their input it was less evident that the generated songs are that Beatly because of good evaluation metrics. This shows that human judgement is still important as well, as they pointed out to us that some lines in the generated songs literally come from original Beatles songs. In general, the reviewers were not that convinced that AI is ready to replace their beloved Beatles. Of course, we do have to take into account that real Beatles fans are less prone to agree their heroes are actually replaceable, so some bias might be presented there as well. To conclude, AI is able to do impressive things, also in the domain of generating texts. When you have a use case to create a natural language generation model of your own, we hope our series inspires you how to approach this. It shows how you can benefit from Huggingface’s great repo and spaces to host your model so you can enable others to test and use your model. And we’ve shown how different evaluation approaches can and need to be used to get a good view of the quality of your NLG solution.