Neural Mastery

GNNs, RL Networks, Metric Learning, SSL & Multimodal Nets

The remaining major architecture families — each built for data or objectives that don't fit the standard "fixed-size input, single label" supervised mold: graphs, sequential decision-making, similarity rather than classification, learning without labels, and combining modalities.

GNNs
Metric Learning
RL Networks
SSL
Multimodal
Time Series-specific
Data that's naturally a graph -- social networks, molecules, road networks.

Graph Neural Networks (GNNs)

Built for data that's naturally a graph — social networks, molecules, road networks — where a plain CNN/Transformer has no notion of arbitrary, irregular connectivity.

  • The core idea, message passing: each node updates its representation by aggregating information from its neighbors, layer by layer — after kk layers, a node's representation reflects its kk-hop neighborhood. This is the graph analog of how convolution aggregates local pixel neighborhoods.
k=1
k=2
k=3
012345
After 1 layer of message passing, node 0's representation reflects its 1-hop neighborhood -- 3 other node(s) have influenced it so far.
  • GCN (Graph Convolutional Network): aggregates neighbor features via a (normalized) weighted average, the most direct graph generalization of convolution.
  • GraphSAGE: instead of using a full neighborhood (expensive for high-degree nodes, and doesn't generalize to unseen nodes), samples a fixed-size subset of neighbors and learns a general aggregation function — enables inductive learning (generalizing to nodes/graphs not seen during training), not just transductive learning on one fixed graph.
  • GAT (Graph Attention Network): replaces GCN's fixed averaging with learned attention weights over neighbors, so the model learns which neighbors matter more for a given node — the same core idea as self-attention, applied to a graph's actual edges instead of a full sequence.
GCN
GraphSAGE
GAT
Replaces GCN's fixed averaging with learned attention weights over neighbors -- the model learns which neighbors matter more, the same core idea as self-attention applied to a graph's actual edges.
  • Applications: molecule property prediction (atoms as nodes, bonds as edges), recommendation systems (users/items as nodes, interactions as edges), fraud detection (transactions as a graph), traffic forecasting (road network topology).

Metric Learning Networks

Instead of learning to classify into fixed categories, learn an embedding space where distance directly reflects similarity — the right tool when the set of possible classes is huge, open-ended, or unknown at training time (face identification, one-shot recognition).

  • Siamese Networks: two identical (shared-weight) network branches process a pair of inputs, and the model is trained so the output embeddings are close for similar pairs and far apart for dissimilar pairs — the foundational architecture for this whole family.
  • Triplet Loss: trains on triplets (anchor, positive, negative), pushing the anchor-positive distance below the anchor-negative distance by at least a margin — a stronger training signal than pairs alone, because it directly encodes relative, not just absolute, similarity.
  • Contrastive Loss: the pairwise formulation underlying Siamese training — penalizes similar pairs for being far apart and dissimilar pairs for being closer than a margin.
anchorpositivenegative
Before training: the positive (same identity, different photo) and negative (different identity) start at similar, unhelpful distances from the anchor.
  • Applications: face verification/recognition (is this the same person), signature verification, few-shot/one-shot classification, and the same underlying idea behind the contrastive self-supervised methods below.

Reinforcement Learning Networks

Networks trained not to match a label, but to maximize a reward signal through interaction with an environment (see also ML System Design for RL as applied to recommendation and ranking systems).

  • DQN (Deep Q-Network): approximates the Q-function (expected future reward of taking an action in a state) with a neural network, combined with experience replay (train on a buffer of past transitions, breaking harmful correlation between consecutive samples) and a separate, slowly-updated target network (stabilizes the moving-target problem of bootstrapped value estimates) — the architecture that first matched human-level performance on Atari games directly from pixels.
  • Policy Gradient methods: instead of learning a value function and deriving a policy from it, directly parameterize and optimize the policy (the action-selection function) via gradient ascent on expected reward — necessary for continuous action spaces where "take the argmax over actions" (as in DQN) isn't well-defined.
  • Actor-Critic: combines both — an actor network outputs the policy, a critic network estimates the value function to reduce the variance of the actor's gradient estimates, getting the sample efficiency benefits of value-based methods with the flexibility of policy-based methods.
  • PPO (Proximal Policy Optimization): an actor-critic method that constrains each policy update to stay within a small "trust region" of the previous policy (via a clipped objective), preventing the destructively large policy updates that made earlier policy gradient methods unstable — the standard, default RL algorithm in practice today, including as the RL algorithm behind RLHF for LLM alignment (see LLMs & GenAI).
DQN
Policy Gradient
Actor-Critic
PPO
Constrains each policy update to a small "trust region" via a clipped objective -- prevents the destructively large updates that made earlier policy gradient methods unstable. The default RL algorithm today, including behind RLHF for LLM alignment.

Self-Supervised Learning (SSL) Architectures

Learn useful representations from unlabeled data by constructing a supervised-seeming task out of the data itself — no human labels required.

  • Contrastive SSL (SimCLR, MoCo): create two augmented views of the same image, train the network to pull their embeddings together while pushing apart embeddings of different images — directly reuses the contrastive/triplet-loss ideas above, applied at pretraining scale instead of for a specific similarity task.
  • Masked prediction SSL (BERT for text, MAE for images): mask out part of the input and train the model to reconstruct or predict the missing part — BERT's masked language modeling and the Masked Autoencoder (MAE) for images are the same underlying principle applied to different modalities.
view A (augmented)
pull together
view B (augmented)
SimCLR/MoCo: create two augmented views of the same image, pull their embeddings together while pushing apart embeddings of different images -- reuses the contrastive/triplet-loss idea at pretraining scale.
  • Why this matters: SSL pretraining is how essentially every modern foundation model (LLMs, vision backbones) gets its initial general-purpose representations, before any task-specific fine-tuning — see Transfer Learning & Fine-Tuning for what happens next.

Multimodal Architectures

Combine two or more input modalities (text, image, audio) in one model:

  • Dual-encoder / contrastive multimodal models (CLIP): a separate encoder per modality (a ViT for images, a Transformer for text), trained contrastively so matching image-text pairs land close together in a shared embedding space and non-matching pairs land far apart — the same contrastive principle as SimCLR, across modalities instead of augmented views. This shared embedding space is what powers zero-shot image classification (compare an image embedding to text embeddings of candidate class names) and text-to-image retrieval.
image → ViT encoder
“a photo of a dog” → text encoder
shared embedding space
(contrastively aligned)
Zero-shot classification: compare an image embedding to text embeddings of candidate class names ("a photo of a dog," "a photo of a cat") and pick the closest -- no task-specific training needed.
  • Fusion-based VLMs: rather than just aligning separate embeddings, project one modality's features directly into the other's token space and let a single Transformer attend jointly over both — see Multimodal & Generative Models for VLMs and VLAs in depth, and LLM Hosting & Serving Patterns for how these get served in production.

Time Series-Specific Networks

Beyond the classical statistical models in Time Series Forecasting and the general sequence models in Sequence Models:

  • TCN (Temporal Convolutional Network): applies 1D causal, dilated convolutions along the time axis — causal so a prediction only depends on past values, dilated so the receptive field grows exponentially with depth without needing recurrence at all. Often trains faster than an RNN/LSTM on long sequences while matching or beating their accuracy, because convolutions parallelize across time steps during training in a way recurrence cannot.
layer 1
layer 2
layer 3
Layer 2: dilation = 2, receptive field = 9 time steps, all strictly in the PAST -- the prediction at time t never depends on t+1 or later. Dilation doubling each layer means the field grows exponentially with depth, not linearly like a plain (non-dilated) convolution.
  • N-BEATS: a pure deep learning forecasting architecture built from stacked fully-connected blocks with backward/forward residual connections, explicitly designed to be interpretable (decomposing a forecast into trend and seasonality components) without hand-engineered statistical structure — competitive with, and often beating, classical statistical and hybrid models on standard forecasting benchmarks.
  • TFT (Temporal Fusion Transformer): covered in Time Series Forecasting — combines LSTM-based local processing with attention for long-range dependencies and built-in interpretability (which input features and time steps mattered most for a given forecast).

Next: NN Layers Reference — the individual building-block layers (attention, convolution, normalization, and more) used across every architecture in this section.

Last updated Sep 5, 2026Edit this pageReport an issue
← Previous
Generative Models: GANs & Diffusion
Next →
NN Layers Reference