api: YAML JSON TOON Database
version: 1.0.0
format: yaml
dataset:
  id: 2850
  slug: ml-model-architectures
  title: Machine Learning Model Architectures
  description: "Overview of major ML model families: feedforward neural networks, CNNs, RNNs/LSTMs, Transformers, GANs, and when to use each."
  summary: "Machine-learning model architectures with type, structure, layers, uses, pros, cons and notes: feedforward networks, CNNs, RNNs, LSTMs, transformers, GANs and autoencoders, with a selection guide by data type."
  use_when:
    - You are choosing an architecture for a data type such as images, text or time series.
    - You need the strengths and weaknesses of each.
  caveats:
    - Guidance is general; strong results often come from architecture, data and training choices together.
    - Architectures are combined in practice (convolutional layers feeding transformers, for example).
  related:
    - neural-network-types
    - attention-mechanisms
    - ml-training-algorithms
    - transfer-learning
  entry_count: 7
  fields:
    - section: architectures
      field: name
      type: string
      example: Feedforward Neural Network (FNN)
    - section: architectures
      field: type
      type: string
      example: Dense / MLP
    - section: architectures
      field: structure
      type: string
      example: Input → Hidden layers (dense) → Output. No cycl…
    - section: architectures
      field: layers
      type: array
      example: "[3 items]"
    - section: architectures
      field: use_cases
      type: array
      example: "[3 items]"
    - section: architectures
      field: pros
      type: array
      example: "[3 items]"
    - section: architectures
      field: cons
      type: array
      example: "[2 items]"
    - section: architectures
      field: notes
      type: string
      example: Also called Multi-Layer Perceptron (MLP); found…
    - section: architectures
      field: key_layers
      type: object
      example: "{convolution,pooling,fully_connected}"
    - section: architectures
      field: variants
      type: array|object
      example: "[3 items]"
    - section: architectures
      field: gates
      type: object
      example: "{forget_gate,input_gate,output_gate}"
    - section: architectures
      field: core_mechanism
      type: string
      example: "Self-attention: each token attends to all other…"
    - section: architectures
      field: training
      type: string
      example: "Alternating: train D on real/fake, then train G…"
    - section: selection_guide
      field: "*"
      type: object
      example: "{tabular_data,images,sequences_short,sequences_long}"
  category: AI & ML Terms
  category_slug: ai-ml-terms
  tags: machine-learning,neural-networks,architectures,cnn,rnn,transformer,gan
  view_count: 46
  created_at: 1777673262
  updated_at: 1777673262
