Understanding Seq2Seq Neural Networks – Part 2: Embeddings for Sequence Inputs
Source: Dev.to

Recap of Part 1
In the previous article we introduced the sequence‑to‑sequence (Seq2Seq) problem and discussed how to handle variable‑length inputs and outputs.
Handling Variable‑Length Sequences with LSTM
We already know how to use Long Short‑Term Memory (LSTM) units for this purpose.
For example, given the input sentence “Let’s go”:
- Feed “Let’s” into the LSTM.
- Unroll the LSTM and feed “go” as the second input.

Embedding Layer for Sequence Inputs
We can’t feed raw words directly into a neural network. Instead, we use an embedding layer to convert each word into a numeric vector.

Vocabulary and Tokens
To keep the example simple, the English vocabulary for our Encoder–Decoder model contains only three words:
- “Let’s”
- “to”
- “go”
It also includes the EOS (End‑of‑Sentence) symbol. Because the vocabulary mixes words and symbols, each element is referred to as a token.
For illustration, we assign two embedding dimensions per token (instead of the typical hundreds or thousands).
Next Steps
Now that we have an embedding layer for the input vocabulary, the next step is to connect it to the LSTM. We’ll explore that in the next article.
Sponsored: Installerpedia
Looking for an easier way to install tools, libraries, or entire repositories?
Try Installerpedia, a community‑driven, structured installation platform that lets you install almost anything with minimal hassle and clear, reliable guidance.
ipm install repo-name
🔗 Explore Installerpedia here: https://hexmos.com/freedevtools/installerpedia/