Docsity

DEEP LEARNING OPTIMIZATION AND REGULARIZATION EXAM SCRIPT WITH VERIFIED QUESTIONS AND ANSW, Exams of Advanced Algorithms

Toggle sidebar
bg1
DEEP LEARNING OPTIMIZATION AND
REGULARIZATION EXAM SCRIPT WITH
VERIFIED QUESTIONS AND ANSWERS
●● 2 Python collection complexity
Answer: List indexing is O(1). Dictionary and set lookup are O(1) on
average. Heap insertion and removal are O(log n).
●● 3 Generators
Answer: A generator yields values lazily. It reduces memory from
storing an entire sequence and is useful for streaming large datasets.
●● 4 NumPy shapes axes and dtypes
Answer: An axis identifies the dimension reduced or transformed. Track
every tensor shape explicitly and choose dtypes carefully because
integer overflow and low precision can cause bugs.
●● 5 Broadcasting
Answer: Align shapes from the right. Each aligned dimension must
match or one must equal 1. Missing leading dimensions behave like size
1.
●● 6 NumPy views and copies
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15

Partial preview of the text

Download DEEP LEARNING OPTIMIZATION AND REGULARIZATION EXAM SCRIPT WITH VERIFIED QUESTIONS AND ANSW and more Exams Advanced Algorithms in PDF only on Docsity!

DEEP LEARNING OPTIMIZATION AND

REGULARIZATION EXAM SCRIPT WITH

VERIFIED QUESTIONS AND ANSWERS

●● 2 Python collection complexity Answer: List indexing is O(1). Dictionary and set lookup are O(1) on average. Heap insertion and removal are O(log n). ●● 3 Generators Answer: A generator yields values lazily. It reduces memory from storing an entire sequence and is useful for streaming large datasets. ●● 4 NumPy shapes axes and dtypes Answer: An axis identifies the dimension reduced or transformed. Track every tensor shape explicitly and choose dtypes carefully because integer overflow and low precision can cause bugs. ●● 5 Broadcasting Answer: Align shapes from the right. Each aligned dimension must match or one must equal 1. Missing leading dimensions behave like size

●● 6 NumPy views and copies

Answer: Basic slicing and transpose usually create views. Advanced indexing and Boolean indexing create copies. Mutating a writable view can change the original array. ●● 7 Reshape and transpose Answer: Reshape changes dimension grouping while transpose changes axis order. Squeeze removes size 1 axes and expand_dims inserts a size 1 axis. ●● 8 Matrix multiplication and einsum Answer: Elementwise multiplication requires broadcast-compatible shapes. Matrix multiplication contracts an inner dimension. Einsum expresses named axis contractions and can replace complex transpose and sum code. ●● 9 Stable vectorized tensor operations Answer: Prefer vectorized batched operations. Subtract maxima before exponentiation. Protect zero denominators. Mask invalid values before top k or softmax and use take_along_axis for batched gathers. ●● 10 Why convolution works for images Answer: Convolution uses locality and parameter sharing. It learns spatial patterns with far fewer parameters than a fully connected layer and is translation equivariant away from boundary effects.

●● 16 Convolution parameter count Answer: Parameters equal Cout times Cin divided by G times Kh times Kw plus Cout when bias is present. ●● 17 Convolution computational cost Answer: MACs equal B times Cout times Hout times Wout times Cin divided by G times Kh times Kw. State whether one MAC counts as one operation or two FLOPs. ●● 18 Receptive field recurrence Answer: Start with receptive field R equal 1 and jump J equal 1. Then R new equals R plus open parenthesis effective K minus 1 close parenthesis times J and J new equals J times stride. ●● 19 Pooling Answer: Max pooling keeps the maximum in each window and provides local invariance. Average pooling computes a mean. Pooling has no trainable parameters. ●● 20 Convolution forward implementation Answer: Extract each padded dilated input patch and compute a dot product with every filter. Vectorized versions use sliding windows with einsum or im2col followed by matrix multiplication.

●● 21 Convolution backward propagation Answer: Bias gradients sum upstream gradients. Weight gradients correlate input patches with upstream gradients. Input gradients distribute weighted upstream gradients and add overlapping contributions. ●● 22 Computational graphs and chain rule Answer: A computational graph decomposes a function into local operations. Backpropagation applies the chain rule in reverse topological order. ●● 23 Vector Jacobian product Answer: Given upstream gradient v and Jacobian J backpropagation computes vJ without constructing the full Jacobian. This is reverse mode automatic differentiation. ●● 24 Linear layer backward equations Answer: For Z equal XW plus b use dW equal X transpose times dZ. Use db equal the batch sum of dZ and dX equal dZ times W transpose. ●● 25 Activation derivatives Answer: ReLU derivative is 1 for positive inputs and 0 otherwise. Sigmoid derivative is sigmoid times one minus sigmoid. Tanh derivative is one minus tanh squared.

