<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vishwajeet Pratap Singh</title>
    <description>The latest articles on DEV Community by Vishwajeet Pratap Singh (@vpsingh22).</description>
    <link>https://dev.to/vpsingh22</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F524962%2F5620d07c-a9d3-4dd0-86c3-2e5735f35b07.jpeg</url>
      <title>DEV Community: Vishwajeet Pratap Singh</title>
      <link>https://dev.to/vpsingh22</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vpsingh22"/>
    <language>en</language>
    <item>
      <title>Detailed Explanation to 'Attention is all you need' </title>
      <dc:creator>Vishwajeet Pratap Singh</dc:creator>
      <pubDate>Thu, 04 Feb 2021 18:45:50 +0000</pubDate>
      <link>https://dev.to/vpsingh22/detailed-explanation-to-attention-is-all-you-need-1ff4</link>
      <guid>https://dev.to/vpsingh22/detailed-explanation-to-attention-is-all-you-need-1ff4</guid>
      <description>&lt;p&gt;This blog is an attempted explanation to paper &lt;b&gt;Attention is all you need&lt;/b&gt;. You can find the paper &lt;a href="https://arxiv.org/pdf/1706.03762.pdf" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the source code &lt;a href="https://github.com/vpsingh22/END/blob/main/12%20-%20Attention%20is%20all%20you%20need/Attention_is_all_you_need.ipynb" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;RNNs and CNNs have been used dominantly in sequence to sequence tasks, but the use of attention has proved much better results.&lt;/p&gt;

&lt;p&gt;Here we will focus on self-attention where we essentially find the co-relation between the embeddings of a sequence.&lt;br&gt;
But, Before moving to the attention part, lets take a look at word-embeddings.&lt;/p&gt;

&lt;p&gt;&lt;b&gt; Word Embedding &lt;/b&gt; is a vector representation of a particular word. So, even for words representing multiple meanings the embedding is same. &lt;br&gt;
For example words like - apple - it could be a fruit or name of a company.&lt;br&gt;
The embedding would be same for both the meanings. Lets assume that the embedding representing 'apple' is a 50 dimension vector represented below:&lt;br&gt;
[0.2, -0.7, 0.6 ... 0.1. 0.3]&lt;br&gt;
What could this vector possibly represent ?&lt;/p&gt;

&lt;p&gt;The values in the vector represent concepts, the value at 'index 1' may represent the concept of a fruit and then the values at 35th index may represent something related to electronics or may be a combination of multiple indices represent such concepts.&lt;/p&gt;

&lt;p&gt;When RNNs and CNNs were used the neural networks couldn't decide which concepts to focus on. This is where self attention makes the difference and is able to find the corelation between concepts.&lt;/p&gt;

&lt;p&gt;For example - if the network encounters a sequence 'apple iphone' then it is able to identify the context of an electronic device, and if it encounters something as 'apple pie' then it catches the context of something eatable.&lt;/p&gt;

&lt;p&gt;Lets look at the architecture of the network. In the paper they train the network for machine translation.&lt;br&gt;
The network is an encoder decoder architecture which uses attention layers or we can say blocks.&lt;br&gt;
We will look into each block one by one.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwzsvp3degro6qb89wmiw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwzsvp3degro6qb89wmiw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The left and right blocks represent the encoder and decoder respectively.&lt;/p&gt;

&lt;p&gt;Let's study at the encoder first.&lt;/p&gt;

&lt;p&gt;&lt;b&gt; Encoder &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flxu3wcyl5eai5bzrh1ap.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flxu3wcyl5eai5bzrh1ap.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The input to the encoder is the source sentence. The source is converted to a embedding.&lt;/li&gt;
&lt;li&gt;The embedding is concatenated with positional encoding. Lets call this as input embedding.&lt;/li&gt;
&lt;li&gt;The input embedding is passed to three different fully connected layers and the three outputs are passed to the multi-head attention block. (We will learn attention and then multi-head attention in detail)&lt;/li&gt;
&lt;li&gt;These outputs are named query, key and value. Using three different fully connected layers proved to give better result as compared to using a single fully connected layer and repeating its output thrice.&lt;/li&gt;
&lt;li&gt;We add the input embedding to the output of multi head attention layers as a skip connection and normalize the sum.&lt;/li&gt;
&lt;li&gt;We pass this output to a feed forward layer which is literally fully connected layers. We again add skip connection and normalize the output before calling it as encoder output.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's essentially the work of the encoder. Now lets look at the attention mechanism.&lt;/p&gt;

