Sequences introduce a different challenge: the input, output, and useful context can all vary in length.
Named entity recognition (NER) identifies mentions of people, places, organizations, and other entities in text.
Search engines employ NER to index names, places, times, etc., in news articles.
Why not use a standard neural network instead of RNNs?
- Inputs, outputs can be different lengths in different examples
- A naïve NN Doesn’t share features learned across different positions of text
RNN disadvantages
-ve) RNN cannot see aagy ke words tou NER mein agar model use hora, then usko aagy waly words bhi daikhny hongy wrna usko idea nae hopaega ke wo word name he ya nae
-ve) RNN are heavily influenced by nearby inputs, output at particular time step is primarily influenced by recent inputs
-ve) Basic RNNs find it hard to maintain information from earlier timesteps to influence later steps


BPTT

A sequence model learns the probability distribution of various sequences of words
| Character level RNNS | Word level RNNS |
|---|---|
| Vocabulary consists of individual characters Can represent any word not seen during training No <unknown> token issue High computational cost Less effective at capturing long range dependencies longer sequential blocks required for even small sentences | Vocabulary consists of entire words more efficient at capturing long-range dependencies shorter sequences cant represent words not in the training vocabulary |
Gradient clipping: solution for exploding gradients, rescales gradient vectors that exceed a threshold
Vanishing gradient is more challenging to solve than exploding gradients
Long sequences (e.g. 1000 timesteps) are prone to vanishing gradient problems
GRUs introduced as a solution
GRU
GRU Advantages
+ve) GRUs can retain long-term dependencies, making them less susceptible to the vanishing gradient problem.
+ve) With the help of reset and update gates, GRUs can selectively remember or forget information, making them adept at handling sequences.
+ve) GRU can be seen as a simplified version of the LSTM as it uses two gates compared to LSTM’s three. This often leads to faster training times, although at the cost of expressiveness

LSTM
Powerful version of GRU

Peephole Connection:
In standard LSTMs, gate values are dependent on the previous activation and the current input .
In peephole connections, the gate values also take into account the previous cell state , allowing the
cell state to influence the gates directly. This can sometimes improve performance, depending on the specific task.
Bidirectional RNNs
Allows the network to have information from both past and future states, which is often valuable in tasks where context plays a significant role. Particularly beneficial for many Natural Language Processing (NLP) tasks. A combination of BRNN with LSTM blocks is a popular choice.
-ve) The entire sequence is required before predictions can be made. This is not suitable for real-time predictions, such as real-time speech recognition.
The blocks in BRNN can be standard RNNs, GRUs, or LSTMs. The choice depends on the specific problem and data
Deep RNN