●● 31 Finite difference gradient checking Answer: Estimate one derivative with loss at theta plus epsilon minus loss at theta minus epsilon divided by 2 epsilon. Compare using relative error and avoid nondifferentiable points. ●● 32 What autograd computes Answer: Autograd records differentiable operations and saved values during the forward pass. Backward traverses the graph and computes vector Jacobian products while accumulating shared gradients. ●● 33 Mini batch gradient descent Answer: A mini batch gives a noisy but efficient gradient estimate. Smaller batches use less memory and add noise while larger batches improve hardware utilization and gradient stability. ●● 34 Momentum Answer: Momentum maintains a moving average of gradients or updates. It accelerates movement along consistent directions and reduces oscillation across steep directions. ●● 35 RMSProp Answer: RMSProp maintains an exponential average of squared gradients and divides each gradient by its root mean square plus epsilon.

●● 36 Adam Answer: Adam combines first and second gradient moments. Apply bias correction to both moments and update parameters using corrected first moment divided by the square root of corrected second moment. ●● 37 Learning rate schedules Answer: Warmup gradually increases the learning rate to prevent unstable early steps. Step linear or cosine decay reduces it later for more precise convergence. ●● 38 Xavier and He initialization Answer: Xavier is commonly used for tanh sigmoid or linear layers. He initialization uses variance 2 divided by fan in for ReLU-like activations. ●● 39 Vanishing exploding gradients and clipping Answer: Small repeated Jacobian factors cause vanishing gradients while large factors cause exploding gradients. Global norm clipping rescales all gradients together when their combined norm is too large. ●● 40 L2 regularization versus weight decay Answer: L2 adds a squared weight penalty to the loss. Decoupled weight decay directly shrinks parameters and differs from L2 when using adaptive optimizers.

●● 46 Overfitting underfitting and bias variance Answer: Underfitting usually reflects high bias or insufficient capacity. Overfitting reflects high variance and a growing train validation gap. ●● 47 Data augmentation Answer: Apply label-preserving transformations that match expected deployment variation. For vision these may include crops flips color changes blur and geometric perturbations. ●● 48 Debugging a loss that does not decrease Answer: Overfit one tiny batch first. Verify labels preprocessing loss gradients parameter updates learning rate train mode and numerical ranges. ●● 49 Debugging NaNs and dead ReLUs Answer: Check inputs logits loss and gradient norms for the first nonfinite value. Reduce learning rate use stable losses inspect normalization and verify that too many ReLU units are not permanently negative. ●● 50 Queries keys and values Answer: Queries represent what each token seeks. Keys represent what each token offers for matching. Values contain the information combined according to attention weights.

●● 51 Scaled dot product attention Answer: Compute softmax of Q times K transpose divided by square root of dk plus the mask. Multiply the resulting probabilities by V. ●● 52 Why attention scales by square root of dk Answer: If query and key components have unit variance their dot product variance grows with dk. Scaling keeps logits controlled and avoids saturated softmax gradients. ●● 53 Attention tensor shapes Answer: With X shape B N E and H heads use Q K V shape B H N Dh where Dh equals E divided by H. Scores have shape B H N N. ●● 54 Multi head attention Answer: Different heads can learn different relationships and subspaces. Concatenate head outputs and apply an output projection to return shape B N E. ●● 55 Causal attention mask Answer: A causal mask prevents position i from attending to positions greater than i. Add negative infinity to forbidden logits before softmax. ●● 56 Padding attention mask

Answer: A standard block contains attention a residual connection normalization a positionwise MLP and another residual connection and normalization. ●● 62 Vision Transformer patching Answer: Split an image into nonoverlapping patches then flatten and linearly project each patch into a token. Token count is approximately image area divided by patch area. ●● 63 Cross attention Answer: Queries come from one sequence or modality while keys and values come from another. Score shape depends on query length times key length. ●● 64 Multimodal fusion Answer: Early fusion combines modalities before deep processing. Late fusion combines separate representations. Cross attention allows one modality to selectively retrieve from another. ●● 65 Image models versus video models Answer: Video models must represent temporal motion and state. They require temporal position information and must balance longer context against latency and memory. ●● 66 KV caching