&lt;p&gt;&lt;b&gt; Self-Attention &lt;/b&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9hya2q7cykppioqedhnk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9hya2q7cykppioqedhnk.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's take an example of input sequence - 'walk by river bank'. As discussed earlier the embeddings contain concepts for various meanings. Here the bank embedding is related to river bank. Lets see how self attention identifies the context. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The input to the attention is query, key and value as discussed. &lt;/li&gt;
&lt;li&gt;&lt;b&gt; Note : the input embedding is passed to three fc layers. That is not shown in the diagram above for simplicity. &lt;/b&gt;&lt;/li&gt;
&lt;li&gt;The embedding in the diagram are some N dimensional vector.&lt;/li&gt;
&lt;li&gt;The first thing attention does is to find the corelation between embeddings.  If the embeddings relate to similar concepts the corelation value is higher otherwise lower.&lt;/li&gt;
&lt;li&gt;We take the query and key which are essentially the same, and find the corelation between every pair of words.&lt;/li&gt;
&lt;li&gt;This gives us a square matrix which has the corelation value. The square matrix is result of matrix multiplication of the query and key.&lt;/li&gt;
&lt;li&gt;Here we will see that the words which are conceptually related will have higher value. For example the word 'river' and 'bank' are somehow related to a concept of water body.
The dimension which represent the context of a water body will multiply and contribute to higher corelation value.&lt;/li&gt;
&lt;li&gt;Then we take the column wise softmax so that network focuses more on required concepts. It makes the bright blocks brighter and the dark blocks darker.&lt;/li&gt;
&lt;li&gt;Every time we scale or normalize we do so to prevent the issue of exploding gradients.&lt;/li&gt;
&lt;li&gt;The value is then multiplied with the corelation matrix to output the contexualized embedding. &lt;/li&gt;
&lt;li&gt;This contexulized embedding is different from the input as we can see the embeddings now just dont represent just their own concepts but also focus on similar words which share the same concepts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is called as self attention.&lt;/p&gt;

&lt;p&gt;Now lets take a look at multi-head attention layer. This would be more intuitive now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F37e33rg5934fzzkmvp5i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F37e33rg5934fzzkmvp5i.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It has the same mechanism, what we did above, just that the input embedding is divided into multiple equal size blocks which are called head.&lt;/li&gt;
&lt;li&gt;This is done so that the network focuses more on the concepts which are required. The head which focuses on concepts that do not contributes is suppressed by the network.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now you may read again the encoder part to have a better understanding of the entire flow.&lt;/p&gt;

&lt;p&gt;&lt;b&gt; Decoder &lt;/b&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0vu24rfs7n9890hl9vsi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0vu24rfs7n9890hl9vsi.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The decoder is almost similar to the encoder with the major difference that it has one more multi-head attention layer which takes input from the encoder.&lt;/li&gt;
&lt;li&gt;The input to the decoder is target sentence. &lt;/li&gt;
&lt;li&gt;The steps are same what we did earlier in encoder.&lt;/li&gt;
&lt;li&gt;In the multi-head attention layer we only consider the lower triangle of the corelation matrix, because we dont want the network to see learn the concepts of the next word of the sequence, because that is what we want the network to predict. Think again on this part to have a better understanding.&lt;/li&gt;
&lt;li&gt;In the next multihead attention layer the input is the encoder key, encoder value and the target is used as query.&lt;/li&gt;
&lt;li&gt;This output is passed to fully connected layers to as we did in encoder. This is basically to increase the capacity of the network.&lt;/li&gt;
&lt;li&gt;Finally predictions are made by passing through the softmax layer.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>transformer</category>
      <category>attention</category>
      <category>nlp</category>
      <category>machinetranslation</category>
    </item>
    <item>
      <title>Convolutions in Sequence to Sequence networks</title>
      <dc:creator>Vishwajeet Pratap Singh</dc:creator>
      <pubDate>Thu, 28 Jan 2021 21:27:46 +0000</pubDate>
      <link>https://dev.to/vpsingh22/convolutions-in-sequence-to-sequence-networks-o7j</link>
      <guid>https://dev.to/vpsingh22/convolutions-in-sequence-to-sequence-networks-o7j</guid>
      <description>&lt;p&gt;Sequence to Sequence networks often use RNNs and its derivatives along with attention to solve problems in machine translation, question-answer models, text sumarization etc.&lt;/p&gt;

