Sequence Models, Transformers and BERT
What is an RNN?
A neural network for sequences. It keeps a hidden state that
remembers previous inputs.
What is the problem with RNN?
It struggles with long sequences because of vanishing
gradients, and it processes tokens one by one, which is slow.
What is LSTM?
An RNN with gates (input, forget, output) that can remember
information for a long time.
What is GRU?
A simpler version of LSTM with fewer gates. It is faster to
train.
What is BiLSTM?
An LSTM that reads the sequence in both forward and backward
directions.
What is a Transformer?
A Transformer is a neural network architecture that uses
attention mechanisms to process relationships between different parts of an
input. It is widely used in natural language processing and many other domains.
What is self-attention?
Self-attention allows a model to determine which parts of an
input are important in relation to other parts of the same input. In simple
terms, it helps the model understand the relationship between different words
or tokens in the input.
What is multi-head attention?
Multi-head attention uses multiple attention mechanisms,
called heads, to learn different relationships or representations from the
input simultaneously.
What are Query, Key, and Value in attention?
Query is what a token is looking for. Key is what each token
offers. Value is the actual information. Attention compares the Query with Keys
to weight the Values.
What is positional encoding?
Extra information added to embeddings so the Transformer
knows the order of tokens.
What are the encoder and decoder in a Transformer?
The encoder understands the input. The decoder generates the
output.
What is a feed-forward network in a Transformer?
Two dense layers applied to each token after attention to
add more non-linearity.
What is a residual connection in a Transformer?
The input of a sublayer is added to its output. This helps
stable training.
Why are Transformers better than RNNs?
They process all tokens in parallel, capture long-range
relationships using attention, and train faster.
What is BERT?
BERT stands for Bidirectional Encoder Representations from
Transformers. It is a Transformer-based language model designed to learn
contextual representations of text.
Why is BERT called bidirectional?
Because it considers information from both the left and
right context of a token when learning its representation.
What is masked language modeling?
BERT hides some words in a sentence and learns to predict
them. This is how BERT is pre-trained.
What is the [CLS] token?
A special token at the start of the input. Its final
representation is often used for classification.
What is pooled output in BERT?
A single vector for the whole sentence, usually made from
the [CLS] token.
What is BioBERT?
BioBERT is a BERT-based language model that is pre-trained
on biomedical text. It is designed for biomedical natural language processing
tasks.
What is ClinicalBERT?
A BERT model pre-trained on clinical notes, such as hospital
records.
What is DistilBERT?
A smaller and faster version of BERT made by knowledge
distillation. It keeps most of the performance.
What is GPT and how is it different from BERT?
GPT is a decoder-based model that generates text left to
right. BERT is encoder-based and learns from both directions.
What is a pre-trained language model?
A model trained on a large text corpus, then adapted to a
specific task.
Pre-training vs fine-tuning?
Pre-training learns general language knowledge from huge
data. Fine-tuning adapts the model to a specific task using a smaller dataset.
What is domain adaptation?
Adjusting a model so it works well in a specific field, like
biomedical text.
What is knowledge distillation?
A small "student" model learns to mimic a large
"teacher" model. This makes the model smaller.
What is model compression?
Reducing model size using pruning, quantization, or
distillation.
What is quantization?
Using lower-precision numbers (like 8-bit instead of 32-bit)
to make the model smaller and faster.
What is pruning?
Removing unimportant weights or neurons from a model.