Answer: Cache past keys and values during autoregressive inference to avoid recomputing them. Compute per new token falls but cache memory grows with sequence length and layer count. ●● 67 Behavior cloning Answer: Behavior cloning trains a policy to maximize the likelihood of expert actions given expert observations. It is supervised learning on demonstrations. ●● 68 Maximum likelihood for policies Answer: For discrete actions minimize negative log probability of the demonstrated action. For continuous actions maximize the density under a chosen action distribution. ●● 69 Covariate shift in imitation learning Answer: Training observations come from the expert distribution while deployment observations come from the learned policy distribution. Small mistakes can move the policy into unfamiliar states. ●● 70 Compounding errors Answer: A small per step error can cause the policy to visit worse states and make more errors. Long horizon failure can therefore grow much faster than the one step error rate suggests. ●● 71 DAgger

Answer: A POMDP exposes observations that do not fully reveal state. An agent may need history recurrent state memory or a belief distribution. ●● 77 Discounted return Answer: Return from time t is the sum of future rewards weighted by increasing powers of gamma. Gamma controls how strongly the agent values delayed outcomes. ●● 78 Value and Q functions Answer: V of s is expected return from a state. Q of s and a is expected return after taking an action then following the policy. ●● 79 Bellman equation Answer: A value equals expected immediate reward plus discounted value of the next state. Bellman optimality replaces the next policy action with the maximizing action. ●● 80 On policy versus off policy learning Answer: On policy methods learn from data generated by the current policy. Off policy methods can learn from other policies but must handle distribution mismatch. ●● 81 Monte Carlo versus temporal difference

Answer: Monte Carlo waits for sampled returns and is unbiased but high variance. Temporal difference bootstraps from value estimates and is lower variance but biased. ●● 82 REINFORCE Answer: REINFORCE estimates policy gradients using return times the gradient of log action probability. It is unbiased but often has high variance. ●● 83 Baselines advantages and actor critic Answer: A baseline reduces policy gradient variance without changing expectation. Advantage compares an action with the state baseline. Actor critic learns both a policy and a value estimator. ●● 84 Generalized advantage estimation Answer: GAE computes a weighted sum of temporal difference residuals. Lambda trades lower bias against lower variance while gamma discounts future residuals. ●● 85 PPO clipped objective Answer: PPO forms the new to old action probability ratio and clips it near 1. The minimum of clipped and unclipped objectives discourages destructive policy updates. ●● 86 Importance sampling and entropy

●● 91 GUI grounding and action spaces Answer: Map visual or semantic targets to clicks typing scrolling shortcuts or tool calls. Define coordinate systems action validity and failure feedback precisely. ●● 92 Temporal state and hierarchy Answer: Partial observability requires history or recurrent state. Hierarchical agents separate long horizon goals from short horizon grounded actions. ●● 93 Context management and memory Answer: Retain task relevant state while discarding stale details. Separate short term interaction context from durable memory and prevent untrusted content from corrupting either. ●● 94 Recovery and interruptions Answer: Detect unexpected states verify action outcomes retry safely replan after failures and preserve enough state to resume after interruptions or interface changes. ●● 95 Safety steerability and interpretability Answer: Constrain destructive actions require confirmation when appropriate log decisions expose uncertainty and make policy behavior controllable by explicit user instructions.

●● 96 Agent evaluation metrics Answer: Measure task success trajectory success step accuracy grounding accuracy recovery rate latency action frequency safety violations and long horizon reliability. ●● 97 Benchmark design Answer: Include ambiguity interruptions unseen interfaces and long tasks. Prevent contamination use deterministic replay run ablations report confidence intervals and maintain an error taxonomy. ●● 98 Edge deployment Answer: Quantization reduces precision and memory. Pruning removes weights. Distillation trains a smaller model. Mixed precision batching and operator fusion trade accuracy memory throughput and latency. ●● 99 General machine learning evaluation Answer: Keep train validation and test data separate and prevent leakage. For imbalance emphasize precision recall F1 and PR AUC. Check calibration distribution shift and subgroup performance. ●● 100 CoderPad problem solving Answer: Clarify inputs outputs and edge cases. Explain brute force then optimize. Write clean code create tests and state time and space complexity. Practice arrays hashes windows heaps graphs and basic dynamic programming.