&lt;p&gt;Solving the same problems using convolutions proved better results. Here we will take a deep dive into how to design a convolutional sequence to sequence network.&lt;/p&gt;

&lt;p&gt;You can find the source code &lt;a href="https://github.com/vpsingh22/END/blob/main/11%20-%20Convolutional%20SeqtoSeq/Convolutional_Seqtoseq.ipynb" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Lets get started.&lt;/p&gt;

&lt;p&gt;The networks uses encoder decoder architecture along with attention.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzgzp5xqmiyj7qt8ykk4g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzgzp5xqmiyj7qt8ykk4g.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The components of the models are -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encoder&lt;/li&gt;
&lt;li&gt;Decoder&lt;/li&gt;
&lt;li&gt;Attention Block
Lets see them one by one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But before moving into these lets see how convolution works here.&lt;/p&gt;

&lt;p&gt;In RNNs we would take a hidden state or a context vector from the previous time step, but that only makes the model cram the next word for a given sequence has catches very less contextual information or contextual relation between the words.&lt;/p&gt;

&lt;p&gt;On the other hand CNNs try to capture the spatial information hidden between the within the sentences.&lt;br&gt;
The model gets trained such a way that each dimensions of embedding store a certain concepts within itself.&lt;br&gt;
For example lets say we have a 256 dim embedding and we are given two sentences.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I am using apple.&lt;/li&gt;
&lt;li&gt;I am eating apple.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here we see that the first sentence has a context of a device and second has a context of an edible item.&lt;br&gt;
When convolutions run between the embeddings of 'using apple' and 'eating apple' they try to capture their respective contexts (with the help of attention)&lt;br&gt;
Lets assume the 50th dim of embedding has the context of a device and 100th dim has the context of an edible. The attention will only weight them if the context matches and therefore the model learns better.&lt;/p&gt;

