ENSAM Casablanca · Deep Learning & NLP 2025/2026

100 Essential Questions

Curated exam-ready questions with direct, complete answers. Covers all 7 course modules from ANN fundamentals to LLMs and evaluation methodology. Click any question to reveal the answer.

Total Questions100
Groups7 Sections
Answer StyleDirect · Complete
Exam Date18 May 2026
1 · ANN 2 · CNN 3 · RNN/LSTM 4 · NLP 5 · Embeddings 6 · Transformers 7 · Methodology
SECTION 01 Deep Learning Fundamentals 15 Q
01What are the three fundamental concepts that characterize Deep Learning?

Deep Learning is characterized by hierarchical compositionality (layers learning increasingly abstract features), end-to-end learning (raw data to output without manual feature engineering), and distributed representations (concepts coded by a distributed pattern rather than a single neuron).

02How does Deep Learning fundamentally differ from classical Machine Learning regarding features?

In classical ML, humans manually engineer features (like HOG or MFCC), whereas Deep Learning automatically learns hierarchical representations directly from raw data.

03What distinguishes a feed-forward architecture from a feed-back architecture?

In feed-forward networks (like CNNs), information flows strictly from input to output, while feed-back architectures (like RNNs) use feedback loops to re-inject outputs as inputs.

04What is the primary role of a non-linear activation function in a neural network?

Without a non-linear activation function, stacking multiple layers would be mathematically equivalent to a single linear transformation, preventing the model from learning complex functions.

05What are the four core steps of the neural network learning loop?

The four steps are the forward pass (computing predictions), loss calculation (measuring error), backpropagation (calculating gradients via the chain rule), and the weight update using gradient descent.

06Why is Mini-batch Stochastic Gradient Descent (SGD) generally preferred over Batch Gradient Descent?

Mini-batch SGD provides an ideal compromise by being faster and parallelizable, whereas Batch GD computes the gradient over the entire dataset, which is stable but impractically slow.

07What is the "dead neuron" problem in ReLU, and how does Leaky ReLU solve it?

ReLU assigns a gradient of zero to negative inputs, causing neurons to "die" and stop learning; Leaky ReLU solves this by assigning a very small, non-zero gradient ($\alpha x$) for negative values.

08Why is the Softmax activation function specifically used for multi-class classification?

Softmax transforms a vector of raw scores into a valid probability distribution, where all values sum to 1, making it ideal for predicting a single class out of many.

09What is the exact purpose of splitting data into train, validation, and test sets?

The training set adjusts weights, the validation set tunes hyperparameters and detects overfitting during training, and the test set provides an unbiased final evaluation of the model.

10What is the difference in effect between L1 and L2 regularization?

L1 regularization promotes sparsity by driving some weights exactly to zero, while L2 regularization limits excessively large weights without strictly enforcing sparsity.

11How does Dropout act as a regularization technique?

Dropout randomly deactivates a fraction of neurons during training, forcing the network to learn redundant and robust representations rather than relying on a few specific neurons.

12Why is "Accuracy" an unreliable metric for imbalanced datasets?

On a dataset heavily skewed toward one class (e.g., 95% to 5%), a model can achieve 95% accuracy just by predicting the majority class, making metrics like Precision, Recall, and F1-score necessary.

13What does the AUC-ROC metric evaluate?

AUC-ROC measures the model's overall capacity to correctly separate and distinguish between classes across all possible decision thresholds.

14How does Early Stopping prevent overfitting?

Early stopping automatically halts training when the model's performance on the validation loss stops improving, ensuring the model doesn't start memorizing training noise.

15How should the bias of hidden layers versus output layers be initialized?

Hidden layer biases should be initialized to zero, while the output layer bias is optimally initialized to the average of the target values.

SECTION 02 Convolutional Neural Networks (CNNs) 15 Q
16Why do Multilayer Perceptrons (MLPs) fail when applied to high-resolution images?

MLPs suffer from the "curse of dimensionality" requiring millions of parameters, lack spatial invariance, and destroy local pixel relationships by flattening the image.

17What are the two foundational mechanisms that allow CNNs to process images efficiently?

CNNs utilize local receptive fields (neurons connect only to small local regions) and weight sharing (the same filter slides across the whole image).

18What is the operational difference between "same" padding and "valid" padding?

