51. What is BERT in deep learning and what makes it different from GPT?
- BERT and GPT are identical models trained by the same team using the same methodology
- BERT (Google) is an encoder-only Transformer pre-trained with masked language modeling — understanding context from both directions, best for classification and comprehension tasks; GPT (OpenAI) is a decoder-only Transformer pre-trained with next-token prediction — best for text generation tasks
- BERT is for image understanding; GPT is for text understanding — they handle different data types
- GPT is a smaller, less powerful version of BERT designed for edge device deployment
Answer : B Explanation: Both BERT and GPT use the Transformer architecture but differ in design and purpose. BERT (Bidirectional Encoder Representations from Transformers, Google, 2018): Encoder-only Transformer. Pre-training: Masked Language Modeling (MLM) — predict randomly masked tokens using bidirectional context. + Next Sentence Prediction (NSP). Bidirectional — understands each word using both left and right context. Best for: text classification, NER, question answering, semantic similarity, text pair tasks. Fine-tuned for specific tasks. GPT (Generative Pre-trained Transformer, OpenAI): Decoder-only Transformer. Pre-training: autoregressive — predict the next token given previous tokens. Unidirectional (causal) — can only attend to previous tokens. Best for: text generation, completion, summarization, translation, code generation, conversational AI. ChatGPT = GPT-3.5/GPT-4 + RLHF. Modern models: Encoder-only: BERT, RoBERTa, ALBERT, DeBERTa. Decoder-only: GPT series, LLaMA, Gemini, Mistral, Claude. Encoder-Decoder: T5, BART, mT5 — best of both for seq2seq tasks.
52. What is transfer learning in deep learning?
- Transfer learning is a technique for transferring trained model files between different computers
- Transfer learning is the practice of reusing a model trained on one task as the starting point for a new related task — dramatically reducing the training time and data requirements for the new task by leveraging already learned features
- Transfer learning transfers gradients from one model to another to speed up convergence
- Transfer learning is only possible when both the source and target tasks use the same dataset
Answer : B Explanation: Transfer Learning is one of the most important practical techniques in deep learning. How it works: Start with a pre-trained model (e.g., ResNet-50 trained on ImageNet with 1.4M images). Remove the final classification layer. Add new layers for the target task. Fine-tune either: frozen base (only train new layers — faster, less data needed) or full fine-tuning (update all weights with small learning rate — more powerful). Common in CV: ImageNet pre-trained models (ResNet, EfficientNet, ViT) transferred to medical imaging, satellite imagery, industrial defect detection. Common in NLP: BERT, GPT pre-trained on massive text → fine-tuned for sentiment analysis, QA, summarization. Why it works: early layers of neural networks learn general features (edges, textures in CV; syntax, semantics in NLP) that transfer across domains. Later layers learn task-specific features. Foundation Models: large models pre-trained on internet-scale data → fine-tuned for specific tasks. BERT, GPT-4, CLIP, SAM are examples. Few-shot learning: with foundation models, sometimes just providing a few examples in the prompt (no gradient updates) is sufficient.
53. What is the difference between a convolutional layer and a pooling layer in a CNN?
- Convolutional layers reduce spatial dimensions; pooling layers detect features using filters
- A convolutional layer applies learnable filters to detect features — producing feature maps with learned weights; a pooling layer performs a fixed downsampling operation (max or average) — reducing spatial dimensions without learnable parameters
- Pooling layers contain more parameters than convolutional layers due to their complex downsampling
- Convolutional layers are only used in the first layer of CNNs; pooling layers are used throughout
Answer : B Explanation: Both are fundamental CNN components with distinct roles. Convolutional Layer: applies learnable filters (kernels) across the input. Filter slides over the input, computing dot products at each position. Parameters: filter_size × filter_size × in_channels × out_channels + bias. Learns to detect features (edges, textures, shapes, objects). Maintains spatial information. Output size: (input – filter + 2×padding)/stride + 1. Pooling Layer: fixed downsampling operation (no learnable parameters). Max Pooling: takes maximum value in each window → preserves dominant features, provides translation invariance. Average Pooling: takes mean → smoother summary. Global Average Pooling (GAP): averages entire feature map → one value per channel — replaces large FC layers in modern CNNs. Purpose: reduce spatial dimensions → reduces computation. Provides some translation invariance. Controls overfitting. Modern trend: strided convolutions (stride > 1) increasingly replace pooling — the convolution learns its own downsampling, potentially more powerful. EfficientNet, ResNet v2 use strided convolutions. Classic CNN pattern: Input → [Conv → ReLU → Pool] × N → Flatten/GAP → Dense → Softmax.
54. What is data augmentation in deep learning and why is it important?
- Data augmentation is a technique for purchasing and downloading more training data from the internet
- Data augmentation artificially expands the training dataset by applying realistic transformations to existing examples — improving model generalization and reducing overfitting without collecting new data
- Data augmentation is a post-training technique applied after the model has finished training
- Data augmentation is only applicable to text data and cannot be used for image training
Answer : B Explanation: Data Augmentation is one of the most cost-effective ways to improve deep learning models. Image Augmentation: Geometric: Random horizontal/vertical flip, Random rotation, Random crop and resize, Shear, Perspective transform. Color: Color jitter (brightness, contrast, saturation, hue), Gaussian blur, Grayscale conversion. Cutout/Random erasing: mask random regions. Mixup: blend two images and interpolate their labels. CutMix: cut-paste region from another image. AutoAugment/RandAugment: automatically learn best augmentation policies. Text Augmentation: Synonym replacement, Random word insertion/deletion/swap, Back-translation (English → French → English). Audio Augmentation: Time stretching, Pitch shifting, Adding background noise, SpecAugment (mask time/frequency segments). Advanced: Test-time augmentation (TTA) — apply augmentation at inference time and average predictions. Why augmentation works: teaches the model invariances — a cat is still a cat when flipped, rotated, or color-shifted. Prevents memorizing specific visual patterns in training images. Libraries: torchvision.transforms (PyTorch), Albumentations (fast, comprehensive), imgaug.
55. What is the concept of epochs, batch size, and iterations in deep learning training?
- Epoch and iteration are the same thing; batch size is the number of training examples in total
- An epoch is one complete pass through the entire training dataset; batch size is the number of samples processed together in one forward/backward pass; iterations (steps) is the number of batches per epoch — equal to dataset size divided by batch size
- Batch size refers to the number of layers in the network; an epoch is one update to the weights
- More epochs always lead to better models regardless of batch size and learning rate settings
Answer : B Explanation: Understanding these terms is essential for implementing deep learning training loops. Epoch: one complete pass through the entire training dataset. Multiple epochs needed — typically 10-200+ for deep learning tasks. More epochs → more exposure to data (risk of overfitting). Batch Size: number of training examples processed together before updating weights. Small batch (8-32): noisier gradient estimates, potentially better generalization, less GPU memory needed. Large batch (256-4096): stable gradients, parallelization efficient, faster per epoch but may converge to sharp minima. Mini-batch SGD (most common): balance between speed and gradient quality. Iterations (steps): iterations per epoch = dataset size / batch size. Example: 50,000 training images, batch size 100 → 500 iterations per epoch. If training for 100 epochs → 50,000 total weight updates. Important hyperparameters: Learning rate: most critical. Batch size: affects gradient quality. Number of epochs: combined with early stopping. Learning rate schedule: adjust LR over training. Rule of thumb: linear scaling rule — when increasing batch size k×, multiply learning rate by k. Used in distributed training.
56. What is the difference between a loss function and an optimizer in deep learning?
- A loss function updates the weights; an optimizer measures how wrong predictions are
- A loss function measures the difference between predictions and true values (what to minimize); an optimizer uses the gradients from the loss function to update the model’s weights (how to minimize the loss)
- Loss functions are used only during testing; optimizers are used only during training
- The loss function and optimizer are the same component with different names in different frameworks
Answer : B Explanation: Loss Function: quantifies how wrong the model is — the objective to minimize. Common loss functions: Mean Squared Error (MSE): for regression. L = (1/n)Σ(y – ŷ)². Binary Cross-Entropy: for binary classification. L = -(y·log(ŷ) + (1-y)·log(1-ŷ)). Categorical Cross-Entropy: for multi-class classification with softmax output. Huber Loss: robust regression (combines MSE and MAE). Contrastive Loss, Triplet Loss: for metric learning. Focal Loss: for class imbalance (used in RetinaNet). Optimizer: algorithm that uses gradients to update weights toward the minimum loss. SGD (Stochastic Gradient Descent): w = w – α×∂L/∂w. Basic, noisy. Momentum: accelerates in consistent directions. Adam (Adaptive Moment Estimation): adaptive learning rates per parameter. Default for most deep learning — α=0.001, β₁=0.9, β₂=0.999. AdamW: Adam + weight decay decoupled — better generalization for Transformers. RMSprop: good for RNNs. Adagrad, Adadelta. Choosing: Classification → Cross-Entropy loss + Adam optimizer. Regression → MSE/Huber loss + Adam or SGD+Momentum.
57. What is deep learning’s role in computer vision?
- Deep learning in computer vision only classifies pre-labeled images and cannot detect new objects
- Deep learning has revolutionized computer vision — enabling machines to surpass human-level performance on tasks including image classification, object detection, semantic segmentation, face recognition, medical image analysis, and visual question answering through learned hierarchical representations
- Deep learning’s role in computer vision is limited to grayscale image processing only
- Computer vision using deep learning requires the objects of interest to be manually highlighted first
Answer : B Explanation: Deep learning transformed computer vision starting with AlexNet’s 2012 ImageNet victory. Key CV tasks and deep learning approaches: Image Classification: ResNet, EfficientNet, Vision Transformer (ViT) — single label per image. AlexNet (2012) → VGG → GoogLeNet → ResNet → DenseNet → EfficientNet → ViT → ConvNeXt. Object Detection: YOLO (real-time), Faster R-CNN (high accuracy), DETR (transformer-based). Semantic Segmentation: U-Net (medical), DeepLab, SegFormer. Instance Segmentation: Mask R-CNN. Face Recognition: FaceNet, ArcFace — used in iPhone Face ID, Aadhaar, law enforcement. Optical Character Recognition (OCR): TrOCR, Tesseract with deep learning. Image Generation: GANs (StyleGAN), Diffusion Models (Stable Diffusion, DALL-E, Midjourney). Visual Question Answering: CLIP, Flamingo, LLaVA, GPT-4V. Pose Estimation: MediaPipe, OpenPose. Medical Imaging: pathology slide analysis, radiology (chest X-ray, CT, MRI), dermatology, ophthalmology. Key milestone: AlexNet (2012) achieved 15.3% top-5 error on ImageNet vs 26.2% for the runner-up — demonstrating deep learning’s superiority over traditional CV methods.
58. What is the convolution operation in deep learning?
- Convolution in deep learning is the same mathematical operation as the cross-correlation in signal processing
- Convolution is a mathematical operation where a learnable filter (kernel) slides over the input, computing element-wise products and summing them — detecting specific patterns (edges, textures) at every spatial location through weight sharing
- Convolution in deep learning refers to the mixing of multiple training datasets before processing
- Convolution is only applied to grayscale images and requires separate processing for color images
Answer : B Explanation: Convolution is the fundamental operation in CNNs. Mathematical operation: (f * g)[n] = Σ f[m] × g[n-m]. In deep learning, technically cross-correlation is used (no flipping), but called convolution. How it works: a filter (e.g., 3×3×3 for RGB image) slides across the input image. At each position, compute element-wise product between filter and the input patch, then sum → one value in output feature map. For a 6×6 image with 3×3 filter, stride 1: output is 4×4 feature map. With padding=1: output is 6×6 (same size). Multiple filters: each filter produces one feature map — a layer with 64 filters produces a 64-channel output. Parameter sharing: one set of weights shared across all positions — exploits spatial stationarity. Feature map value = filter’s response at that location. What different filters detect: Early layers: edges (horizontal, vertical, diagonal), corners. Mid layers: textures, patterns, parts of objects. Deep layers: complex objects, semantic concepts. Dilated convolution: gaps between filter elements → larger receptive field with same parameters. Depthwise separable convolution: factorize into depthwise + pointwise → fewer parameters (used in MobileNet).
59. What is the difference between image classification and image recognition?
- Image classification assigns multiple labels per image; image recognition assigns only one label
- Image classification assigns one or more predefined class labels to an entire image; image recognition is a broader term encompassing classification plus also identifying specific entities like faces, text, or landmarks within images
- Image recognition is the older term and has been completely replaced by image classification in DL
- Image classification works on grayscale images only; image recognition requires color images
Answer : B Explanation: Image Classification: input → single image. Output → one class label (or probabilities for multiple classes). “Is this a cat, dog, or bird?” Binary: is this a tumor or not? Multi-class: which of 1000 ImageNet categories? Multi-label: does this image contain a cat AND a dog? Models: ResNet, VGG, EfficientNet, Vision Transformer. Benchmark: ImageNet (1.4M images, 1000 classes) — classification error reduced from 26% (2011) to 1.6% (2021). Image Recognition (broader): includes classification + identification of specific instances. Face recognition: which specific person is this? Optical Character Recognition (OCR): read text in images. Logo recognition, landmark recognition. Image understanding tasks beyond labeling. Applications: Image classification: medical diagnosis (disease type), product categorization, content moderation. Image recognition: access control (face ID), document digitization, visual search (Google Lens, Pinterest Lens). Key models: Classification: ResNet-50 (25M params, ~76% top-1 accuracy), EfficientNet-B7 (66M params, ~84%), ViT-L (307M params, ~88%). Classification is the foundation — once learned, it transfers to detection, segmentation, and generation tasks through fine-tuning.
60. What is deep learning’s role in speech recognition?
- Deep learning in speech recognition only converts speech to text in English with no other languages
- Deep learning has transformed speech recognition — enabling end-to-end models that directly convert audio waveforms to text, achieving human-level accuracy on many benchmarks through architectures like Deep Speech, Wav2Vec, and Whisper
- Speech recognition using deep learning requires manually transcribed data for every 10 seconds of audio
- Deep learning only improved speech recognition speed, not its accuracy over traditional methods
Answer : B Explanation: Speech Recognition (Automatic Speech Recognition / ASR) evolution with deep learning: Pre-deep learning: GMM-HMM (Gaussian Mixture Model — Hidden Markov Model) systems required manual feature engineering (MFCC features). Deep learning era: Deep Speech (Baidu, 2014): RNN/CNN-based, CTC loss — end-to-end training without alignment. Wav2Letter (Facebook): CNN-based end-to-end. Listen, Attend and Spell (Google): sequence-to-sequence with attention. Transformer-based: Conformer (CNN + Transformer) — state-of-the-art on many benchmarks. Wav2Vec 2.0 (Facebook, 2020): self-supervised pre-training on unlabeled audio → fine-tune on small labeled dataset. Whisper (OpenAI, 2022): trained on 680K hours of multilingual audio — robust, multilingual, multi-task (transcription + translation). CTC (Connectionist Temporal Classification) loss: allows training without explicit alignment between audio frames and text tokens. Applications: Virtual assistants (Siri, Alexa, Google Assistant), Live captioning, Medical transcription, Call center automation, Voice search. Remaining challenges: accented speech, noisy environments, code-switching (mixing languages), rare words, proper nouns.