&lt;p&gt;Now lets move the encoder.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Encoder&lt;b&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F67ttu1tdwnlxdjhpx66b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F67ttu1tdwnlxdjhpx66b.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, we pad the sentence from both ends.&lt;/li&gt;
&lt;li&gt;The encoder takes the token embedding along with the positional embedding and then performs their elements wise sum.&lt;/li&gt;
&lt;li&gt;This is now fed to a Fully connected layers to convert into a desired embedding. The output of FC layer is fed to the convolutional blocks.&lt;/li&gt;
&lt;li&gt;The output of the convolutional blocks is now again passed into a FC layer.&lt;/li&gt;
&lt;li&gt;Here we add a skip connection with the elementwise sum output ( positional and token embedding) to give a final output. This is called conved ouput.&lt;/li&gt;
&lt;li&gt;We send two outputs to the decoder. One is conved output and other is combined output(conved + embedded). &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Encoder Convolution Blocks&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5w9bsyspnqkrb3tx3p9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5w9bsyspnqkrb3tx3p9t.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The input to the convolution blocks is embedding of the length of the sentence.&lt;/li&gt;
&lt;li&gt;We use a odd sized kernel and pad the inputs at each convolution.&lt;/li&gt;
&lt;li&gt;We use GLU activation function.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;Decoder&lt;b&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftivkjyv3xg8u9x3sxkb9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftivkjyv3xg8u9x3sxkb9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The text input to the decoder is similar to the encoder. We take element wise sum of the token and positional embeddings.&lt;/li&gt;
&lt;li&gt;This sum is passed to a FC layer and further passed to the convolutional blocks.&lt;/li&gt;
&lt;li&gt;This time the convolutional blocks accept the elementwise sum as skip connection and also the conved output and combined output from the encoder.&lt;/li&gt;
&lt;li&gt;The output of the convolutional block is again to a FC layer and then sent out to make the predictions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Decoder Convolutional blocks.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqbqqjzknd9rnjogenunr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqbqqjzknd9rnjogenunr.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
The difference in decoder convolutional block is that the input is padded twice at the front. &lt;br&gt;
The logic behind this is straightforward that we are using a kernel of size 3 and padding the sentence before the  token prevents the decoder from catching the context of the next prediction. Not using this will fail the decoder from learning.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Attention&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;The attention module is used to calculate weight of the features so that the models is able to focus on the necessary features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The module takes the conved output from the encoder and combined embedded output from the decoder and performs a weighted sum over them.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>attention</category>
      <category>convolution</category>
      <category>seqtoseq</category>
      <category>machinetranslation</category>
    </item>
    <item>
      <title>Understanding LSTMs, GRUs and Attention Blocks</title>
      <dc:creator>Vishwajeet Pratap Singh</dc:creator>
      <pubDate>Fri, 04 Dec 2020 00:24:27 +0000</pubDate>
      <link>https://dev.to/vpsingh22/understanding-lstms-grus-and-attention-blocks-308c</link>
      <guid>https://dev.to/vpsingh22/understanding-lstms-grus-and-attention-blocks-308c</guid>
      <description>&lt;p&gt;Traditional neural networks failed when it comes to handling sequence problems, because they didn't have memory. To resolve this issue the concept of RNNs (Recurrent Neural Networks were introduced). RNNs are simply a fully connected layer with a loop.&lt;/p&gt;

&lt;p&gt;But, RNNs are so poor at handling long-term dependencies that they practically fail for large sentences.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;LSTMs&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;This issue was addressed by LSTM (Long Short Term Memory) networks. LSTMs are special RNNs but can remember long-term dependencies.&lt;/p&gt;

&lt;p&gt;Their flow is similar to RNNs but the difference is in the LSTM cells. &lt;/p&gt;

&lt;p&gt;LSTM has certain layers that help in maintaining the memory of these networks.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Forget gate - This layer forgets the immediate information required to maintain the long-term dependency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Input gate - This helps decide what new information is to be added to the context vector.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Update gate - Again adds the new information which was removed in the last steps.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Output gate - The output gate provides the new hidden state vector.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;b&gt;GRU&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;GRU (Gater Recurrent Unit) is a variant of LSTM and has following modifications.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It combines the forget and input gates into a single "update gate".&lt;/li&gt;
&lt;li&gt;It also merges the cell state and hidden state&lt;/li&gt;
&lt;li&gt;It updates the memory twice, the first time (using old state and new input, called Reset Gate) and the second time (as final output). &lt;/li&gt;
&lt;li&gt;Old cell state or hidden state (with input) is used for its own update as well as for deciding &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt; Attention in Encoder-Decoder Architecture &lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;When we talk about sequence-to-sequence models they consist of encoder-decoder architecture. The encoder processes each item, compiles it into a vector (also called as context) and passes it to the decoder. The decoder then produces the output sequence. The issue with these models is that the context vector is a bottleneck for them.&lt;/p&gt;

&lt;p&gt;Attention models handles this issue. The encoder passes all the hidden states to the decoder instead of passing the last hidden state.&lt;br&gt;
Also the decoder multiplies the hidden state to a softmax score as a weight of the hidden state so that the scores are amplified which have high score and the hidden states with low scores are diminished.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
