Hi,

This week you'll learn about Neural Machine Translation with Bahdanau's Attention Using TensorFlow and Keras.

Image

It is the year 3000. You are a scientist at NASA, stationed on Mars. Space travel is very much possible, with humanity able to traverse galaxies at a time. You look at your very own Galaxy Traveler x270 spacecraft. Everybody has one of these nowadays. Just the other day, your 15-year-old niece came to meet you from two galaxies away. 

These grand peaks of development reached by humanity make you think how important the first step was. The reason why you can travel through space is that humanity figured out the principles of rocket science. It may have started with a small model rocket built in a backyard, but scaling up the same science took us to the moon. 

Now, you might wonder what rockets have to do with our topic today: Neural Machine Translation. You see, if we compare the perspectives, Neural Machine Translation, or Attention, is our backyard model rocket. The futuristic galaxy-traveling spaceship becomes Transformer language models. 

To understand the beauty of Transformers, it is essential to understand the foundational blocks of the concept, that is, Attention. 

Today's blog studies Neural Machine Translation with Bahdanau's Attention.

The big picture: Following up on last week's tutorial, we have the first approach to attention under the microscope: Bahdanau's Attention. It is a content-based attention mechanism that attends to the most relevant parts of the input sequence based on the current decoder state.

How it works: Also known as additive attention, we calculate the dependencies and alignment of input to the output. Bahdanau's Attention uses a single-layer feedforward network to calculate the alignment scores. 

Our thoughts: Bahdanau's Attention is great at building dependencies between input and output, consequently giving us high accuracy. 

Yes, but: High accuracy doesn't necessarily translate to higher efficiency. Hence, Bahdanau's Attention isn't flawless, despite its beautiful results. 

Stay smart: Look out for our next tutorial in this series, encompassing another variant of attention, known as Luong's Attention. Both these methods are great, and it's important to understand where exactly they differ. 

Click here to read the full tutorial

Solve Your CV/DL problem this week (or weekend) with our Working Code

You can instantly access all of the code for Neural Machine Translation with Bahdanau's Attention Using TensorFlow and Keras by joining PyImageSearch University. Get working code to

  1. Finish your project this weekend with our code
  2. Solve your thorniest coding problems at work this week to show off your expertise
  3. Publish groundbreaking research without multiple tries at coding the hard parts

Guaranteed Results: If you haven't accomplished your CV/DL goals, let us know within 30 days and get a full refund.

Yes, I want the code

Note: You may have missed this, but last Wednesday, we published a new post on Multi-Task Learning and HydraNets with PyTorch.

In Case You Missed It

We were live earlier this month.  Did you miss it?  

No problem, watch the replay and learn NMT

Image
 

Your PyImageSearch Team