Automatic Blog Post Generation with GPT-J

What is Blog Post Generation and Why Use GPT-J?

Blog post generation is about getting AI to automatically write a blog article for you. Simply give a couple of instructions to the AI and it will write a whole blog post for you that is both relevant and fluent. You can even automatically generate blog posts with the proper HTML formatting (headings, subheadings, etc.). GPT-J is perfectly suited for this task because it is very good at understanding your requirements and at generating complex content based on this, in many languages. This is pure original content so there is no risk of duplicated content.

For example ask the following: generate a blog article about a text classification API. The AI model could return something like this:

<h1>Text Classification API</h1>
<h2>What is Text Classification?</h2>
<p>Text classification is the process of categorizing a block of text based on one or several labels. Let's say you have the following block of text: Perseverance is just getting started, and already has provided some of the most iconic visuals in space exploration history. It reinforces the remarkable level of engineering and precision that is required to build and fly a vehicle to the Red Planet. Let's also say that you also have the following labels: space, science, and food. Now the question is: which ones of these labels apply best to this block of text? Answer is space and science of course.</p>
<h2>Text Classification with Hugging Face Transformers.</h2>
<p>Hugging Face transformers is an amazing library that has been recently released. It is based on either PyTorch or TensorFlow, depending on the model you're using. Transformers have clearly helped deep learning NLP make great progress in terms of accuracy. However this accuracy improvement comes at a cost: transformers are extremely demanding in terms of resources.</p>

You could also pass specific keywords that you want to be included in your blog article. Or on the contrary you can explicitly specify keywords that you don't want to see in the final blog post.

The length of the article, its structure, and the generated content itself, will radically depend on the instructions you pass to the AI.

GPT-J is the most advanced open-source NLP model as of this writing, and this is the best alternative to GPT-3 for full blog post generation, without restrictions. This model is so big that it can adapt to many situations, and behave like a real content writer. For advanced use cases, it is possible to fine-tune GPT-J (train it with your own data), which is a great way to perform more advanced article generation that is perfectly tailored to your company or industry.

Automatic blog post generation

Why Use Automatic Blog Post Generation?

Content creation is at the heart of every marketing and SEO strategies today, but producing quality content on a regular basis can be tedious and very costly. Here are a couple of examples about how you could leverage blog post generation:

Feed a Corporate Blog

So many corporate blogs stop being maintained after a couple of articles because it's too much work. This is bad for SEO but it also gives a bad impression to visitors. Thanks to automatic content writing, you can easily write a couple of articles per week in a couple of minutes that rank very well on Google.

Multilingual Marketing

Writing articles in non-English languages is often a good strategy to rank on competitive keywords, but of course writing multilingual content is hard... You can now easily do it thanks to GPT-J.

Performing Blog Post Generation with GPT-J

In order to make the most of GPT-J, it is crucial to have in mind the so-called few-shot learning technique: by giving only a couple of examples to the AI, it is possible to dramatically improve the relevancy of the results, without even training a dedicated AI.

Sometimes, few-shot learning is not enough (for example if you are in a specific industry that needs advanced vocabulary). In that case, the best solution is to fine-tune (train) GPT-J with your own data.

Building an inference API for blog post generation based on GPT-J is a necessary step as soon a you want to use blog post generation in production. But building such an API is hard... First because you need to code the API (easy part) but also because you need to build a highly available, fast, and scalable infrastructure to serve your models behind the hood (hardest part). It is especially hard for machine learning models as they consume a lot of resources (memory, disk space, CPU, GPU...).

Such an API is interesting because it is completely decoupled from the rest of your stack (microservice architecture), so you can easily scale it independently, and you can access it using any programming language. Most machine learning frameworks are developed in Python, but it's likely that you want to access them from other languages like Javascript, Go, Ruby...

NLP Cloud's Article Generation API

NLP Cloud proposes an article generation API based on GPT-J that gives you the opportunity to perform automatic blog post generation out of the box, with breathtaking results. If the base GPT-J model is not enough, you can also fine-tune/train GPT-J on NLP Cloud and automatically deploy the new model to production with only one click.

For more details, see our documentation about text generation with GPT-J. Also see our few-shot learning example dedicated to blog post generation and easily test GPT-J generation on our playground.