Intermediate interview questions in AI & ML, page 15
How is IoU computed and why prefer mIoU?
IoU is intersection over union of predicted and true pixels; mIoU averages per class; pixel accuracy is dominated by background.
Parquet versus CSV for analytical data lakes
Parquet stores by column enabling projection pushdown, compression, and predicate skipping; CSV is row-based, untyped, and slow to scan.
Loss functions for imbalanced medical segmentation
Cross-entropy is swamped by background; Dice optimizes overlap directly; Focal down-weights easy pixels.
Design a cost-aware ML training platform for heterogeneous hardware
Tests hardware abstraction and cost-aware cross-accelerator scheduling. Strong answers cover a device-agnostic spec, a performance predictor, a cost-per-step model, and bin-packing against spot prices. Red flag: ignoring per-step cost and migration overhead.
Interactive versus static plots for EDA
Interactive libraries win for exploring dense, high-cardinality, or multi-dimensional data via zoom, hover, and filtering; static plots win for reproducible, publication output.
Design real-time multi-object tracking for AV
Fast detector, Kalman motion model, Hungarian association on IoU plus appearance, track lifecycle for occlusions.
Present a small but significant A/B test lift
Hypothesis, design and validity checks, result with effect size and interval, business impact of 0.5%, then a clear recommendation.
Filter-based vs optimization-based SLAM
EKF folds past poses into one Gaussian; optimization keeps a sparse graph and re-linearizes; the latter wins on accuracy and loop closure.
Explain an interaction effect to a non-statistician
Define interaction as it depends on, show separate slope lines per age group, give the business takeaway on targeting.
What does N-way K-shot classification mean?
N is classes per episode, K is labeled examples per class in the support set, prediction is on a separate query set.
Demographic Parity versus Equalized Odds in hiring
Demographic parity equalizes selection rates regardless of qualification; equalized odds equalizes true and false positive rates across groups, conditioning on the true label.
Design an active learning loop for detection
Seed-train, score the pool by uncertainty plus diversity, batch to annotators, retrain, repeat.
Explain prompt injection and how to defend against it
This question tests your understanding of LLM security vulnerabilities and how untrusted user input can manipulate model behavior. A strong answer defines prompt injection as hijacking the model's instructions, then outlines a layered defense including input sanitization, instruction-tuned models, and separating user input from system prompts. A common red flag is confusing it with traditional SQL injection or suggesting simple input filtering is a sufficient solution.

How does positional encoding work in transformers?
This tests your understanding of why Transformers need explicit position data. A great answer explains that self-attention is permutation-invariant, meaning it sees inputs as an unordered set. Positional encodings—vectors derived from sine and cosine functions—are then added to the input embeddings to inject sequence order. A red flag is simply saying 'it adds position' without explaining why this is necessary or how it's done.

Encoder-Only vs. Decoder-Only vs. Encoder-Decoder Transformers?
This tests your ability to connect transformer architecture to specific NLP tasks. A great answer explains how each model's attention mechanism dictates its use: encoder-only (bidirectional attention) for understanding content, decoder-only (causal attention) for text generation, and encoder-decoder for sequence-to-sequence tasks like translation. The key red flag is failing to explain the *why* behind the task suitability—the attention mechanism.
RAG vs. Fine-Tuning: Key Differences
This tests your understanding of how LLMs incorporate knowledge, specifically the trade-offs between embedding it in model weights versus retrieving it at runtime. A great answer defines RAG as runtime retrieval from an external source and fine-tuning as baking knowledge into model parameters, then contrasts their approaches to knowledge updates, cost, and providing citations. A red flag is stating one is always better, or failing to explain that they solve different problems and can be used tog
What is the trade-off between top-k and top-p sampling?
This tests your practical knowledge of tuning LLM output for the creativity vs. coherence trade-off. A strong answer defines top-k (static token count) and top-p (dynamic probability mass), then explains that top-p's adaptive window is generally more robust than top-k's fixed window. A red flag is failing to contrast the static nature of top-k with the dynamic nature of top-p, which is the core of the trade-off.
Explain the concept of self-attention
This tests your ability to explain the core mechanism of Transformers. A strong answer defines self-attention as a process for relating positions of a single sequence, explains the Query-Key-Value (QKV) model where a token's Query is compared to all Keys to generate weights, and describes how these weights create a weighted sum of Values. A red flag is vaguely describing 'importance' without mentioning the QKV mechanism.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles