PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Machine Learning/TikTok

Explain overfitting, imbalance, undersampling, and attention heads

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's competency in diagnosing and mitigating overfitting, handling class imbalance including undersampling strategies, and understanding transformer attention heads and their effects on model capacity and computation.

  • hard
  • TikTok
  • Machine Learning
  • Machine Learning Engineer

Explain overfitting, imbalance, undersampling, and attention heads

Company: TikTok

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: hard

Interview Round: Technical Screen

How do you diagnose and mitigate overfitting in machine learning models? Discuss techniques such as regularization (L1/L 2), data augmentation, early stopping, dropout, architecture changes, cross-validation, and appropriate validation strategies; explain trade-offs for each. How do you handle class imbalance? Compare undersampling, oversampling (including SMOTE/variants), class weighting, focal loss, and thresholding; specify when each is appropriate and how to evaluate with metrics like precision/recall, PR-AUC, ROC-AUC, and calibration. Detail common undersampling strategies—random undersampling, Tomek links, Edited Nearest Neighbors (ENN), NearMiss variants, and cluster-centroid methods—and discuss their impact on bias/variance and minority class recall. What is an attention head? Explain queries, keys, and values; how multi-head attention splits representation space; what multiple heads capture; and how head count affects capacity, compute, and inductive bias.

Quick Answer: This question evaluates a candidate's competency in diagnosing and mitigating overfitting, handling class imbalance including undersampling strategies, and understanding transformer attention heads and their effects on model capacity and computation.

Related Interview Questions

  • Design multimodal deployment under compute limits - TikTok (easy)
  • Explain overfitting, dropout, normalization, RL post-training - TikTok (medium)
  • Write self-attention and cross-entropy pseudocode - TikTok (medium)
  • Explain FlashAttention, KV cache, and RoPE - TikTok (medium)
  • Answer ML fundamentals and diagnostics questions - TikTok (hard)
TikTok logo
TikTok
Aug 8, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
Machine Learning
2
0

Context

You are designing and evaluating production machine learning models, with emphasis on classification, reliability, and efficient architectures. Answer the following multi-part question.

Part 1 — Diagnose and Mitigate Overfitting

Explain how to diagnose overfitting and discuss mitigation techniques, including:

  • Regularization: L1, L2 (weight decay)
  • Data augmentation (and label-preserving transformations)
  • Early stopping and learning-rate schedules
  • Dropout and related stochastic regularizers
  • Architecture changes (capacity, inductive bias, normalization)
  • Cross-validation
  • Proper validation strategies (avoiding leakage; stratified/group/time-based splits) For each technique, explain trade-offs.

Part 2 — Handle Class Imbalance

Discuss approaches to class imbalance:

  • Undersampling vs. oversampling (random; SMOTE and variants)
  • Class weighting, focal loss, and threshold selection
  • When each method is appropriate and how to evaluate with precision/recall, PR-AUC, ROC-AUC, and calibration

Detail common undersampling strategies and their impact on bias/variance and minority-class recall:

  • Random undersampling
  • Tomek links
  • Edited Nearest Neighbors (ENN)
  • NearMiss variants
  • Cluster-centroid methods

Part 3 — Attention Heads in Transformers

Define an attention head and explain:

  • Queries, keys, values
  • How multi-head attention splits representation space
  • What multiple heads can capture
  • How head count affects capacity, compute, and inductive bias

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Machine Learning•More TikTok•More Machine Learning Engineer•TikTok Machine Learning Engineer•TikTok Machine Learning•Machine Learning Engineer Machine Learning
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.