Semalt Advice On How To Use Deep Learning To Optimize Your Automated Title Tag



A quick way to take the lead in your SEO ranking is to include a top-ranking keyword in their title tag. And if you think about it for a minute, you will realize that it is indeed a smart solution. If you have a page that's already ranking for a keyword without that keyword being present in the title, imagine the significance of having the keyword in the title. You will naturally get indexed more often for that keyword; hence you rank better. 

Now, if we took that keyword and added it to your Meta Description, they will appear highlighted in search results meaning that more search engine users are likely to click. This, of course, will benefit the website. 

Imagine Semalt was working on a website with hundreds, thousands, or millions of pages. If we had to do this manually, it will be time-consuming and will get pretty expensive quickly. So how then can we analyze it page and optimize each Title and Meta description? The solution is to use a machine. By teaching a machine to find the highest-ranking keywords on each page, we save time and cost. Using a machine can end up performing better and faster than a data entry team. 

Let's reintroduce Uber's Ludwig and Google's T5

By combining Uber's Ludwig and Google's T5, you have a pretty powerful system.

In summary, Ludwig is an open-source auto ML tool which allows its users to train advanced models without having to write any code. 

Google T5, on the other hand, is a superior version of SERT-styled models. The T5 can summarize, translate, answer questions, and classify search queries as well as many other functions. In a nutshell, it is a very powerful model. 

However, there is no indication that T5 has been trained for title tag optimization. But maybe we can do that, and here is how: 
  • We get a trained dataset with examples made of:
    • Original title tags without our target keyword
    • Our target Keyword(s)
    • Optimized title tags with the target keywords
  • A T5 tunning code and tutorials to use 
  • Have a set of titles that haven't been optimized so that we can test our model
We will start up with a dataset that has already been created, and we will provide a guide on how we created the dataset. 

The authors of T5 were generous enough to provide us with a detailed Google Colab notebook, which we use to fine-tune T5. After spending time studying it, we were able to answer arbitrary trivia questions. The Colab notebook also has guidelines on how to fine-tune the T5 for new tasks. However, when you look at the code changes and the data preparation required, you find out it involves a lot of work and that our ideas may be perfect. 

But what if it could be simpler? Thanks to Uber Ludwig version 3, which was released a few months ago, we have a combination of some very useful features. The 3.0 version of Ludwig comes with: 
  • A hyperparameter optimization mechanism that derives additional performance from models. 
  • Code-free integration with Hugging Face's Transformers repository. This gives users access to updated models such as GPT-2, T5, DistilBERT, and Electra for natural language processing tasks. Some of such tasks include classification sentiment analysis, named entity recognition, question answering, and more. 
  • It is newer, faster, modular, and has a mores extensible backend that relies on TensorFlow 2. 
  • It provides support for many new data formats like Apache Parquet, TSV, and JSON. 
  • It has out of the box k-fold cross validation enablement.
  • When integrated with Weights and Biases, it can be used for managing and monitoring multiple model training processes. 
  • It has a new vector data type that supports noisy labels. That comes in handy if we are dealing with weak supervisions. 
There are several new features, but we find the integration to the Hugging Face's Transformers as one of the most useful features. Hugging face pipelines can be used to significantly improve the SEO efforts on titles and Meta description generation. 

Using pipeline is great to run predictions on models that are already trained and are already available in the model bub. However, there are currently no models that can do what we need them to do, so we combine Ludwig and Pipeline to create a formidable automatic title and Meta Description for every page on a website. 

How do we use Ludwig to Fine-Tune T5?

This is an important question as we try to show our clients exactly what goes on in the background of their website. Around here, there is a cliché that goes, "using Ludwig for training T5 is so simple, we should consider making it illegal." The truth is we would have been charging our clients much higher if we had to hire an AI engineer to do the equivalent. 

Here, you will find out just how we fine-tune T5. 
  • Step 1: open a new Google Colab notebook. After that, we change the Runtime to use GPU. 
  • We download the Hootsuite data set that has already been put together. 
  • We then install Ludwig.
  • After the installation, we load the training dataset into a pandas data frame and inspect it to see what it looks like. 
  • Then we face the most significant hurdle, which is creating the proper configuration file.  
Building the perfect system requires the documentation for T5 and constant trial and error until we get it right. (it would go a long way if you can find the Python code to produce here.)

Make sure to review the input and output features dictionaries and ensure that your settings are correctly picked up. If done right, Ludwig will begin using 't5-small' as the running model. For larger T5 models, it is easier to change in the model hub and potentially improve its generation. 

After training a model for several hours, we begin getting impressive validation accuracy. 

It is important that you note that Ludwig auto-selects other crucial text generation measurements, mainly perplexity and edit distance. These are both low numbers that fit in properly for us. 

How we use our trained models to optimize titles

Putting our models to test is the real interesting part. 

First, we download a test dataset with unoptimized Hootsuite titles that remained unseen by the model while in training. You will be able to preview the dataset using this command: 

!head

Hootsuite_titles_to_optimize.csv

It is very impressive that Ludwig and T5 can do so much with any small training set, and they require no advanced Hyperparameter tuning. The proper test comes down to how it interacts with our target keywords. How well does it blend?

Building a title tag optimization app with Streamlight

Content writers find this application most useful. Wouldn't it be amazing to have a simple to use app that doesn't require much technical knowledge? Well, that's just what Streamlight is here for. 

Its installation, as well as use, is quite straight forward. You can install it using:

!pip install streamline

We have created an app that leverages this model. When needed, we can run it from the same place where we train a model, or we can download an already trained model to where we plan on running the script. We have also prepared a CSV file with the titles and keywords we hope to optimize. 

Now we launch the app. In order to run the model, we need to provide the path to the CSV file, which has the titles and keywords we hope to optimize. The CSV column names must match the names while training Ludwig. If the model doesn't optimize all the titles, you shouldn't panic; getting a decent number right is also a great step forward. 

As experts in Python, we get very excited when working with this, as it usually gets our blood pumping. 

How to produce a custom dataset to train

Using Hootsuite titles, we can train models that would work well for our clients but may default for their competitors. That is why we ensure that we produce our own data set, and here is how we do that. 
  • We leverage our own data from Google Search Console or Bing Webmaster Tools. 
  • As an alternative, we can also pull our client's competition data from SEMrush, Moz, Ahrefs, etc. 
  • We then write a script for title tags and then split titles that do and do not have the target keyword. 
  • We take the titles that have been optimized using keywords and replace the keywords with synonyms, or we use other methods so that the title is "deoptimized."

Conclusion

Semalt is here to help you optimize your title tags as well as meta descriptions automatically. By doing so, you can remain ahead on SERP. Analysis of a website is never an easy task. That it why training a machine to help us do this not only saves cost, but it also saves time. 

At Semalt, there are professionals who will set up your dataset, Ludwig, and T5 so that you can stay winning always. 

Give us a call today.