AI

Recurrent Neural Networks

Recurrent Neural Networks #

Recurrent Neural Networks (RNNs) are neural networks designed for sequential data, where the order of inputs matters and the model must use information from earlier time steps to interpret later ones. Unlike a feedforward network, an RNN does not process each input in isolation. It carries a hidden state from one time step to the next, so the network can build a running summary of what it has seen so far.

Distributed Training Strategies

Distributed Training Strategies #

Distributed training combines devices to increase throughput, fit larger models, or shorten time to solution. The central design question is what to partition: examples, model parameters, layers, tensors, or the training schedule.

Course coverage:

  1. Data parallelism
  2. Model parallelism
  3. Pipeline parallelism and micro-batches
  4. Gradient checkpointing
  5. Mixed-precision training and loss scaling

Learning Objectives #

By the end of this page, you should be able to:

  • compare data, model, and pipeline parallelism
  • calculate global batch size, speedup, efficiency, and effective throughput
  • explain gradient aggregation through all-reduce
  • calculate simple pipeline time and utilisation
  • quantify the memory–computation trade-off of checkpointing
  • explain mixed precision and loss scaling

Big Picture #

flowchart TD
    A["Training Constraint"] --> B["More Data Throughput"]
    A --> C["Model Too Large"]
    A --> D["Activation Memory Too High"]
    B --> E["Data Parallelism"]
    C --> F["Model or Pipeline Parallelism"]
    D --> G["Checkpointing or Mixed Precision"]

    style A fill:#E1F5FE
    style B fill:#C8E6C9
    style C fill:#FFF9C4
    style D fill:#EDE7F6
    style E fill:#E1F5FE
    style F fill:#C8E6C9
    style G fill:#FFF9C4

1. Data Parallelism ☆ #

Each worker holds a complete model replica and processes a different shard of the mini-batch.

Game Playing and Adversarial Search

Game Playing and Adversarial Search #

Game-playing agents search in environments where other agents influence the outcome. In competitive games, a good move must account not only for what the agent wants to achieve, but also for the strongest response an opponent can make.

  • Searching to play games

  • Minimax Algorithm

  • Alpha-Beta Pruning

  • Monte Carlo Tree Search

  • Stochastic Games

Learning Objectives #

  • formulate a game as an adversarial search problem
  • construct a game tree with alternating MAX and MIN turns
  • design and interpret a static evaluation function
  • back up values using Minimax
  • apply Alpha-Beta Pruning and identify cut-offs
  • explain the four phases of Monte Carlo Tree Search
  • calculate an MCTS selection score using UCB1
  • evaluate chance outcomes in a stochastic game

Big Picture #

flowchart TD
    A["Game state"] --> B["Generate legal moves"]
    B --> C["Build game tree"]
    C --> D["Evaluate leaves"]
    D --> E["Choose robust action"]
    E --> A

    style A fill:#E1F5FE
    style B fill:#FFF9C4
    style C fill:#EDE7F6
    style D fill:#FFF9C4
    style E fill:#C8E6C9

In normal search, the agent controls its own actions and the transition model determines what happens next. In adversarial search, another agent chooses actions that may reduce the first agent’s utility.

Statistical, ML and Neural Models of POS Tagging

Statistical, ML and Neural Models of POS Tagging #

‘HMM Inference: Forward and Viterbi Algorithms’ covers the portion:

  • Forward Algorithm
  • Viterbi Algorithm
  • HMM inference for POS tagging

The complete Topic also includes:

  • Maximum Entropy Markov Models
  • Bidirectionality
  • Neural-network models for POS tagging

HMM Inference: Forward and Viterbi Algorithms #

Hidden Markov Models create two closely related inference problems:

  • Likelihood: How probable is an observed sequence under the model?
  • Decoding: Which hidden-state sequence most probably generated the observations?

The Forward Algorithm solves the likelihood problem, while the Viterbi Algorithm solves the decoding problem. Both use dynamic programming and a trellis, but they combine paths differently.

Temporal-Difference Learning II and DRL Taxonomy

Temporal-Difference Learning II and DRL Taxonomy #

One-step TD methods bootstrap after a single transition. Multi-step methods instead use several observed rewards before bootstrapping, forming a bridge between TD(0) and Monte Carlo learning.

Course Content covered in this module:

  • Temporal-Difference Learning: n-step returns and TD(λ)
  • Classification of Reinforcement Learning approaches, algorithms and applications:
    • Model-Based versus Model-Free
    • Value-Based versus Policy-Based
    • On-Policy versus Off-Policy