data:
  architectures:
    - name: Feedforward Neural Network (FNN)
      type: Dense / MLP
      structure: Input → Hidden layers (dense) → Output. No cycles or feedback connections.
      layers:
        - Input layer
        - One or more hidden layers (ReLU/common)
        - Output layer (linear/softmax/sigmoid)
      use_cases:
        - Tabular data classification/regression
        - Simple pattern recognition
        - Baseline model
      pros:
        - Simple to implement
        - Universal approximator (with enough width/depth)
        - Fast inference
      cons:
        - Ignores spatial/temporal structure
        - Parameter count grows quickly with input size
      notes: Also called Multi-Layer Perceptron (MLP); foundation for all deep nets
    - name: Convolutional Neural Network (CNN)
      type: Spatial hierarchy
      structure: Convolutional layers (filters) → pooling → fully connected. Local receptive fields, weight sharing.
      key_layers:
        convolution: Applies filters/kernels to detect local patterns (edges, textures)
        pooling: Downsampling (max/avg) for translation invariance
        fully_connected: Final classification/regression layers
      use_cases:
        - Image classification
        - Object detection
        - Medical imaging
        - Time series (1D conv)
      pros:
        - Parameter sharing (efficient)
        - Spatial invariance
        - Detects hierarchical features
      cons:
        - Fixed receptive field (unless dilated)
        - Not inherently good for sequential data
      notes: Architecture depth (ResNet, Inception) matters more than width for vision
    - name: Recurrent Neural Network (RNN)
      type: Sequential / temporal
      structure: Recurrent connections; hidden state carries information across time steps.
      variants:
        - Vanilla RNN (simple recurrence)
        - LSTM (Long Short-Term Memory)
        - GRU (Gated Recurrent Unit)
      use_cases:
        - Language modeling
        - Time series prediction
        - Speech recognition
        - Sequence tagging
      pros:
        - Handles variable-length sequences
        - Theoretically infinite memory (with LSTM/GRU)
      cons:
        - Sequential processing (hard to parallelize)
        - Vanishing/exploding gradients (vanilla RNN)
        - LSTM/GRU complex
      notes: LSTM/GRU gates mitigate vanishing gradients; still largely superseded by Transformers for NLP
    - name: Long Short-Term Memory (LSTM)
      type: Recurrent with gates
      structure: Cell state + forget/input/output gates. Controls information flow over long sequences.
      gates:
        forget_gate: Decide what to discard from cell state
        input_gate: Decide what new information to store
        output_gate: Decide what to output based on cell state
      use_cases:
        - Machine translation (legacy)
        - Speech synthesis
        - Text generation (pre-Transformer)
      pros:
        - Can learn long-range dependencies (~100s steps)
        - Robust to vanishing gradients
      cons:
        - Still sequential (slow training)
        - Many parameters (4× vanilla RNN)
        - Requires more data than simpler models
      notes: LSTM superior to vanilla RNN but slower; Transformer now standard for sequence
    - name: Transformer
      type: Attention-based
      structure: Encoder-decoder or encoder-only/decoder-only. Self-attention + feed-forward. Positional encoding.
      core_mechanism: "Self-attention: each token attends to all others; O(n²) complexity"
      variants:
        encoder_only: BERT (masked attention, pre-training)
        decoder_only: GPT (causal attention, autoregressive)
        encoder-decoder: T5, original Transformer (translation)
      use_cases:
        - NLP (all major tasks)
        - Computer vision (Vision Transformer)
        - Audio (Whisper)
        - Multimodal (CLIP)
      pros:
        - Parallelizable (no recurrence)
        - Long-range dependencies (attention)
        - Scalable with data/model size
      cons:
        - Quadratic memory in sequence length
        - Requires massive data for training from scratch
        - Positional encoding limits context
      notes: Dominant architecture since 2017 (Attention Is All You Need). Sparse attention variants handle long sequences.
    - name: Generative Adversarial Network (GAN)
      type: Generative
      structure: Generator (creates fake samples) + Discriminator (distinguishes real vs fake). Min-max game.
      training: "Alternating: train D on real/fake, then train G to fool D. No explicit likelihood."
      use_cases:
        - Image synthesis (StyleGAN)
        - Image-to-image translation
        - Super-resolution
        - Data augmentation
      pros:
        - High-quality, sharp samples
        - No explicit likelihood modeling (flexible)
      cons:
        - Training unstable (mode collapse, vanishing gradients)
        - Hard to evaluate
        - No explicit density
      notes: Diffusion models now dominate image generation; GANs still used for specific tasks (style transfer)
    - name: Autoencoder
      type: Representation learning
      structure: Encoder (compress to latent) → bottleneck → Decoder (reconstruct). Reconstruction loss trains end-to-end.
      variants:
        - Vanilla AE (dense layers)
        - Variational Autoencoder (VAE) — probabilistic latent
        - Denoising AE — robust features
      use_cases:
        - Dimensionality reduction
        - Anomaly detection
        - Denoising
        - Generative modeling (VAE)
      pros:
        - Unsupervised pre-training possible
        - Learns compact representations
      cons:
        - VAE samples blurry
        - Simple AE doesn't learn useful latent space
        - Reconstruction loss not always semantic
      notes: Contrastive learning (SimCLR) often superior for representation learning
  selection_guide:
    tabular_data: FNN or Gradient Boosting (XGBoost/LightGBM)
    images: CNN (ResNet, EfficientNet) or Vision Transformer
    sequences_short: LSTM/GRU or Transformer (if enough data)
    sequences_long: Transformer with sparse attention or linear attention
    text_nlp: Transformer (BERT for understanding, GPT for generation)
    time_series: Temporal CNN, LSTM, or Transformer (Informer, PatchTST)
    image_generation: Diffusion model (Stable Diffusion) or GAN (legacy)
    anomaly_detection: Autoencoder or isolation forest
