# Top 39 Deep Learning Interview Questions (2026 Guide)

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/blog/top-deep-learning-interview-questions
Source observed: 2026-11-04T22:31:28.481Z
Last checked: 2026-11-04T22:31:28.481+00:00
Indexed: 2026-11-06T17:58:56.478+00:00

---

# Top 39 Deep Learning Interview Questions (2026 Guide)

We created this machine-learning interview guide for candidates preparing for deep-learning interviews. It contains numbered questions, sample answers, explanations of core concepts, practical implementation examples, and links to related Aced interview-course lessons and questions.

The guide is an excerpt from our [machine learning engineer interview course](https://www.aced.io/courses/ml-engineer?ref=exponent-blog.ghost.io), created with help from machine-learning engineers at Google, Snap, Waymo, Meta, and Amazon. Derrick Mwiti, a senior data scientist and course instructor, compiled it; Satyajit Gupte, an interview coach and senior machine-learning engineer, reviewed it.

## Quick links

- [Design Instagram ranking model](https://www.aced.io/courses/ml-engineer/ml-system-design/design-instagram-feed-ranking-model?ref=exponent-blog.ghost.io) — Meta MLE example
- [Describe linear regression](https://www.aced.io/courses/ml-engineer/ml-concepts-interviews/describe-linear-regression?ref=exponent-blog.ghost.io) — Amazon MLE example
- [Implement k-means clustering](https://www.aced.io/courses/ml-engineer/ml-coding/implement-k-means-algorithm?ref=exponent-blog.ghost.io) — Snap MLE example

## Deep Learning Fundamentals

Neural networks iteratively adjust internal parameters to minimize errors and improve predictions.

### 1. How do neural networks learn from data?

Neural networks compare predictions with actual values and adjust weights to minimize a loss or cost function. Classification and regression use task-appropriate loss functions. As learning progresses, the loss should decrease. See our [neural-network lesson](https://www.aced.io/courses/ml-concepts-questions-data-scientists/neural-network?ref=exponent-blog.ghost.io). This question was asked at Nvidia: [Explain deep learning to non-technical stakeholders](https://www.aced.io/questions/541/explain-deep-learning-non-technical-audience?ref=exponent-blog.ghost.io).

### 2. Explain how epoch, batch, and iteration differ

An **epoch** is one complete pass through the dataset. A **batch** is a subset processed together. An **iteration** is one weight update. With 10,000 images and a batch size of 200, one epoch contains 50 iterations.

### 3. Explain gradient descent

[Gradient descent](https://www.aced.io/courses/statistics-experimentation-questions/gradient-descent-and-model-optimization?ref=exponent-blog.ghost.io) minimizes error by adjusting parameters to reduce the cost function. The process uses differentiation to determine the slope and move toward a minimum.

## Training and Optimization

### 4. What is batch normalization?

Batch normalization normalizes inputs so the mean output is close to `0` and the standard deviation is close to `1`. During training it uses the current batch’s mean and standard deviation; during prediction it uses moving averages computed during training. Learn more through [Implement batch normalization with NumPy](https://www.aced.io/questions/3425/implement-batch-normalization-numpy?ref=exponent-blog.ghost.io). The layer also has learnable scale and shift parameters.

### 5. What is the difference between batch, mini-batch, and stochastic gradient descent?

- **Batch gradient descent:** computes each gradient using the entire dataset; it is accurate but slow.
- **Stochastic gradient descent (SGD):** uses one training example per iteration; it is faster but produces more variable updates.
- **Mini-batch gradient descent:** uses a small subset of data, balancing SGD’s speed with batch gradient descent’s stability.

An MLE from Snapchat answers this in [Explain mini-batch and stochastic gradient descent](https://www.aced.io/courses/ml-concepts-questions-data-scientists/gradient-descent?ref=exponent-blog.ghost.io).

### 6. Explain loss and activation functions

An activation function determines a neural network’s output. Regression commonly produces a continuous value; classification commonly produces category probabilities. Sigmoid and softmax constrain outputs to values between 0 and 1. Classification often uses binary cross-entropy, while regression often uses mean squared error. See our [activation-function lesson](https://www.aced.io/courses/ml-concepts-questions-data-scientists/logistic-regression?ref=exponent-blog.ghost.io).

### 7. What are vanishing and exploding gradients?

- **Vanishing gradients:** gradients become too small, causing slow learning and difficulty training deep networks.
- **Exploding gradients:** gradients become excessively large, causing unstable, oversized weight updates.

### 8. How are weights initialized in neural networks?

Weights and biases are commonly initialized randomly, and initialization affects convergence. Methods include ones, zeros, uniform distributions, and normal distributions. The guide describes a normal distribution with zero mean and variance `2/n`, where `n` is the number of neurons in the layer.

### 9. What is overfitting, and how can it be avoided?

[Overfitting](https://www.aced.io/questions/3487/explain-overfitting?ref=exponent-blog.ghost.io) occurs when a model performs very well on training data but poorly on unseen data. Mitigation techniques include data augmentation, L1/L2 regularization, dropout, training/validation/test splits, and early stopping.

### 10. How do you set batch size, and does it affect other hyperparameters?

Start with a small batch size such as 32, increase it while staying within GPU-memory limits, and tune it for performance. Larger batches generally permit higher learning rates and may need fewer epochs; smaller batches generally need lower learning rates because their updates are noisier. We recommend using the largest batch size that fits in GPU memory and setting batch size before tuning learning rate, momentum, and other hyperparameters.

### 11. How do you prioritize hyperparameter tuning?

Prioritize:

1. **Learning rate**, which directly affects convergence and stability.
2. **Optimizer type**, which affects convergence speed and accuracy.
3. **Number of epochs**, which affects training duration and overfitting or underfitting.

The tuning budget depends on performance goals, resources, financial limits, and deadlines. For example, a 90% accuracy target can define when to stop tuning.

### 12. How do you diagnose and improve training throughput?

Use TensorBoard or PyTorch Profiler to monitor epoch duration, inference time, and GPU utilization. Improve throughput by optimizing the data pipeline with prefetching, using GPU-accelerated libraries, increasing batch size when memory permits, simplifying the architecture, using mixed precision, and using distributed training across multiple GPUs.

### 13. What do you do when training is unstable?

- Lower or schedule the learning rate.
- Increase batch size cautiously; the guide uses 32 as a starting point.
- Simplify or adjust the architecture.
- Apply dropout, L1/L2 regularization, or early stopping.
- Shuffle the data.
- Use gradient clipping to control exploding gradients.
- Use suitable activations such as ReLU and normalize inputs with batch normalization.

### 14. Explain the learning rate

The learning rate controls the size of each weight update. If it is too low, training is slow and can become stuck in local minima. If it is too high, updates can overshoot, diverge, or oscillate instead of converging.

### 15. What is the difference between pre-training and fine-tuning?

- **Pre-training:** trains a model on a large, generic dataset to acquire general knowledge.
- **Fine-tuning:** continues training on a smaller, task-specific dataset, such as a medical dataset. It typically takes less time than pre-training.

## Advanced Architectures

### 16. What are autoencoders?

Autoencoders learn efficient data representations, often for dimensionality reduction. They compress an input into a low-dimensional latent vector and reconstruct the original input from it.

### 17. What are the different layers in a CNN?

A convolution layer applies a kernel or filter—often a `3x3` matrix—across an image, multiplying corresponding values and summing them to create a feature map. For the example in the guide:

`3 × 1 + 5 × 0 + 2 × 0 + 9 × 1 + 7 × 1 + 5 × 0 + 2 × 0 + 0 × 0 + 6 × 1 = 25`

The kernel moves by a **stride**. **Padding** adds zeros around the border:

- **Same:** output has the same dimensions as the input.
- **Valid:** no padding; output is smaller.

ReLU introduces non-linearity by changing negative values to zero while retaining positive values. Pooling reduces feature-map dimensions; for example, a `2x2` max-pooling filter reduces a `4x4` feature map to `2x2`. Dropout randomly sets some units to zero during training. Flattening converts the pooled map into a one-dimensional array for a Dense layer. Sigmoid is commonly used for binary classification and softmax for multiclass classification.

![CNN layers diagram](https://storage.ghost.io/c/a5/f5/a5f5c2f0-4c62-43c7-891b-662a0b6d68b3/content/images/2024/09/CNN-Layers.png)

![Convolution input, filter, and output animation](https://storage.ghost.io/c/a5/f5/a5f5c2f0-4c62-43c7-891b-662a0b6d68b3/content/images/2024/09/input-output-feature-map.gif)

![CNN padding diagram](https://storage.ghost.io/c/a5/f5/a5f5c2f0-4c62-43c7-891b-662a0b6d68b3/content/images/2024/09/Padding.png)

![Max-pooling animation](https://storage.ghost.io/c/a5/f5/a5f5c2f0-4c62-43c7-891b-662a0b6d68b3/content/images/2024/09/maxpool.gif)

### 18. Why are transformers widely used in natural-language processing?

The Transformer architecture was introduced in [Attention Is All You Need](https://arxiv.org/abs/1706.03762?ref=exponent-blog.ghost.io). It replaces recurrence and convolution with attention, enabling parallel training. Stacked self-attention and fully connected layers in encoder and decoder blocks model long-range dependencies efficiently and handle sequence data effectively.

### 19. What is gradient clipping?

Gradient clipping limits gradients to a maximum value to prevent exploding gradients. With `clipvalue`, values below `-0.5` are capped at `-0.5` and values above `0.5` at `0.5`. With `clipnorm`, a gradient vector whose norm exceeds `1` is rescaled to norm `1`.

```python
# clipvalue
model.compile(
    optimizer=tf.keras.optimizers.Adam(clipvalue=0.5),
    loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
    metrics=[tf.keras.metrics.SparseCategoricalAccuracy()],
)

# clipnorm
model.compile(
    optimizer=tf.keras.optimizers.Adam(clipnorm=1.0),
    loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
    metrics=[tf.keras.metrics.SparseCategoricalAccuracy()],
)
```

### 20. Write a function that computes 2D convolution using PyTorch

This question was asked in Meta data-science interviews; practice it with [Implement a 2D convolutional filter](https://www.aced.io/courses/data-science/ml-coding-data-scientist-questions/implement-2d-convolutional-filter?ref=exponent-blog.ghost.io).

```python
import torch
import torch.nn as nn

def conv2d(input, weight, bias=None, stride=1, padding=0):
    """Computes a 2D convolution.

    input: 4D tensor (batch_size, in_channels, in_height, in_width)
    weight: 4D tensor (out_channels, in_channels, kernel_height, kernel_width)
    bias: optional 1D tensor (out_channels,)
    stride: convolution stride; default 1
    padding: convolution padding; default 0
    returns: 4D tensor (batch_size, out_channels, out_height, out_width)
    """
    batch_size, in_channels, in_height, in_width = input.shape
    out_channels, _, kernel_height, kernel_width = weight.shape
    conv_layer = nn.Conv2d(
        in_channels,
        out_channels,
        kernel_size=(kernel_height, kernel_width),
        bias=bias,
        stride=stride,
        padding=padding,
    )
    conv_layer.weight = nn.Parameter(weight)
    return conv_layer(input)
```

### 21. What is the difference between pre-training and fine-tuning?

Pre-training learns general knowledge from a large generic dataset. Fine-tuning adapts the model to a smaller task-specific dataset and generally takes less time.

### 22. How does a transformer-based language model generate text?

A prompt is converted into word or subword tokens, embedded, and combined with positional encodings. Self-attention layers evaluate token relationships and produce next-token probabilities. Decoding can use greedy decoding, beam search, or top-k sampling. Each selected token is appended and fed back into the model until the desired length or an end-of-sequence token is reached; detokenization converts the tokens into text.

### 23. What is `zero_grad()` in PyTorch, and when is it used?

`zero_grad()` resets gradients to zero before a new backward pass so gradients from the previous iteration do not accumulate.

```python
import torch
import torch.optim as optim

model = torch.nn.Linear(1, 1)
optimizer = optim.SGD(model.parameters(), lr=0.01)
inputs = torch.randn(1, 1, requires_grad=True)
target = torch.randn(1, 1)

for _ in range(5):
    output = model(inputs)
    loss = torch.nn.functional.mse_loss(output, target)
    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
```

### 24. What is the difference between masked and causal language modeling?

- **Causal language modeling:** predicts the next token using only tokens to the left; it is unidirectional.
- **Masked language modeling:** masks selected tokens and predicts them using context on both sides; it is bidirectional.

## Practical Applications

### 25. How do you handle imbalanced datasets?

Use class weights during training and consider undersampling the majority class.

```python
weights = [1.013, 0.889, 1.007, 0.978, 1.027, 1.106, 1.013, 0.957, 1.025, 1.008]
model.compile(
    optimizer=tf.keras.optimizers.SGD(),
    loss=tf.keras.losses.SparseCategoricalCrossentropy(),
    loss_weights=weights,
    metrics=['accuracy'],
)
```

### 26. How do you implement a custom loss function in TensorFlow?

Define a function accepting true and predicted values and returning the loss.

```python
import tensorflow as tf

def custom_loss_function(y_true, y_pred):
    squared_difference = tf.square(y_true - y_pred)
    return tf.reduce_mean(squared_difference, axis=-1)

model.compile(optimizer='adam', loss=custom_loss_function)
```

### 27. How do you implement a custom training loop in TensorFlow?

Use batches, compute loss and gradients, apply gradients, and track loss and accuracy by epoch.

```python
from tqdm.notebook import trange
import tensorflow as tf

train_loss_results = []
train_accuracy_results = []
num_epochs = 10

for epoch in trange(num_epochs):
    epoch_loss_avg = tf.keras.metrics.Mean()
    epoch_accuracy = tf.keras.metrics.SparseCategoricalAccuracy()

    for x, y in training_data:
        loss_value, grads = grad(model, x, y)
        optimizer.apply_gradients(zip(grads, model.trainable_variables))
        epoch_loss_avg.update_state(loss_value)
        epoch_accuracy.update_state(y, model(x, training=True))

    train_loss_results.append(epoch_loss_avg.result())
    train_accuracy_results.append(epoch_accuracy.result())
    print(
        f"Epoch {epoch + 1}: Loss: {epoch_loss_avg.result():.3f}, "
        f"Accuracy: {epoch_accuracy.result():.3%}"
    )
```

### 28. What is the difference between instance and semantic segmentation?

**Semantic segmentation** assigns each pixel an object-class label; multiple objects of the same class share a label. **Instance segmentation** assigns separate masks to individual objects of the same class.

### 29. Explain transfer learning

Transfer learning repurposes a model trained for one related task. It is common in computer vision and NLP, reduces training time, and can reduce generalization error.

Steps:

1. Obtain a pre-trained model.
2. Create a base model from it.
3. Freeze the base layers.
4. Add trainable task-specific layers.
5. Train the new layers.
6. Fine-tune for improved performance.

The guide’s TensorFlow example uses MobileNetV3Small with `IMAGE_SIZE = 224`, ImageNet weights, frozen base layers, data augmentation, global average pooling, dropout `0.2`, and a final Dense layer. It then demonstrates fine-tuning by changing layer trainability.

### 30. What is reinforcement learning from human feedback (RLHF)?

RLHF aligns a large language model with human preferences. The process is:

1. Supervised fine-tuning on a high-quality prompt dataset.
2. Human raters rank 4–9 responses generated by the fine-tuned model.
3. A reward model learns from the rankings; its classification layer is changed to regression to output a reward score.
4. Proximal policy optimization (PPO) fine-tunes the model using that reward.

### 32. What challenges and ethical considerations affect large language models?

- **Bias and fairness:** internet-scale training data can transmit bias and produce discriminatory outcomes.
- **Misinformation:** probabilistic models can generate incorrect information.
- **Privacy:** models may reveal private information encountered during training.
- **Environmental impact:** training requires substantial computation and can contribute to carbon emissions.

### 33. What problems does retrieval-augmented generation solve?

RAG grounds language-model responses in retrieved external documents. The workflow loads relevant documents, creates embeddings, stores documents and embeddings in a vector database, retrieves similar documents—such as with cosine similarity—and passes them to the language model.

It addresses context-window limits, hallucinations, stale information, lack of source material, and some risks of private-information leakage by retrieving current external data.

### 34. Why prefer CNNs over ANNs for image classification?

CNNs generally have fewer parameters because of convolution and pooling, making them easier to train. They also extract image features such as edges and textures more effectively.

### 35. Discuss computer-vision data augmentation

Augmentation increases image diversity without collecting new data. Techniques include rotation, scaling, shearing, flipping, brightness/hue/contrast changes, Gaussian noise, Mixup, and CutMix.

### 36. Implement learning-rate scheduling in PyTorch

PyTorch provides `StepLR`, `MultiStepLR`, `ExponentialLR`, and `ReduceLROnPlateau`.

```python
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
import torch.nn as nn

model = nn.Linear(10, 2)
optimizer = optim.SGD(model.parameters(), lr=0.1)
scheduler = lr_scheduler.StepLR(optimizer, step_size=5, gamma=0.5)

for epoch in range(20):
    optimizer.step()
    scheduler.step()
```

### 37. Implement a variational autoencoder in TensorFlow/Keras

The guide’s example defines a VAE with `latent_dim = 2` and input shape `(img_size, img_size, 3)`. Its encoder uses Conv2D layers with 16, 32, 128, and 256 filters; creates `z_mean` and `z_log_var`; and samples with the reparameterization trick. Its decoder uses Dense, Reshape, Conv2DTranspose layers, and a final three-channel sigmoid Conv2D layer.

```python
from tensorflow.keras.layers import Input, Conv2D, Flatten, Dense, Lambda, Reshape, Conv2DTranspose
from tensorflow.keras.models import Model
import tensorflow.keras.backend as K
import numpy as np

latent_dim = 2
input_shape = (img_size, img_size, 3)

inputs = Input(shape=input_shape)
x = Conv2D(16, (3, 3), activation='relu', padding='same')(inputs)
x = Conv2D(32, (3, 3), activation='relu', strides=(2, 2), padding='same')(x)
x = Conv2D(128, (3, 3), activation='relu', padding='same')(x)
x = Conv2D(256, (3, 3), activation='relu', padding='same')(x)
shape_before_flattening = K.int_shape(x)
x = Flatten()(x)
z_mean = Dense(latent_dim)(x)
z_log_var = Dense(latent_dim)(x)

def sampling(args):
    z_mean, z_log_var = args
    epsilon = K.random_normal(shape=(K.shape(z_mean)[0], latent_dim))
    return z_mean + K.exp(z_log_var / 2) * epsilon

z = Lambda(sampling)([z_mean, z_log_var])
decoder_input = Input(K.int_shape(z)[1:])
x = Dense(np.prod(shape_before_flattening[1:]), activation='relu')(decoder_input)
x = Reshape(shape_before_flattening[1:])(x)
x = Conv2DTranspose(128, (2, 2), activation='relu', padding='same')(x)
x = Conv2DTranspose(64, (2, 2), activation='relu', padding='same', strides=(2, 2))(x)
x = Conv2DTranspose(32, (2, 2), activation='relu', padding='same')(x)
x = Conv2DTranspose(16, (2, 2), activation='relu', padding='same')(x)
x = Conv2D(3, (3, 3), activation='sigmoid', padding='same')(x)

encoder = Model(inputs, [z_mean, z_log_var, z], name='encoder')
decoder = Model(decoder_input, x, name='decoder')
outputs = decoder(encoder(inputs)[2])
vae = Model(inputs, outputs, name='vae')
```

### 38. What is federated learning?

Federated learning lets devices collaboratively improve a shared model without exchanging raw data. A model is initially trained on proxy data, downloaded to devices, and refined using local data.

![Federated learning diagram](https://storage.ghost.io/c/a5/f5/a5f5c2f0-4c62-43c7-891b-662a0b6d68b3/content/images/2024/09/Federated-Learning.png)

Benefits include privacy because sensitive data stays off the cloud, lower latency and power consumption through local training, and potentially better generalization from decentralized data.

### 39. Discuss model quantization for large language models

Quantization lowers weight precision—for example, from `float32` to `float16`—to reduce memory and compute requirements. It supports deployment on constrained environments such as edge and mobile devices, with reduced memory footprint, faster inference, lower power consumption, and cost savings.

- **Post-training quantization (PTQ):** applied after training without training-data access; simpler but may reduce accuracy slightly.
- **Quantization-aware training (QAT):** integrated into training so the model adapts to lower precision and generally preserves accuracy better.

Techniques include weight quantization, activation quantization, and hybrid quantization. Challenges include accuracy degradation and limited hardware support.

## Interview preparation

Deep learning is broad, so this guide cannot cover every possible question. We recommend our [data science interview course](https://www.aced.io/courses/data-science?ref=exponent-blog.ghost.io), a [free mock interview session](https://www.aced.io/practice?ref=exponent-blog.ghost.io), or [interview coaching](https://www.aced.io/coaching?category=mock_interviews&role=data-science&ref=exponent-blog.ghost.io).

- [Browse machine-learning engineer interview questions](https://www.aced.io/questions?role=ml-engineer&src=blog)
- [Book time with a machine-learning engineer coach](https://www.aced.io/coaching?role=ml-engineer), including mock interviews, career coaching, and resume review
- [Create a free account](https://www.aced.io/signup?src=blog)

## Related courses

- [Machine Learning Engineer Interview Prep Course](https://www.aced.io/courses/ml-engineer) — `6 courses`, `9,400 students`; covers ML system design, core concepts, coding, behavioral interviews, mock interviews, frameworks, and advice for roles at Meta, Google, Amazon, Apple, Microsoft, Nvidia, and other companies.
- [Behavioral Interviews: A Practical Guide for Engineers](https://www.aced.io/courses/eng-behavioral) — `28 lessons`; covers senior-plus behavioral interviews, project presentation, avoiding downleveling, and offers advice from staff and principal engineers from Meta, Netflix, Google, and more.

## Related blog posts

- [Top AI/ML Companies Hiring Now](https://www.aced.io/blog/best-ai-ml-companies-hiring-2024) — 3 min read
- [Top 20 Python ML Interview Questions and Answers (2026 Guide)](https://www.aced.io/blog/top-python-machine-learning-interview-questions) — 13 min read
- [Machine Learning Interview Questions & Answers (2026)](https://www.aced.io/blog/top-machine-learning-interview-questions) — 15 min read
- [Machine Learning System Design Interview (2026 Guide)](https://www.aced.io/blog/machine-learning-system-design-interview-guide) — 12 min read

Aced is formerly Exponent. We also provide interview courses, interview questions, practice, coaching, resume review, salary negotiation, job referrals, and preparation for product management, forward-deployed engineering, engineering management, software engineering, system design, data science, machine learning, data engineering, AI engineering, investment banking, generative AI, security engineering, TPM, solutions architecture, UX/product design, and BizOps and strategy.

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fblog%2Ftop-deep-learning-interview-questions&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fblog%2Ftop-deep-learning-interview-questions). Opening a form does not execute a tool.