Skip to content

Commit 5545a35

Browse files
committed
master: NMT with attention - basics.
1 parent d3b06c8 commit 5545a35

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Neural Machine Translation (NMT)
2+
3+
## Basic Seq-to-Seq Model
4+
5+
In NMT, we use an encoder and a decoder to translate from one language to another. An encoder decoder architecture looks like this:
6+
<br><br>
7+
It takes in a hidden states and a string of words, such as a single sentence. The encoder takes the inputs one step at a time, collects information for that piece of inputs, then moves it forward. The orange rectangle represents the encoders final hidden states, which tries to capture all the information collected from each input step, before feeding it to the decoder. This final hidden state provides the initial states for the decoder to begin predicting the sequence.
8+
9+
<img src="./images/1. basic seq-to-seq model.png"><img> <br><br>
10+
11+
### Limitation of a basic Seq-to-Seq Model
12+
13+
One major limitation of a basic seq-to-seq model is *information bottle-neck* represented by the figure below:
14+
<img src="./images/2.NMT basic model.png"><img> <br><br>
15+
16+
In case of long sequences of sentences, when the end-user stacks up multiple layers of words, words that are entered at a later stage are given more importance than the words that were entered first.<br><br>
17+
Because the encoder hidden states is of a fixed size, and longer inputs become *bottlenecked* on their way to the decoder.
18+
19+
Hence, inputs that contain short sentences will work for NMT but long sentences may not work for a basic seq-to-seq model.
243 KB
Loading
211 KB
Loading

0 commit comments

Comments
 (0)