"Same" padding adds zeros around the image boundaries to maintain the original spatial dimensions, whereas "valid" padding applies no padding, resulting in reduced output dimensions.

19What is the mathematical formula to compute the output dimension of a convolutional layer?
$O = \lfloor (I - K + 2P) / S \rfloor + 1$

where $I$ is input size, $K$ is kernel size, $P$ is padding, and $S$ is stride.

20How many parameters are in a Conv2D layer using 32 filters of size 3×3 on an RGB image?
$(3 \times 3 \times 3 \text{ channels} + 1 \text{ bias}) \times 32 \text{ filters} = 896$ parameters
21What is the specific role of Max Pooling in a CNN?

Max Pooling reduces spatial dimensions, focuses on the most salient features (like edges or corners), and provides invariance to small spatial translations without adding learnable parameters.

22Why have modern CNN architectures replaced Flatten + Dense layers with Global Average Pooling?

Dense layers can account for over 85% of a network's parameters, so Global Average Pooling is used to drastically reduce parameter count and mitigate overfitting.

23According to the "Power-of-2 Compression Schedule", what should happen to the filter count after a pooling operation?

The number of filters should be doubled (e.g., from 64 to 128) each time spatial resolution is halved, maintaining a constant computational cost.

24Why is a 3×3 filter overwhelmingly preferred over a 5×5 filter in modern CNNs?

Two stacked 3×3 filters provide the same 5×5 receptive field but require 28% fewer parameters, making the network deeper and more efficient.

25What key architectural innovation allowed ResNet to successfully train hundreds of layers?

ResNet introduced residual connections (skip connections), which help bypass layers and allow gradients to flow freely through extremely deep networks.

26What defines the "Feature Extraction" strategy in Transfer Learning?

Feature Extraction involves freezing the entire pre-trained convolutional base and only training a newly added classification head on the specific dataset.

27Under what conditions should you use "Fine-Tuning" rather than pure Feature Extraction?

Fine-tuning (unfreezing the top layers and training with a very low learning rate) should be used when the dataset is medium-sized and the precision from pure feature extraction is insufficient.

28Why must Data Augmentation strictly be applied only to the training set?

Data augmentation creates artificial variations to prevent overfitting; applying it to the validation or test sets would distort the unbiased evaluation of the model's true performance.

29What is the most critical evaluation metric for medical imaging classification (e.g., detecting pneumonia)?

Recall (Sensitivity) is critical because minimizing false negatives (missing an actual disease) is far more important than avoiding false alarms.

30Why should raw pixel values (0–255) never be directly fed into a CNN?

Inputs must be normalized (to $[0,1]$ or standardized); feeding large, unscaled values creates instability and slows down gradient descent convergence.

SECTION 03 Recurrent Neural Networks (RNNs) & Time Series 15 Q
31Why are MLPs and CNNs structurally inadequate for processing sequential data?

They lack temporal memory, require inputs of fixed length, and cannot share learned temporal patterns across different positions in a sequence.

32What core mechanism allows an RNN to process sequential dependencies?

An RNN maintains a hidden state ($h_t$) through a feedback loop, which is updated at each time step and acts as a memory of previously seen inputs.

33What is Backpropagation Through Time (BPTT)?

BPTT is the algorithm used to train RNNs, where the network is unrolled across the entire sequence length, and gradients are propagated backward through the shared weights over time.

34What causes the "vanishing gradient" problem specifically in Vanilla RNNs?

During BPTT, gradients are repeatedly multiplied by the same weight matrices; over long sequences (>10–15 steps), these gradients exponentially shrink toward zero, causing the network to forget long-term dependencies.

35What is the primary technique used to combat the "exploding gradient" problem?

Gradient clipping is heavily utilized, which caps the maximum value of gradients to ensure stable training without numerical overflow.

36What two distinct state vectors are maintained in an LSTM cell?

The LSTM maintains a visible working memory called the hidden state ($h_t$) and a protected, long-term memory called the cell state ($C_t$).

37What are the specific functions of the three gates in an LSTM?

The Forget gate decides what to erase from the cell state, the Input gate decides what new information to add, and the Output gate controls what is emitted as the new hidden state.

38Why does the LSTM's cell state ($C_t$) resolve the vanishing gradient problem?

The cell state updates via element-wise addition and multiplication, acting as a "conveyor belt" that allows gradients to flow backward almost unchanged without suffering repeated matrix multiplications.

