Skip to main content

Sequence Networks

Sequence Networks Explained

Sequence Networks

Sequence networks can have either input as sequence, output as sequence, or both. We categorize them into three main types:

  1. Vec2Seq
  2. Seq2Vec
  3. Seq2Seq

1. Vec2Seq (Sequence Generation)

$$ f_{\theta}:\mathbb{R}^{D}\to\mathbb{R}^{N_{\infty}\cdot C} $$
$$ p(y_{1:T}|x)=\sum_{h_{1:T}}p(y_{1:T},h_{1:T}|x)=\sum_{h_{1:T}}\prod_{t=1}^{T}p(y_{t}|h_{t})p(h_{t}|h_{t-1},y_{t-1},x) $$
Notation:
\(h_t\): hidden state at time \(t\)
\(p(h_1|h_0,y_0,x) = p(h_1|x)\): initial hidden state distribution

For categorical and real-valued outputs:

$$ p(y_t|h_t) = \text{Cat}(y_t | \text{softmax}(W_{hy} h_t + b_y)) $$
$$ p(y_t|h_t) = \mathcal{N}(y_t | W_{hy} h_t + b_y, \sigma^2 I) $$
This generative model is called a Recurrent Neural Network (RNN).

2. Seq2Vec (Sequence Classification)

$$ f_{\theta}:\mathbb{R}^{T D} \to \mathbb{R}^{C} $$

Output is a class label: \(y \in \{1, \dots, C\}\)

$$ p(y|x_{1:T}) = \text{Cat}(y | \text{softmax}(W h_T)) $$

Better results are obtained if hidden states depend on both past and future context, giving rise to Bidirectional RNNs:

$$ h_t^{\rightarrow} = \varphi(W_{xh}^{\rightarrow} x_t + W_{hh}^{\rightarrow} h_{t-1}^{\rightarrow} + b_h^{\rightarrow}) $$
$$ h_t^{\leftarrow} = \varphi(W_{xh}^{\leftarrow} x_t + W_{hh}^{\leftarrow} h_{t+1}^{\leftarrow} + b_h^{\leftarrow}) $$
$$ h_t = [h_t^{\rightarrow}, h_t^{\leftarrow}] $$

3. Seq2Seq (Sequence-to-Sequence Models)

Maps input sequence \(x_{1:T}\) to output sequence \(y_{1:T'}\). Commonly implemented using RNN encoder-decoder, LSTM, GRU, or Transformer architectures.

$$ p(y_{1:T'}|x_{1:T}) = \prod_{t=1}^{T'} p(y_t | y_{< t}, x_{1:T}) $$
Notation:
\(x_{1:T}\): input sequence of length \(T\)
\(y_{1:T'}\): output sequence of length \(T'\)
\(y_{< t}\): previously generated tokens

Seq2Seq models are widely used in machine translation, text summarization, and speech recognition.

Comments

Popular posts from this blog

The Mathematics Behind AGI: Foundational Concepts and the Road Ahead

The Mathematics Behind AGI: Foundational Concepts and the Road Ahead The Mathematics Behind AGI: Foundational Concepts and the Road Ahead I want to be upfront about something before we start. Nobody fully knows what AGI is going to look like, how it will be built, or whether the mathematical frameworks we have today are even the right ones. What we do have is a collection of deep, beautiful, and sometimes frustrating mathematical ideas that seem to point in the right direction. This blog is my attempt to trace those ideas — not as a checklist of solved problems, but as an honest map of where the thinking currently is. Some of this math is a century old. Some of it was written in the last decade. All of it is incomplete in one way or another when it comes to AGI. That tension is what makes this field interesting. 1. What is AGI, Formally? Before building something, it helps to define it. For most of AI history, nobody really tried to define intelligence ...

LeJEPA: Predictive Learning With Isotropic Latent Spaces

LeJEPA: Predictive World Models Through Latent Space Prediction LeJEPA: Predictive Learning With Isotropic Latent Spaces Self-supervised learning methods such as MAE, SimCLR, BYOL, DINO, and iBOT all attempt to learn useful representations by predicting missing information. Most of them reconstruct pixels or perform contrastive matching, which forces models to learn low-level details that are irrelevant for semantic understanding. LeJEPA approaches representation learning differently: Instead of reconstructing pixels, the model predicts latent representations of the input, and those representations are regularized to live in a well-conditioned, isotropic space. These animations demonstrate LeJEPA’s ability to predict future latent representations for different types of motion. The first animation shows a dog moving through a scene, highlighting semantic dynamics and object consisten...

MobileNet Backbone Versions: Designing Efficient CNNs for Real-World Deployment

MobileNet Backbone Architecture Versions MobileNet Backbone Versions: Designing Efficient CNNs for Real-World Deployment MobileNet is a family of efficient convolutional neural networks designed for real-time inference on resource-constrained devices such as smartphones, drones, and embedded IoT hardware. Over multiple versions, the MobileNet family introduced progressively refined design innovations — from depthwise separable convolutions to neural architecture search and transformer-style attention — while keeping computation minimal. Rather than treating MobileNet as a single model, this blog explores each version's motivation , the specific problem it addressed , and the architectural innovations it introduced to push the accuracy-efficiency frontier. 1. Why MobileNet? Motivation and Core Problem Standard convolutional networks like VGG and ResNet are accurate but computationally heavy. Deploying them on edge devices with limited memory, power, ...