The number of sampled steps controls how far learning looks ahead before it bootstraps.

Learning Objectives #

By the end of this module, you should be able to:

Deep Recurrent Neural Networks

Deep Recurrent Neural Networks #

Vanilla RNNs introduce the hidden-state idea, but they struggle on longer and more complex sequences because gradients can vanish across time. Deep recurrent models extend the RNN idea in two important ways:

  1. make the recurrent architecture richer, for example by stacking multiple recurrent layers or using information from both directions,
  2. use gates and memory cells to control what should be remembered, forgotten, updated, and exposed.

This is why practical recurrent modelling usually moves from a simple RNN to stacked RNNs, bidirectional RNNs, GRUs, or LSTMs.

Attention Mechanism

Attention Mechanism #

Attention is a deep learning mechanism that allows a model to focus on the most relevant parts of an input sequence when producing an output.

Instead of compressing the whole input into one fixed vector, attention computes a weighted combination of useful information.

Key takeaway:
Attention answers a simple question:

For the current prediction, which input tokens should the model focus on most?

  • Queries, Keys, and Values
  • Attention Pooling by Similarity
  • Attention Pooling via Nadaraya–Watson Regression
  • Attention Scoring Functions
  • Dot Product Attention
  • Convenience Functions
  • Scaled Dot Product Attention
  • Additive Attention
  • Bahdanau Attention Mechanism
  • Multi-Head Attention
  • Self-Attention
  • Positional Encoding

Why Attention Is Needed ☆ #

Traditional encoder-decoder RNN models compress the full input sequence into one context vector.

Bayesian Learning

Bayesian Learning #

Bayesian Learning is a probabilistic approach to machine learning.

Instead of only asking, “Which output should the model predict?”, Bayesian Learning asks:

Given the data we have observed, how likely is each hypothesis, class, or parameter value?

This makes Bayesian Learning useful when uncertainty matters.

It is especially important in classification, probabilistic modelling, generative models, and situations where we want to combine prior knowledge with observed data.

Grammars, Parsing, and Morphological Processing

Grammars, Parsing, and Morphological Processing #

Natural-language sentences are more than sequences of words. Their words form phrases, and the way those phrases are grouped determines the sentence’s structure and meaning.

A grammar describes the structures that a language permits. A parser uses that grammar to discover the hidden structure of a particular sentence.

Course Content #

  • Grammars and sentence structure
  • What makes a good grammar
  • A bottom-up chart parser
  • Probabilistic Context-Free Grammars
  • Probabilistic CKY parsing of PCFGs
  • Ways to learn PCFG rule probabilities
  • Problems with PCFGs
  • Improving PCFGs by splitting non-terminals and using lexicalised CFGs

Learning Objectives #

  • Explain why sentence structure is necessary for resolving ambiguity.
  • Represent a grammar using terminals, non-terminals, productions, and a start symbol.
  • Recognise the defining restriction of a Context-Free Grammar.
  • Construct and interpret a simple parse tree.
  • Compare top-down and bottom-up parsing.
  • Explain how a chart prevents repeated parsing work.
  • Distinguish active arcs, completed constituents, the agenda, and the chart.
  • Explain morphological analysis and generation using finite-state models.

Big Picture #

flowchart TD
    A["Sentence"] --> B["Grammar: allowed structures"]
    B --> C["Parser: search for structure"]
    C --> D["Parse tree"]
    D --> E["Interpretation"]

    style A fill:#E1F5FE
    style B fill:#C8E6C9
    style C fill:#FFF9C4
    style D fill:#EDE7F6
    style E fill:#E1F5FE

1. Why Sentence Structure Matters ☆ #

Knowing the meanings of individual words is not enough to determine the meaning of a complete sentence. We must also know which words belong together.

Knowledge Representation and Propositional Logic

Knowledge Representation and Propositional Logic #

An intelligent agent can store observations and rules, combine them through logical reasoning, and use the resulting conclusions to choose an action. Knowledge representation makes this information explicit so that the agent can reuse what it knows and reason about situations it has not directly observed.

Module topics

  • Overview of Logics- Propositional, Predicate, TT-Entail, Theorem Proving
  • Logic Representation of a sample agent, Proof by resolution, DPLL Algorithm, Agents based on Propositional logic
  • Unification, forward chaining, Backward Chaining, Resolution

The explanations below develop knowledge-based agents and propositional reasoning, using one continuous Wumpus World example.