39How does the architecture of a GRU simplify that of an LSTM?

The GRU merges the cell state and hidden state into a single vector and reduces the architecture to just two gates (Update and Reset), requiring about 25% fewer parameters than an LSTM.

40In what scenario is choosing a GRU generally preferable to an LSTM?

A GRU is preferred when seeking an optimal compromise between speed and performance, particularly for edge devices, mobile computing, or real-time systems.

41What advantage does a Bidirectional RNN (BiLSTM) offer over a standard RNN?

A BiLSTM consists of two independent RNNs processing the sequence in both chronological and reverse order, allowing it to leverage both past and future context simultaneously.

42What is the main architectural bottleneck of the Encoder-Decoder (Seq2Seq) model prior to Attention mechanisms?

The encoder is forced to compress the entire input sequence into a single, fixed-size context vector, which becomes a severe information bottleneck for long sequences.

43Why is training an RNN inherently slower than training a CNN?

RNNs suffer from a sequential bottleneck because computing the state at time $t$ strictly depends on the computed state from time $t-1$, making parallelization impossible during training.

44In the era of Transformers, what specific engineering scenarios still necessitate RNNs?

RNNs are still ideal for real-time streaming inference (as they process elements one by one with $O(1)$ memory), microcontrollers, and irregularly spaced time series.

45In the poetry generation lab, how does the "temperature" ($T$) parameter influence the output text?

A low temperature ($T \sim 0.3$) creates highly coherent but repetitive text, whereas a high temperature ($T \sim 1.3$) increases lexical diversity at the risk of generating incoherent text.

SECTION 04 NLP Fundamentals & Processing 15 Q
46What distinguishes NLU (Natural Language Understanding) from NLG (Natural Language Generation)?

NLU takes raw text and extracts structured representations (like entities or intent), whereas NLG takes structured data or prompts and produces fluent, human-readable text.

47Why does the sentence "I saw the man with the telescope" exemplify NLP challenges?

It illustrates syntactic ambiguity; the sentence produces two valid syntax trees depending on whether the observer or the man holds the telescope.

48What are the first three standard steps when cleaning raw web text?

The first steps generally include converting to lowercase, removing HTML tags via regex, and stripping URLs.

49How do modern sub-word tokenizers (like WordPiece or BPE) handle unknown (OOV) words?

They decompose unknown words into smaller, known sub-word components (e.g., "unhappiness" into "un", "##happi", "##ness"), thereby mitigating the Out-Of-Vocabulary problem.

50Why can the indiscriminate removal of "stop words" destroy a sentiment analysis model?

Words like "not", "no", and "never" are often flagged as stop words; removing them destroys negation and entirely flips the sentiment of phrases like "not good".

51What is the structural difference in output between Stemming and Lemmatization?

Stemming uses rigid heuristic rules to chop off suffixes (often leaving non-words like "studi"), while Lemmatization performs morphological analysis to return a valid dictionary root (like "study").

52Why is POS (Part-of-Speech) tagging required for accurate Lemmatization?

A word's lemma depends on its grammar; without POS tagging, the lemmatizer wouldn't know if "better" should be reduced to "good" (adjective) or left as "better" (verb).

53What does POS tagging explicitly provide to the NLP pipeline?

It assigns a grammatical category (e.g., noun, verb, adjective, preposition) to each token based on its precise context in the sentence.

54What specific NLP task classifies entities into categories like PERSON, ORG, or GPE?

Named Entity Recognition (NER).

55What information is extracted during Dependency Parsing?

Dependency parsing creates a directed tree that extracts grammatical relationships, identifying the head of a word to answer "who does what to whom" (e.g., nominal subjects and direct objects).

56What is a Context-Free Grammar (CFG) in the context of syntactic analysis?

A CFG is a formal system using non-terminal rewriting rules (e.g., $S \rightarrow NP\ VP$) to describe the structural syntax of a language and generate derivation trees.

57Why have CFGs been largely abandoned for parsing real-world text?

CFGs generate multiple valid syntax trees for ambiguous sentences but completely lack the contextual or probabilistic awareness to select the correct meaning.

58What does the term 'OOV' represent in vocabulary building?

Out-Of-Vocabulary, which refers to words that the model never encountered during its training phase.

59Why is aggressive normalization (stemming) discouraged before using contextual embeddings like BERT?

