Dataset Viewer
Auto-converted to Parquet Duplicate
instruction
stringlengths
14
190
response
stringlengths
183
657
What are the inference latency implications of using sequential adapter modules compared to the base model?
Sequential adapter modules increase inference latency because they add extra matrix multiplications and non-linearities to the critical path of the forward pass. Unlike LoRA, which can be merged into the base weights for zero overhead, adapters remain distinct architectural components. The latency overhead scales with ...
What is the relationship between contrastive loss and Siamese networks?
Siamese networks are the standard architecture for contrastive loss. They consist of two identical sub-networks sharing weights that process the two input samples independently to produce embeddings. Weight sharing ensures the distance metric is symmetric and consistent. The contrastive loss is then computed on the out...
How does the StyleGAN mapping network contribute to disentangled representations?
The StyleGAN mapping network (typically 8-layer MLP) transforms the input latent code z ∈ Z into an intermediate latent code w ∈ W. This non-linear projection encourages the W space to align with semantic factors of variation (pose, lighting, identity) more linearly than Z. Because the mapping network is trained jointl...
What is the 'black box' problem in Artificial Intelligence, and why does it matter?
The 'black box' problem refers to the opacity of complex models (especially deep neural networks), where the internal decision-making logic is not interpretable by humans. This matters because it hinders trust, debugging, regulatory compliance, and accountability in high-stakes domains like healthcare, finance, and cri...
Explain the trade-off between retrieval context length and model latency in production RAG systems.
Longer context increases prompt processing time quadratically for standard attention, raising latency and cost. However, insufficient context omits critical facts. Production systems tune the number of chunks and chunk size to meet latency SLAs while maintaining accuracy, often using distillation, flash attention, or s...
Describe how embedding dimension affects the geometry of the learned vector space.
Higher dimensions create a sparser, higher-volume space where vectors can occupy more orthogonal directions, enabling cleaner separation of semantic clusters and more precise angular relationships (e.g., analogies). Lower dimensions force vectors into a crowded space, increasing cosine similarity collisions and distort...
What is catastrophic forgetting, and how does it relate to fine-tuning?
Catastrophic forgetting occurs when a model loses previously learned knowledge (from pre-training) while learning a new target task. In fine-tuning, aggressive optimization on a small target dataset can overwrite the generic feature representations acquired during pre-training, degrading the model's generalization capa...
Explain the difference between static and contextual embeddings.
Static embeddings (e.g., Word2Vec, GloVe) assign a single fixed vector to each token regardless of context. Contextual embeddings (e.g., BERT, ELMo) generate token representations dynamically based on the surrounding sentence, capturing polysemy and syntactic role. Contextual models generally outperform static ones on ...
How would you implement Layer Normalization for a 3D input tensor of shape (Batch, Sequence, Features)?
For input shape (B, S, D), Layer Normalization computes mean and variance along the last dimension (Features, D) for each batch and sequence element independently. The output has the same shape (B, S, D). Learnable parameters γ and β have shape (D). In PyTorch: `nn.LayerNorm(normalized_shape=D)`. This normalizes each t...
Describe how position information is incorporated into attention, given that it is permutation-invariant.
Standard attention is permutation-equivariant: it treats input as a set. Positional information is added via positional encodings (fixed sinusoidal or learned embeddings) summed with token embeddings before attention layers. This injects absolute or relative position signals, allowing the model to distinguish token ord...
What is the significance of the 'pre-training dataset size' on transfer learning performance?
Performance generally scales logarithmically with pre-training dataset size (scaling laws). Larger datasets (JFT-300M, ImageNet-21k, LAION-400M) enable models to learn more diverse, robust, and transferable features, reducing the reliance on target data quantity. However, diminishing returns occur; data quality, divers...
How does Mini-Batch Gradient Descent differ from Batch Gradient Descent and Stochastic Gradient Descent?
Batch Gradient Descent uses the entire dataset per update, providing stable convergence but high memory cost. Stochastic Gradient Descent uses one sample per update, offering frequent updates but high variance. Mini-Batch Gradient Descent uses a subset (typically 32-512 samples), leveraging vectorized hardware for effi...
What is the difference between classification and regression in supervised learning?
Classification predicts discrete class labels from a finite set of categories, typically using cross-entropy loss and a softmax output layer. Regression predicts continuous numerical values, commonly using mean squared error loss and a linear output layer. The choice depends on whether the target variable is categorica...
How does Wasserstein GAN (WGAN) improve training stability compared to the original GAN?
WGAN replaces the Jensen-Shannon divergence with the Wasserstein-1 (Earth Mover's) distance, which provides meaningful gradients even when real and generated distributions have disjoint supports. It enforces a 1-Lipschitz constraint on the critic (discriminator) via weight clipping or gradient penalty, ensuring the cri...
How does Triplet Loss compare to N-pair Loss?
N-pair Loss generalizes Triplet Loss by using one anchor, one positive, and (N-1) negatives per tuple. It compares the anchor-positive distance against multiple negatives simultaneously, providing richer gradient information and faster convergence. Triplet Loss is a special case with N=2. N-pair Loss better approximate...
Design a single artificial neuron to approximate the function f(x) = 2x + 3 for scalar input x.
Use a linear activation function (identity). Initialize weight w ≈ 2 and bias b ≈ 3. With a single input x, the neuron computes y = w*x + b. Training with MSE loss on samples from f(x) will converge to w=2, b=3. This demonstrates a neuron can model affine transformations exactly with linear activation.
How does feature extraction handle multi-modal inputs, such as RGB-D data, with a pre-trained RGB model?
The pre-trained RGB model can process the RGB channels as a fixed feature extractor. Depth channels require a separate processing stream (randomly initialized or pre-trained) whose features are fused with RGB features before the classifier head.
What is the effect of using a stronger discriminator architecture relative to the generator?
An overpowered discriminator quickly saturates, producing vanishing gradients for the generator. This prevents the generator from learning meaningful features. Balanced capacity and techniques like label smoothing or spectral normalization mitigate this imbalance.
How does supervised contrastive loss extend the standard contrastive loss?
Supervised contrastive loss (SupCon) generalizes the pairwise formulation to a set-based approach. For a given anchor, all samples from the same class are treated as positives, and all samples from different classes as negatives. It uses a temperature-scaled cosine similarity and a softmax-like formulation (similar to ...
What are the key challenges in applying diffusion models to video generation?
Video diffusion faces high computational cost from temporal dimension, temporal consistency across frames, and modeling long-range dependencies. Solutions include 3D U-Nets with temporal attention, latent video diffusion with compressed representations, and training on frame-level latents with temporal layers inserted ...
Why is a confusion matrix more informative than overall accuracy for imbalanced datasets?
Overall accuracy can be misleading on imbalanced data because a model predicting only the majority class achieves high accuracy but fails on the minority class. A confusion matrix reveals per-class performance, exposing high False Negatives or False Positives that accuracy hides, enabling calculation of metrics like re...
Describe how the encoder processes masked language modeling (MLM) objectives during pre-training.
During MLM pre-training, a percentage of input tokens are randomly replaced with a [MASK] token. The encoder processes the corrupted sequence bidirectionally, producing contextualized representations for all positions. A classification head on top of the encoder output predicts the original vocabulary IDs for masked po...
In a hybrid search system combining BM25 and dense vector embeddings, what specific retrieval gaps does BM25 fill that dense vectors often miss?
BM25 excels at exact keyword matching, rare term retrieval, and handling out-of-vocabulary or domain-specific terms (e.g., product codes, error numbers) that embedding models may not represent well. Dense vectors capture semantic similarity but can miss precise lexical matches. BM25 ensures high recall for exact-term q...
Explain the difference between ViT-Base, ViT-Large, and ViT-Huge variants.
These variants scale the model capacity by increasing the hidden dimension D, the number of encoder layers (depth), and the number of attention heads. ViT-Base typically uses D=768, 12 layers, 12 heads (~86M params). ViT-Large uses D=1024, 24 layers, 16 heads (~307M params). ViT-Huge uses D=1280, 32 layers, 16 heads (~...
How does cosine similarity handle the curse of dimensionality compared to Euclidean distance?
Cosine similarity is less affected by the curse of dimensionality than Euclidean distance. In high dimensions, Euclidean distances between random points converge to similar values, making discrimination difficult. Cosine similarity depends on the angle, which remains discriminative even in high-dimensional sparse space...
What are the storage implications of using PEFT for model versioning compared to full fine-tuning checkpoints?
A full fine-tuning checkpoint for a 7B model requires ~14-28 GB (FP16/BF16). A LoRA checkpoint (rank 8, attention only) requires ~10-50 MB. This allows storing hundreds of task-specific adapters in the space of one full model, enabling efficient version control, A/B testing, and rollback capabilities without massive di...
Contrast the behavior of L1 and L2 loss functions when used as regularization terms versus data fitting terms.
As data fitting terms, L2 (MSE) yields the conditional mean estimate and is sensitive to outliers; L1 (MAE) yields the conditional median and is robust. As regularization terms (weight decay), L2 shrinks weights uniformly toward zero, while L1 induces sparsity by driving irrelevant weights exactly to zero, performing i...
What is the purpose of a validation set during sequence classifier training, and how is it used for model selection?
The validation set monitors generalization during training, independent of the test set. It guides hyperparameter tuning (learning rate, epochs, dropout) and enables early stopping: training halts when validation loss stops improving, and the best checkpoint (highest validation F1 or lowest loss) is selected for final ...
Is ReLU suitable for Recurrent Neural Networks (RNNs)? Why or why not?
Standard ReLU is generally less suitable for vanilla RNNs because its unbounded positive output (range [0, ∞)) can cause activations to explode over many timesteps, exacerbating the exploding gradient problem. Variants like ReLU with gradient clipping or gated units (LSTM/GRU) using sigmoid/tanh are preferred for stabi...
What is contrastive loss?
Contrastive loss is a distance-based loss function used in metric learning to learn embeddings where similar pairs are pulled closer together and dissimilar pairs are pushed apart. It operates on pairs of samples with a binary label indicating similarity. The loss minimizes the Euclidean distance for similar pairs and ...
What are the main latency and infrastructure trade-offs when deploying hybrid retrieval compared to a single dense vector index?
Hybrid retrieval increases query latency and infrastructure complexity because it requires maintaining and querying multiple indexes (e.g., an inverted index for BM25 and an ANN index for dense vectors) and executing a fusion step. However, this cost is often justified by significant gains in recall and robustness, esp...
Why might L2 regularization be less effective than L1 for feature selection in high-dimensional sparse datasets?
L2 regularization shrinks coefficients proportionally but does not zero them out. In high-dimensional sparse settings where only a few features are truly relevant, L2 retains all features with small weights, adding noise and computational overhead. L1's sparsity-inducing property automatically discards irrelevant featu...
How does the Transformer architecture differ from recurrent neural networks?
Transformers process the entire sequence simultaneously using self-attention, allowing O(1) sequential operations and full parallelism. RNNs process tokens step-by-step, creating O(n) sequential depth that hinders parallelization and makes long-range dependency learning difficult due to vanishing gradients. Transformer...
What are the limitations of using cosine similarity on raw LLM hidden states for semantic tasks?
Raw hidden states from LLMs (especially early layers) are often anisotropic (concentrated in a narrow cone), causing artificially high cosine similarities between unrelated sentences. They may encode syntactic or positional information rather than pure semantics. Post-processing (whitening, centering) or fine-tuning wi...
What is image classification in computer vision?
Image classification is the task of assigning a single label or category to an entire input image from a predefined set of classes. Unlike object detection or segmentation, it does not locate objects or delineate boundaries; it only predicts the most probable class representing the dominant content of the image.
Describe how a ChatPromptTemplate differs from a standard PromptTemplate.
A standard `PromptTemplate` renders a single string for completion models. A `ChatPromptTemplate` renders a list of structured message objects (e.g., System, Human, AI messages) with distinct roles. This maps directly to the ChatML format required by chat-tuned models (like GPT-4 or Llama-3), enabling multi-turn conver...
What are the limitations of feedforward neural networks?
Feedforward networks cannot natively process variable-length sequences or exploit temporal/spatial structure without manual feature engineering. They treat each input independently, lacking memory or state. They require fixed-size inputs, struggle with very high-dimensional data (e.g., raw images) without excessive par...
How does the confidence threshold of a detector affect the Precision-Recall curve and AP?
Varying the confidence threshold traces the Precision-Recall curve. A high threshold yields high precision but low recall (few, confident detections). A low threshold increases recall but introduces false positives, lowering precision. AP summarizes this trade-off across all thresholds by integrating the area under the...
Explain the purpose and mechanism of Reinforcement Learning from Human Feedback (RLHF).
RLHF aligns LLM outputs with human preferences. First, a reward model is trained on human-ranked model outputs. Then, the LLM is optimized via PPO to maximize this reward while staying close to the original policy (KL penalty). This mitigates issues like hallucination, toxicity, and instruction-following failures that ...
Why is teacher forcing used during training of autoregressive models?
Teacher forcing feeds the ground-truth previous tokens as input when predicting the next token, rather than the model's own predictions. This stabilizes and accelerates training by preventing error accumulation—where early mistakes cascade into later time steps—and allows parallel computation of all time-step losses du...
What is the role of the loss function in training a feedforward network?
The loss function quantifies the discrepancy between the network's predictions ŷ and ground-truth targets y (e.g., MSE for regression, cross-entropy for classification). It provides a scalar objective that backpropagation minimizes by computing gradients ∂L/∂W, ∂L/∂b. The choice of loss function must match the task and...
What is TF-IDF weighting and why is it used in vector space retrieval?
TF-IDF (Term Frequency–Inverse Document Frequency) weights a term by its frequency in a document (TF) discounted by its global frequency across the collection (IDF). High TF signals topical relevance within a document; high IDF down-weights ubiquitous terms like "the" that discriminate poorly. The product yields a term...
What is a Vision Transformer?
A Vision Transformer (ViT) is a neural network architecture that applies the Transformer encoder, originally designed for NLP, to image classification. It splits an image into fixed-size patches, linearly embeds them into vectors, adds positional embeddings, and processes the resulting sequence through standard Transfo...
Explain the trade-off between model size (parameters/FLOPs) and accuracy in mobile image classification.
Mobile classifiers (e.g., MobileNet, EfficientNet-B0) use depthwise separable convolutions and compound scaling to reduce parameters and FLOPs. Smaller models infer faster and consume less power but lose representational capacity. Techniques like knowledge distillation, quantization, and pruning recover accuracy while ...
What is the difference between an autoencoder and a Variational Autoencoder (VAE)?
A standard autoencoder learns a deterministic mapping to a latent code. A VAE learns a probabilistic mapping where the encoder outputs parameters of a distribution (mean and variance) and the decoder samples from this distribution. VAEs are generative models trained by maximizing a variational lower bound (ELBO), enabl...
How does fine-tuning differ from feature extraction (fixed feature extractor) approaches?
In feature extraction, the pre-trained backbone weights are frozen and only a new classifier head is trained. In fine-tuning, the backbone weights are unfrozen and updated during training on the target task. Fine-tuning adapts the feature representations themselves, offering higher capacity to fit the target domain but...
Contrast additive attention with dot-product attention.
Additive attention (Bahdanau) computes scores using a feed-forward network: score = v^T tanh(W_q Q + W_k K). Dot-product attention uses score = QK^T. Dot-product is faster and more space-efficient due to optimized matrix multiplication, while additive attention can generalize better for small dimensions. In practice, s...
Define retrieval context and explain its primary purpose in RAG systems.
Retrieval context refers to the external information retrieved and injected into the model prompt. Its primary purpose is to augment the model's parametric knowledge with specific, relevant facts, allowing the system to answer queries requiring current data, proprietary knowledge, or precise citations without retrainin...
In a classification CNN (e.g., ResNet), why is padding typically used in the initial 7x7 convolution but omitted in later 1x1 convolutions?
The initial 7x7 convolution uses padding (usually 3) to prevent immediate drastic spatial reduction of the large input image. Later 1x1 convolutions are pointwise operations that do not reduce spatial dimensions (kernel=1, padding=0), so padding is unnecessary for size preservation.
What is the relationship between Named Entity Recognition and Entity Linking?
NER identifies entity mentions and their types in text; Entity Linking (EL) disambiguates those mentions by mapping them to unique identifiers in a knowledge base (e.g., Wikidata QIDs). NER is typically a prerequisite for EL—providing candidate spans—while EL resolves ambiguity (e.g., linking "Paris" to Paris, France v...
If you are designing a loss function to directly optimize mAP, what is the primary challenge?
mAP is non-differentiable because it relies on sorting predictions by confidence (a discrete ranking operation) and thresholding IoU (a step function). Gradient-based optimization requires differentiable surrogates. Common approaches include using differentiable approximations of the ranking function (e.g., AP-loss, DR...
How does the temperature parameter affect the Softmax output distribution?
A temperature parameter T scales the logits before Softmax: σ(z)_k = exp(z_k/T) / Σ exp(z_j/T). High temperatures (T > 1) produce softer, more uniform distributions, revealing relative uncertainties. Low temperatures (T < 1) sharpen the distribution, pushing the highest logit closer to 1. It is used in knowledge distil...
What happens if the margin in contrastive loss is set too large?
An excessively large margin forces dissimilar pairs to be pushed extremely far apart. This can cause the embedding space to expand uncontrollably, leading to numerical instability and optimization difficulties. It may also distort the manifold structure by over-emphasizing separation at the expense of preserving intra-...
What is the effect of class imbalance on supervised learning, and how can it be addressed?
Class imbalance biases models toward the majority class, inflating accuracy while degrading minority class recall. Remedies include resampling (oversampling minority, undersampling majority), class-weighted loss functions, focal loss, threshold adjustment, synthetic data generation (SMOTE), and ensemble methods like Ba...
What is AdaGrad?
AdaGrad (Adaptive Gradient Algorithm) is an optimization algorithm that adapts the learning rate for each parameter individually. It accumulates the squared gradients over time and divides the global learning rate by the square root of this sum, causing frequently updated parameters to have smaller effective learning r...
Explain how multilingual sentence embeddings (e.g., LaBSE, mUSE) align languages in a shared space.
Multilingual models are trained on parallel or multi-lingual data using translation ranking or contrastive objectives. They encourage embeddings of translated sentence pairs to be close while pushing non-translations apart. This forces the model to map semantically equivalent sentences across languages to nearby region...
What is the difference between a tokenizer's 'encode' and 'decode' methods?
Encode converts a raw string into a list of token IDs (integers) via normalization, pre-tokenization, model application (BPE/WordPiece), and mapping to IDs. Decode reverses this: it maps IDs back to tokens, merges them (handling whitespace markers), and detokenizes to reconstruct the original string (ideally losslessly...
Can latent space operations generalize to out-of-distribution data? Explain.
Generally, no. Latent spaces are optimized for the training data manifold. Out-of-distribution (OOD) inputs may map to arbitrary, low-density regions of the latent space where the decoder behaves unpredictably. Operations like interpolation or arithmetic rely on the local linearity and semantic consistency of the train...
Why does HyDE improve retrieval performance for short queries?
Short queries often lack the vocabulary and contextual detail present in full documents, creating an embedding space mismatch. HyDE generates a hypothetical document that mimics the length, terminology, and structure of real corpus documents, aligning the query representation with the document distribution in the vecto...
Why is Mini-Batch Gradient Descent preferred for training deep neural networks on GPUs?
GPUs excel at parallel matrix operations. Mini-batches allow the forward and backward passes to be computed as large matrix multiplications rather than sequential vector operations, maximizing hardware utilization. This vectorization significantly reduces wall-clock time per epoch compared to processing samples individ...
What is the relationship between the spectral radius of the recurrent weight matrix and the vanishing gradient problem?
The spectral radius (largest absolute eigenvalue) of the recurrent weight matrix determines the asymptotic behavior of gradient norms. If it is significantly less than 1, repeated multiplication causes exponential gradient decay (vanishing). If it is near 1, gradients can propagate over many steps. If it exceeds 1, gra...
What happens to attention weights when the Query and Key vectors are orthogonal?
If Query and Key vectors are orthogonal, their dot product is zero. After scaling and softmax, this yields uniform attention weights (assuming all other dot products are also zero or equal). The output becomes the average of all Value vectors. Orthogonality implies no specific relevance, causing the mechanism to defaul...
What is a diffusion model in the context of generative deep learning?
A diffusion model is a generative model that learns to reverse a gradual noising process. It works by progressively adding Gaussian noise to data until it becomes pure noise (forward process), then training a neural network to predict and remove the noise step-by-step (reverse process) to generate new samples from rand...
How does domain adaptation affect sentence embedding performance?
General-domain embeddings (trained on Wikipedia, NLI) often underperform on specialized domains (legal, biomedical, code). Domain adaptation via continued pre-training on in-domain corpora or fine-tuning on domain-specific labeled pairs (e.g., legal case similarity) adapts the vector space to domain terminology and sem...
Why is sparsity beneficial for representation learning in autoencoders?
Sparsity encourages disentangled, interpretable features where individual neurons respond to specific, high-level concepts rather than distributed, overlapping patterns. It acts as a regularizer, improving generalization by preventing overfitting. In overcomplete settings, it avoids the trivial solution of copying inpu...
Why is ReLU computationally more efficient than sigmoid or tanh?
ReLU requires only a simple max(0, x) comparison, avoiding expensive exponential calculations required by sigmoid and tanh. Its derivative is either 0 or 1, enabling faster backpropagation. This efficiency significantly reduces training time, especially in deep networks with millions of parameters.
What happens during Transformer decoder inference that differs from training?
During training, the full target sequence is available and masked self-attention enables parallel computation. During inference, tokens are generated one at a time: the model receives the current sequence, predicts the next token, appends it, and repeats. Caching key-value pairs from previous steps avoids recomputing a...
What is the relationship between cosine similarity and cosine distance?
Cosine distance is defined as 1 minus cosine similarity: d_cos(A, B) = 1 - cos(θ). While cosine similarity measures alignment (1 = identical, -1 = opposite), cosine distance measures dissimilarity (0 = identical, 2 = opposite). Cosine distance is not a true metric because it violates the triangle inequality, but it is ...
Compare norm-based gradient clipping with value-based clipping. When would you prefer each?
Norm-based clipping preserves the gradient direction by scaling the entire vector, making it suitable when the overall update direction is meaningful but magnitude is excessive. Value-based clipping independently caps each component, which can distort the update direction but is simpler and useful when specific paramet...
What is the computational trade-off between using a bi-encoder and a cross-encoder for re-ranking?
A bi-encoder enables fast retrieval by pre-computing corpus embeddings (O(1) query encoding + ANN search). A cross-encoder provides higher relevance scoring via full cross-attention but requires encoding the query with every candidate (O(N) forward passes). A common pipeline uses a bi-encoder for candidate retrieval (t...
How do RMSprop and Adam address AdaGrad's diminishing learning rate problem?
RMSprop replaces the monotonically growing sum with an exponentially decaying moving average of squared gradients (E[g^2]_t = γ E[g^2]_{t-1} + (1-γ)g_t^2), preventing unbounded accumulation. Adam combines this with momentum (first moment estimates) and bias correction, maintaining adaptive learning rates without the va...
Explain the concept of disentanglement in latent space.
Disentanglement refers to a latent space where individual dimensions (or subspaces) correspond to independent, interpretable generative factors of the data (e.g., pose, lighting, object identity). Changing a single latent dimension affects only one semantic factor while leaving others invariant. This property is highly...
Describe a scenario where a Bidirectional RNN would perform worse than a unidirectional RNN.
In causal language modeling (next-token prediction), a BiRNN would 'cheat' by accessing future tokens during training, making the task trivial and preventing the model from learning to predict the future from the past. At inference, future tokens are unavailable, so the trained backward weights are useless. Similarly, ...
What is the relationship between adversarial robustness and OOD detection performance?
Adversarial training improves robustness to small, worst-case perturbations (L_p bounded), which can improve detection of 'near-OOD' data (semantically similar but perturbed). However, it often degrades detection of 'far-OOD' data (semantically distinct) because the model learns to map a larger region of input space to...
What is the 'positional encoding interpolation' technique used when fine-tuning models like BERT or LLaMA on longer sequences?
When extending context length beyond the pre-trained maximum, the existing learned positional embeddings (or sinusoidal bases) are treated as a continuous function. New embeddings for positions beyond the original limit are generated by interpolating (usually linearly or via splines) between the existing learned vector...
Explain the difference between quantization and pruning as optimization techniques.
Quantization reduces the numerical precision of weights and activations (e.g., FP32 to INT8), shrinking model size and accelerating arithmetic. Pruning removes redundant or near-zero weights/connections, inducing sparsity to skip computations. Quantization preserves structure; pruning alters it.
What is Multi-task Instruction Tuning (e.g., FLAN, T0) and why is it effective?
Multi-task Instruction Tuning aggregates dozens of NLP datasets (classification, QA, NLI, etc.) into a unified instruction format and trains on the mixture simultaneously. It is effective because the massive task diversity forces the model to learn generalizable instruction-following heuristics rather than dataset-spec...
Compare the gating mechanisms of LSTMs and Gated Recurrent Units (GRUs).
LSTMs use three gates (input, forget, output) and maintain a separate cell state and hidden state. GRUs simplify this with two gates (reset and update) and merge the cell state into the hidden state. GRUs are computationally cheaper and often perform comparably, though LSTMs may offer finer control over memory retentio...
Explain the relationship between self-attention and graph neural networks.
Self-attention can be viewed as a graph neural network operating on a fully connected graph where nodes are tokens and edge weights are attention scores. Each attention head performs a message-passing step where messages are Value vectors weighted by attention coefficients. This perspective connects Transformers to spe...
Why is chunking necessary before creating vector embeddings for a RAG system?
Chunking is necessary primarily because embedding models have a maximum token limit (context window). Documents often exceed this limit, making it impossible to embed them whole. Additionally, chunking improves retrieval granularity: smaller, focused chunks yield higher semantic similarity scores for specific queries, ...
Why is a constant learning rate often suboptimal for training deep neural networks?
A constant learning rate creates a trade-off: a high value causes oscillations or divergence near minima, while a low value leads to slow convergence early on. Scheduling resolves this by starting high for rapid progress and decaying later to stabilize training and achieve a tighter final loss.
How does automatic differentiation (autograd) relate to backpropagation?
Automatic differentiation (autograd) is the general framework that implements backpropagation (reverse-mode AD) automatically. It builds a dynamic computational graph during the forward pass, recording operations and operands. The backward pass traverses this graph in reverse topological order, applying the chain rule ...
Can NF4 quantization be applied to activations, or is it weight-only?
NF4 is designed specifically for weight-only quantization. Activations in transformer models often exhibit dynamic ranges and outlier features that do not follow a stable normal distribution, making the fixed NF4 quantization levels unsuitable. Methods like QLoRA keep activations in 16-bit precision (BF16/FP16) during ...
Describe how AdaGrad adapts the learning rate per parameter and identify its primary limitation in deep learning.
AdaGrad maintains a per-parameter sum of squared historical gradients (G_t) and divides the global learning rate by √(G_t + ε). This results in large updates for infrequent features and small updates for frequent ones. Its primary limitation is that the accumulated squared gradients grow monotonically, causing the effe...
Can MSE be used directly for multi-output regression, and how is it computed?
Yes, MSE extends naturally to multi-output regression by averaging squared errors across all outputs and samples: MSE = (1/(n*k)) * ΣΣ(y_ij - ŷ_ij)², where k is the number of outputs. This treats all output dimensions equally. If outputs have different scales or importance, a weighted MSE or separate normalization per ...
What is the main limitation of Adam regarding generalization?
Adam can converge to minima with poorer generalization compared to SGD with momentum, especially in image classification. The adaptive learning rates may cause the optimizer to settle in sharp minima, while SGD's noise and fixed learning rate often find flatter, more generalizable minima. Weight decay regularization in...
Describe the flow of data through a single Transformer decoder layer.
Input embeddings first pass through masked multi-head self-attention with residual connection and layer normalization. The output then enters cross-attention, querying the encoder's keys and values, followed by another residual connection and normalization. Finally, a position-wise feed-forward network processes each p...
Why are bidirectional RNNs used, and how do they process data?
Bidirectional RNNs process sequences in both forward and backward directions using two separate hidden layers. The forward layer captures past context, while the backward layer captures future context. Their outputs are typically concatenated at each time step, providing the model with complete sequence context for tas...
How does an artificial neuron learn?
An artificial neuron learns by adjusting its weights and bias to minimize a loss function. During backpropagation, gradients of the loss with respect to the parameters are computed using the chain rule. An optimizer (e.g., SGD, Adam) then updates the parameters in the opposite direction of the gradients, iteratively im...
How can you evaluate whether a model's output is truly grounded in the provided context?
Evaluation combines automated metrics and human judgment. Automated approaches include checking citation coverage (percentage of claims with citations), entailment verification using NLI models to test if generated sentences are entailed by cited passages, and hallucination detection classifiers. Human evaluators asses...
Can catastrophic forgetting occur in the frozen layers of a model during fine-tuning?
No, by definition, frozen layers have `requires_grad=False` and receive no gradient updates. Their weights remain identical to the pre-trained state. However, the *representations* output by frozen layers can become suboptimal for the new task if the distribution shifts significantly, but this is a feature extraction m...
What is Artificial Intelligence?
Artificial Intelligence (AI) is the field of computer science dedicated to creating systems capable of performing tasks that typically require human intelligence. These tasks include reasoning, learning, perception, language understanding, and problem-solving. AI systems range from rule-based expert systems to modern m...
What is Binary Cross-Entropy loss?
Binary Cross-Entropy (BCE) is a loss function used for binary classification tasks. It measures the difference between the predicted probability distribution and the true binary labels (0 or 1). The formula is: L = -[y log(p) + (1-y) log(1-p)], where y is the true label and p is the predicted probability of class 1. It...
Which operations are typically kept in FP32 during mixed precision training and why?
Critical operations kept in FP32 include: the master copy of model weights (for precise accumulation), the optimizer state (momentum, variance), loss scaling/unscaling, batch normalization statistics, and the final loss computation. These require higher precision to prevent accumulation errors, maintain optimizer stabi...
What role does the retriever's recall play in hallucination, and how can it be improved?
Low recall means relevant documents are missing from the context, forcing the generator to hallucinate. Recall can be improved by hybrid search (dense + sparse), query expansion, multi-query retrieval, reranking with cross-encoders, and increasing the retrieval candidate pool before final selection.
Explain the difference between symmetric and asymmetric padding.
Symmetric padding adds an equal number of pixels to opposite sides (e.g., top and bottom). Asymmetric padding adds different amounts to opposite sides, which occurs when the required total padding is an odd number; frameworks typically add the extra pixel to the bottom or right side.
How does the cluster hypothesis relate to the effectiveness of relevance feedback and clustering in IR?
The cluster hypothesis states that relevant documents tend to be more similar to each other than to non-relevant documents. This underpins relevance feedback: pseudo-relevant documents cluster in the representation space, so expanding toward their centroid (Rocchio) or selecting expansion terms from them (RM3) moves th...
What happens if weights are initialized with excessively large values?
Excessively large initial weights cause activations to saturate (for sigmoid/tanh) or produce massive magnitudes (for ReLU), leading to exploding gradients during backpropagation. This results in numerical instability, NaN losses, and divergence. Even if training survives, the optimization landscape becomes extremely s...
Why do Transformers require positional encoding while Recurrent Neural Networks do not?
Recurrent Neural Networks process tokens sequentially, inherently capturing temporal order through their hidden state recurrence. Transformers, however, process all tokens in parallel via self-attention, which treats the input as an unordered set. Without explicit positional information, the Transformer would be permut...
How does label smoothing affect the training of a classification model?
Label smoothing replaces hard one-hot targets with a softened distribution (e.g., 0.9 for true class, 0.1/(K-1) for others). This prevents the model from becoming overconfident, improves calibration, acts as regularisation, and can improve generalisation by encouraging smaller logit gaps. It is widely used in state-of-...
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
23