Understanding Seq2Seq Neural Networks – Part 2: Embeddings for Sequence Inputs

Published: (March 14, 2026 at 05:10 PM EDT)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for Understanding Seq2Seq Neural Networks – Part 2: Embeddings for Sequence Inputs

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”:

  1. Feed “Let’s” into the LSTM.
  2. Unroll the LSTM and feed “go” as the second input.

LSTM unrolling example

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.

Embedding layer illustration

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.

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

Installerpedia Screenshot

🔗 Explore Installerpedia here: https://hexmos.com/freedevtools/installerpedia/

0 views
Back to Blog

Related posts

Read more »

Visual Introduction to PyTorch

PyTorch is currently one of the most popular deep learning frameworks. It is an open‑source library built upon the Torch library. Most tutorials assume you're c...

Tokens - the Language of AI

markdown !Comparison of human language and LLM tokenshttps://media2.dev.to/dynamic/image/width=800,height=,fit=scale-down,gravity=auto,format=auto/https%3A%2F%2...