BERT inherently learns the nuances between inflected forms through their surrounding context; stripping words to radicals destroys these valuable contextual markers.

60What is the risk of using a strict alphabetic filter (isalpha()) during text cleaning?

While it removes noise, it also aggressively strips all punctuation, numbers, and symbols, which could contain critical data like dates, monetary values, or structural sentence markers.

SECTION 05 Word Embeddings (BoW to BERT) 15 Q
61What is the defining characteristic of a Bag of Words (BoW) vector representation?

It creates a highly sparse matrix (often >99% zeros) based purely on word counts, completely losing the order of words and semantic nuances.

62How do N-gram models attempt to solve the BoW model's failure with negation?

By capturing sequences of $N$ consecutive words (like bigrams), they can process "not good" as a single distinct feature rather than two disconnected, conflicting words.

63In the TF-IDF formula, what happens to the weight of highly frequent functional words like "the"?

The Inverse Document Frequency (IDF) component heavily penalizes words that appear universally across the corpus, reducing their final weight to near zero.

64Why does TF-IDF generally yield higher classification accuracy than a standard BoW model?

TF-IDF explicitly weights words by their rarity and discriminative power, highlighting strong keywords while attenuating background noise.

65What is the "distributional hypothesis" that forms the basis of Word2Vec and GloVe?

It is the linguistic theory that the semantic meaning of a word can be mathematically inferred from the company it keeps (its surrounding context words).

66What are the two distinct neural architectures used to train Word2Vec?

CBOW (Continuous Bag of Words, predicting a target word from its context) and Skip-gram (predicting the surrounding context from a target word).

67How does GloVe's training methodology differ fundamentally from Word2Vec?

While Word2Vec uses a local predictive neural network window, GloVe constructs a massive global co-occurrence matrix for the entire corpus and applies SVD factorization.

68What unique sub-word mechanism allows FastText to handle OOV words effectively?

FastText represents a word as the sum of its character n-grams (e.g., <te, ter, err> for "terrible"), allowing it to assemble plausible vectors for misspelled or entirely new words.

69What is the critical flaw shared by all static embeddings (Word2Vec, GloVe, FastText) regarding polysemy?

They assign exactly one fixed vector per word type, meaning polysemic words (like "bank" as a river or "bank" as an institution) receive the exact same representation regardless of context.

70Why does TF-IDF often outperform mean-pooled Word2Vec vectors on document classification?

Mean pooling gives equal mathematical weight to all words, diluting strong keywords in semantic noise, whereas TF-IDF heavily favors the discriminative terms crucial for classification.

71How does BERT overcome the polysemy limitation of Word2Vec?

BERT generates contextual embeddings, meaning the exact same word generates completely different vectors depending on the surrounding sentence structure.

72What does "Bidirectional" precisely mean in the BERT architecture?

Unlike causal models (like GPT) that read strictly left-to-right, BERT simultaneously accesses both the left and right context of a token to compute its representation.

73Which two self-supervised tasks are employed during BERT's pre-training phase?

Masked Language Modeling (MLM, predicting 15% of tokens that have been hidden) and Next Sentence Prediction (NSP).

74What is the difference between employing BERT for "Feature Extraction" versus "Fine-Tuning"?

Feature Extraction freezes BERT's internal weights and uses its outputs in a basic classifier, while Fine-Tuning updates all of BERT's parameters specifically for the downstream task.

75What is the primary operational drawback of deploying a fine-tuned BERT model?

It is computationally massive, demanding a GPU for real-time performance and exhibiting inference latencies up to 100–1000 times slower than classical methods on a CPU.

SECTION 06 Transformers & Large Language Models (LLMs) 15 Q
76What three massive limitations of RNNs did the Transformer architecture solve?

It eliminated sequential processing (allowing massive parallelization), solved the vanishing gradient for long-range dependencies, and removed the fixed context vector bottleneck.

77What is the core mechanism of Self-Attention in natural language?

Self-attention allows each token to dynamically compute a relevance score with every other token in the sequence, weighting their importance to build an enriched representation.

78In the attention mechanism equation, what do the matrices Q, K, and V represent?

They represent the Query (what the token seeks), the Key (what information the token offers), and the Value (the actual content transmitted).

79What is the purpose of using Multi-Head Attention rather than a single attention head?

Multiple heads allow the model to specialize simultaneously in different linguistic dimensions, such as subject-verb relations, coreferences, and semantic similarity.

