A case study on Google Translate with Machine Learning.

Yagyandatta Murmu
5 min readOct 20, 2020

Machine learning capabilities are used by 68% of smartphone users every day, without even knowing how exactly they work. Although most people don’t realize the features constitute either. Frequently used AI-driven features include voice assistants, predictive text, and driving route suggestions and many more. In this post I have demonstrate Machine Translator and explained how the Google Translate using ML.

First, where did Google get all of its data? It crawls and saves text from about a trillion web pages. But how does it know what is human-translated text to run its statistical learning algorithms on? How did it get so good? Let’s Find out in this post .

If you ever tried learning any foreign language , you may have experienced the difficulty , because there are always a lot of exceptions to rules. It’s also not possible to learn all the languages . But now days that’s not a big problem anymore ,Google Translate can translate multiple forms of text and media, which includes text, speech, and text within still or moving images. Specifically, its functions include: Written Words Translation: a function that translates written words or text to a foreign language.

Google Translate is the world’s best-known free tool for machine translation. So far, 3.5 million people have made 90 million contributions through Translate Community, helping us improve and add new languages to Google Translate. A few properly translated sentences can make a huge difference when faced with a foreign language or country.

Originally Google Translate was released as a statistical machine translation service. Translating the required text into English before translating into the selected language was a mandatory step that it had to take. As of February 2010, it was integrated into browsers such as Chrome and was able to pronounce the text, automatically recognize words in the picture and spot unfamiliar text and languages.

In November 2016, Google transitioned its translating method to a system called neural machine translation. It uses deep learning techniques to translate whole sentences at a time, which it has measured to be more accurate between English and French, German, Spanish, and Chinese.

How Google translator using Neural Networks ?

Machine or we can say Automatic translation is perhaps one of the most difficult AI tasks given the fluidity of human language. Now Deep neural network models achieve state-of-the-art results in a field that is aptly named neural machine translation. It is an end-to-end learning approach for automated translation, with the potential to overcome many of the weaknesses of conventional phrase-based translation systems.

Recurrent Neural Network (RNN) :

LSTMs are a special kind of recurrent neural network (RNN), capable of learning long-term dependencies. All RNNs look like a chain of repeating modules.

Recurrent Neural Networks

In this image ,

  • x: The input. It can be a word in a sentence or some other type of sequential data
  • O: The output. For instance, what the network thinks the next word on a sentence should be given the previous words
  • h: The main block of the RNN. It contains the weights and the activation functions of the network
  • V: Represents the communication from one time-step to the other.

The folded and unfolded representations of the network in the picture are equivalent. It is sometimes useful to unfold the network to get a better understanding of what is happening at each step.

Long short-term memory (LSTM) and Gated Recurrent Unit (GRU)

LSTM -Block

The basic building block for RNN shown above suffers from some problems. One of the most important is the inability to retain information when the sequence given is long. It forgets information that was supplied several time-steps ago. That limits the learning performance. So people created some architectures to tackle that. The most popular are Long short-term memory (LSTM) and Gated Recurrent Unit (GRU)

GRU Block

These two are sibling architectures which are used in the great majority of applications. The distinction of these two with relation to the basic one is what the h block contains. I will not go in detail about each one, but the pictures below show the inner components of both LSTM and GRU.

But the challenge was NMT system are comparably more expensive also, most NMT system have difficulty with rare words . To solve these issue Google introduced GNMT( Google’s Neural Machine Translation ) system.

How GNMT Works ?

GNMT consists of a deep LSTM(Long short-term memory) network with 8 encoder and 8 decoder layers using attention and residual connections. To improve parallelism and therefore decrease training time.

Google’s attention mechanism connects the bottom layer of the decoder to the top layer of the encoder. To accelerate the final translation speed, they employ low-precision arithmetic during inference computations. To improve handling of rare words, they divide words into a limited set of common sub-word units for both input and output. This method provides a good balance between the flexibility of “character”-delimited models and the efficiency of “word”-delimited models, naturally handles translation of rare words, and ultimately improves the overall accuracy of the system. Google team search technique employs a length-normalization procedure and uses a coverage penalty, which encourages generation of an output sentence that is most likely to cover all the words in the source sentence. On the WMT’14 English-to-French and English-to-German benchmarks, GNMT achieves competitive results to state-of-the-art. Using a human side-by-side evaluation on a set of isolated simple sentences, it reduces translation errors by an average of 60% compared to Google’s phrase-based production system.

GNMT

Thank you for visiting me !!

--

--

Yagyandatta Murmu

Devops || MlOps || Flutter || Web Development || PYTHON || Data Science || AWS cloud || GCP || Azure