80Why must Positional Embeddings be added to the input of a Transformer?

The pure attention mechanism is permutation invariant and has no innate concept of word order; positional embeddings inject necessary sequence data.

81What is "Masked Self-Attention" and why is it used in the Decoder?

It masks future positions (setting them to $-\infty$) during auto-regressive generation to prevent the model from "cheating" by looking ahead at words it hasn't generated yet.

82What three network sub-components define a standard Transformer Encoder block?

Multi-head attention, a feed-forward network, and residual connections encompassing Layer Normalization (Add & Norm).

83How do the macro-architectures of BERT, GPT, and T5 differ regarding the original Transformer?

BERT utilizes an Encoder-only structure, GPT utilizes a Decoder-only structure, and T5 utilizes the full Encoder-Decoder architecture.

84What does "Scaling" refer to concerning Large Language Models?

Scaling refers to the massive increase in both parameter count (up to hundreds of billions) and training corpus size, which leads to emergent, qualitatively new capabilities.

85What are "emergent capabilities" in LLMs, providing two examples?

They are complex abilities the model was never explicitly programmed for that appear at scale, such as In-Context Learning (few-shot) and Chain-of-Thought reasoning.

86What is the goal of the "Pre-training" stage in the LLM pipeline?

To perform auto-regressive language modeling (predicting the next token) on massive unannotated corpora, allowing the model to acquire broad encyclopedic knowledge and syntax.

87What is achieved during the SFT (Supervised Fine-Tuning) stage of an LLM?

The model learns to follow specific instructions and adopt a conversational format using human-validated instruction-response pairs.

88What is RLHF, and why is it crucial for public-facing LLMs?

Reinforcement Learning from Human Feedback aligns the model with human values (helpfulness, harmlessness, honesty) to minimize toxicity and increase safety.

89How does RAG (Retrieval-Augmented Generation) mitigate LLM hallucinations?

RAG queries an external vector database for precise, up-to-date documents and injects these passages directly into the prompt to ground the LLM's response.

90How does LoRA (Low-Rank Adaptation) allow for efficient fine-tuning?

LoRA freezes all original model weights and injects small, trainable low-rank matrices into the attention layers, updating only a fraction of a percent of parameters and saving massive GPU memory.

SECTION 07 Methodology, Practical Labs & Evaluation 10 Q
91What is the purpose of Gradient Checking before training a complex neural network?

It compares the analytically computed backpropagation gradients against a numerical approximation to verify there are no implementation bugs in the code.

92How do you perform a "Capacity Test" to diagnose a model?

You intentionally try to overfit the model on a tiny subset of data; if the loss does not reach near zero, the architecture lacks expressivity and must be expanded.

93Which standard Keras callback is used to adjust the learning rate during training plateaus?

ReduceLROnPlateau automatically reduces the learning rate when the validation loss stops decreasing.

94In the IMDb lab, why did the word "film" receive a very low IDF weight?

Because "film" is a generic, domain-neutral word that appears in almost every movie review, providing no discriminative signal between positive and negative sentiments.

95In the poetry generation RNN lab, what does a high "Repetition Rate" (4-grams) indicate?

It indicates the model is failing to maintain context and is stuck in a loop, generating the same sequence repeatedly, which is a common flaw in vanilla RNNs.

96Why is K-fold Cross-Validation highly recommended when working with limited training data?

It provides a robust, reliable estimate of the model's performance without permanently sacrificing a fixed portion of the already limited data for a single validation set.

97In the medical CNN labs, why is Image Augmentation applied dynamically via a Generator?

A generator applies random transformations (like rotations and flips) directly in memory for each batch, enriching the dataset infinitely without consuming physical disk storage.

98What does the Type-Token Ratio (TTR) measure when evaluating generated text?

It measures the lexical diversity of the text by comparing the number of unique words (types) against the total number of generated words (tokens).

99According to the course's decision tree, which NLP method should you choose if you require millisecond latency and lack a GPU?

Classical methods like TF-IDF or BoW, which execute in ~1–3 ms per document entirely on CPU infrastructure.

100What is the fundamental "Golden Rule" presented in the course regarding NLP project deployment?

Always establish a simple, interpretable baseline (like TF-IDF) first; only introduce complex architectures (like BERT or LLMs) if they demonstrate a clearly measurable gain on the target metrics.