← TikTok Interview Insights

TikTok·Data Scientist·Onsite - Multi Round·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Three rounds for a Data Scientist role at TikTok, mixing ML theory, system design, and coding. The questions recycled a few themes across rounds (Dropout came up twice, which was a little odd) and the coding problems leaned more LeetCode-style than pure DS. Felt like a solid process but the repetition made me wonder if the rounds were coordinated at all.

Questions Asked (9)

Q1

How would you deploy multimodal models under tight compute and GPU memory constraints?

System DesignTechnical Trade-offs
Author's notes

This one took me a second to find my footing.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the constraints (model size, latency, throughput, hardware) and the multimodal task (e.g., image-text retrieval, generation). Then propose a layered strategy: model compression (quantization, pruning, distillation), efficient inference techniques (mixed precision, operator fusion, caching), and system-level optimizations (sharding, offloading, batching). Emphasize trade-offs between accuracy, latency, and memory, and how you would measure and iterate.

Pro tip: Quantify the impact: e.g., '8-bit quantization reduced memory by 4x with <1% accuracy drop' or 'using gradient checkpointing allowed us to fine-tune a 10B model on a single 16GB GPU.' Concrete numbers show you've actually deployed models, not just theorized.

1. Clarify constraints and goals

Ask about the specific multimodal task, model size, available GPU memory, latency/throughput requirements, and accuracy targets. This ensures your solution is tailored.

2. Apply model compression

Discuss quantization (e.g., FP16, INT8, 4-bit), pruning, and knowledge distillation to reduce model size and memory footprint while maintaining acceptable accuracy.

3. Optimize inference and training

Use mixed precision, operator fusion, gradient checkpointing, and efficient attention mechanisms (e.g., FlashAttention) to reduce memory and compute during inference and fine-tuning.

4. Leverage system-level techniques

Employ model sharding (tensor/pipeline parallelism), CPU offloading, dynamic batching, and caching to fit models into limited GPU memory and improve throughput.

5. Evaluate trade-offs and iterate

Benchmark accuracy, latency, and memory; adjust compression levels and system configurations to meet constraints. Highlight monitoring and fallback strategies.

Key Points to Mention

  • Quantization (FP16, INT8, 4-bit) and its impact on memory and accuracy
  • Knowledge distillation and pruning for model size reduction
  • Mixed precision training and inference
  • Gradient checkpointing and activation recomputation
  • Model parallelism (tensor, pipeline) and CPU offloading
  • Efficient attention mechanisms (e.g., FlashAttention, sparse attention)
  • Dynamic batching and caching for throughput

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

What is overfitting and what are some ways to mitigate it?

Technical Trade-offs
Author's notes

Pretty standard.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining overfitting as a model that memorizes training data and fails to generalize to unseen data, then explain the bias-variance trade-off. Structure your answer around practical mitigation techniques, grouping them into data, model, and training strategy categories. Emphasize that the goal is to balance model complexity with generalization, and mention how you would validate the impact of each technique.

Pro tip: At TikTok, where models often deal with massive, noisy user interaction data, highlight techniques that scale well, such as regularization and early stopping, and mention how you'd monitor overfitting in production using online metrics like AUC or log loss on a holdout set.

1. Define overfitting

Explain that overfitting occurs when a model learns noise and patterns specific to the training set, leading to poor performance on new data. Mention the bias-variance trade-off and how it relates to model complexity.

2. Identify causes and signs

Discuss common causes like high model complexity, small dataset, or noisy features. Describe signs such as a large gap between training and validation performance.

3. List mitigation techniques

Group techniques into data-based (more data, data augmentation, feature selection), model-based (simpler models, regularization like L1/L2, dropout), and training-based (early stopping, cross-validation, ensemble methods).

4. Explain how to choose and validate

Describe how you would select techniques based on the problem context and validate their effectiveness using a validation set or cross-validation, monitoring metrics like accuracy, AUC, or RMSE.

5. Relate to real-world impact

Connect the discussion to business impact, such as improving model generalization to new users or content on TikTok, and mention the importance of monitoring overfitting in production.

Key Points to Mention

  • Bias-variance trade-off
  • Regularization (L1/L2, dropout)
  • Cross-validation and early stopping
  • Data augmentation and feature selection
  • Ensemble methods (bagging, boosting)
  • Monitoring validation metrics vs. training metrics

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Implement a MinStack that returns the minimum element in O(1) time.

Algorithms & Data Structures
Author's notes

Classic.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use two stacks: one for the main data and one to keep track of the minimum values. When pushing, update the min stack with the new minimum; when popping, pop from both stacks if the popped value equals the current minimum. This ensures O(1) time for all operations.

Pro tip: Mention that this design uses O(n) extra space, but you can optimize to O(1) extra space by storing the difference between the value and the current minimum, or by using a single stack of pairs. Also, discuss edge cases like duplicate minimums and empty stack operations.

1. Clarify requirements

Confirm that all operations (push, pop, top, getMin) must be O(1) time and that the stack should handle edge cases like duplicate minimums and empty stack.

2. Design the data structure

Propose using two stacks: a main stack for all elements and a min stack that stores the minimum value at each level. Alternatively, use a single stack of pairs (value, current_min).

3. Implement operations

For push: push onto main stack; if min stack is empty or new value <= current min, push onto min stack. For pop: pop from main stack; if popped value equals min stack top, pop from min stack. For top: return main stack top. For getMin: return min stack top.

4. Analyze complexity

State that all operations run in O(1) time and O(n) space in the worst case. Mention that space can be optimized to O(1) extra space with a difference-based approach.

5. Test with examples

Walk through a sequence of operations (e.g., push 3, push 5, getMin, push 2, getMin, pop, getMin) to demonstrate correctness and handle duplicates.

Key Points to Mention

  • Two-stack approach: main stack and min stack
  • O(1) time for all operations
  • Handling duplicate minimum values correctly
  • Space complexity: O(n) extra space, with possible optimization to O(1)
  • Edge cases: empty stack, popping when min is removed
  • Alternative: single stack of pairs (value, current_min)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

What methods help reduce overfitting in deep learning, and how does Dropout work at a principled level?

Technical Trade-offs
Author's notes

Round 2 went deeper on this than round 1.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by categorizing the main regularization techniques (data, model, and training-based), then explain Dropout as an ensemble method with a principled Bayesian interpretation. Emphasize trade-offs and practical considerations, especially for large-scale recommendation systems like TikTok's.

Pro tip: Mention that Dropout can be viewed as approximate Bayesian inference in deep Gaussian processes, and that at test time, using the full network with scaled weights is equivalent to averaging an exponential number of subnetworks. This shows depth beyond typical answers.

1. Categorize regularization methods

Group methods into data augmentation, model complexity control (e.g., weight decay, dropout), and training strategies (e.g., early stopping, batch norm). This provides a clear structure.

2. Explain Dropout mechanics

Describe how Dropout randomly deactivates neurons during training with probability p, and at test time scales activations by (1-p) to maintain expected output.

3. Provide principled interpretation

Discuss Dropout as an ensemble of exponentially many subnetworks and its connection to Bayesian approximation (e.g., variational inference).

4. Discuss trade-offs and practical tips

Highlight that Dropout increases training time but reduces overfitting; mention alternatives like Batch Normalization, and how to tune dropout rate for different layers.

5. Relate to TikTok context

Connect to large-scale recommendation systems: Dropout helps prevent overfitting to sparse user-item interactions, and techniques like embedding dropout are common.

Key Points to Mention

  • Data augmentation, early stopping, weight decay (L1/L2), and Dropout as key regularization methods.
  • Dropout randomly drops units during training, preventing co-adaptation of features.
  • At test time, weights are scaled by the keep probability (or inverted dropout is used).
  • Dropout approximates model averaging over an exponential number of subnetworks.
  • Bayesian interpretation: Dropout as variational inference in deep Gaussian processes.
  • Trade-offs: Dropout increases training time but can be combined with other regularizers; tuning dropout rate is crucial.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

Compare different normalization techniques (batch norm, layer norm, etc.) and explain how each behaves differently at inference time.

Technical Trade-offsSystem Design
Author's notes

I compared batch norm vs layer norm vs group norm and then talked about how batch norm uses running statistics at inference instead of batch statistics.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the core idea of normalization in neural networks, then compare Batch Norm, Layer Norm, Instance Norm, and Group Norm in terms of what statistics they compute and over which dimensions. Finally, explain how each behaves differently at inference time, emphasizing the shift from batch-dependent to fixed statistics and the implications for deployment.

Pro tip: Highlight that Batch Norm's inference behavior depends on whether you use running statistics or batch statistics, and that this choice can cause train-test mismatch—a common pitfall in production systems. Mention that Layer Norm and its variants are batch-independent, making them more robust for online serving and variable batch sizes.

1. Define normalization and its purpose

Briefly explain that normalization techniques standardize activations to stabilize training, speed convergence, and reduce internal covariate shift. Mention that they differ in which dimensions they normalize over.

2. Compare training-time behavior

Describe how Batch Norm computes mean/variance per channel across the batch and spatial dimensions, while Layer Norm computes per sample across features, Instance Norm per sample per channel, and Group Norm per sample per group of channels.

3. Explain inference-time behavior

Detail that Batch Norm uses fixed running statistics (or batch statistics if specified) at inference, whereas Layer Norm, Instance Norm, and Group Norm compute statistics on-the-fly from the input, making them batch-independent.

4. Discuss trade-offs and use cases

Compare the implications: Batch Norm is efficient but sensitive to batch size and distribution shifts; Layer Norm is stable for sequences and small batches; Instance Norm is for style transfer; Group Norm balances between batch and layer norm.

5. Relate to system design and deployment

Connect to real-world scenarios: Batch Norm requires careful handling of running stats in distributed training and serving; Layer Norm is preferred in transformers and online inference due to its batch independence.

Key Points to Mention

  • Batch Norm normalizes over batch and spatial dimensions, using running averages at inference; Layer Norm normalizes over feature dimensions per sample, computed dynamically at inference.
  • Instance Norm and Group Norm are variants that normalize per sample and are batch-independent, often used in style transfer and segmentation.
  • At inference, Batch Norm's behavior depends on whether you use running statistics (typical) or batch statistics (rare), which can cause train-test discrepancy.
  • Layer Norm and its variants do not require running statistics, making them more robust to variable batch sizes and distribution shifts in production.
  • The choice of normalization affects model architecture, training stability, and inference latency, especially in distributed systems.
  • TikTok's large-scale recommendation and content understanding models often use Layer Norm in transformers and Batch Norm in CNNs, so understanding both is crucial.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q6

How is reinforcement learning applied in LLM post-training, specifically in the context of learning from human feedback?

Technical Trade-offsSystem Design
Author's notes

Talked through the reward model setup, the policy optimization loop, and why KL divergence is used to keep the model from drifting too far from the base.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing RLHF as a three-stage pipeline: supervised fine-tuning, reward modeling from human preferences, and policy optimization with RL. Then explain how each stage addresses a specific challenge in aligning LLMs with human intent, and briefly mention alternatives like DPO and RLAIF. Finally, connect it to TikTok's use case such as improving content recommendations or user engagement.

Pro tip: Emphasize the trade-offs between reward model accuracy and policy over-optimization, and mention how you would monitor for reward hacking in production. This shows you understand both the theory and the practical pitfalls of deploying RLHF at scale.

1. Define RLHF and its role in LLM post-training

Explain that RLHF is a technique to fine-tune LLMs using human feedback to align them with human values and preferences, beyond what supervised learning can achieve.

2. Describe the three-stage RLHF pipeline

Outline: (1) Supervised fine-tuning on demonstrations, (2) Training a reward model on human preference comparisons, (3) Fine-tuning the LLM with RL (e.g., PPO) to maximize the reward model's score.

3. Explain the RL algorithm and objective

Detail how policy gradient methods like PPO are used, with a KL penalty to prevent divergence from the original model, and how the reward model provides scalar feedback.

4. Discuss challenges and trade-offs

Mention issues like reward hacking, high computational cost, sample inefficiency, and the need for careful hyperparameter tuning. Compare with alternatives like DPO.

5. Connect to TikTok's context

Relate RLHF to TikTok's needs, such as improving content moderation, recommendation explanations, or user engagement through better-aligned LLM responses.

Key Points to Mention

  • Reward modeling from pairwise human preferences (e.g., Bradley-Terry model)
  • Proximal Policy Optimization (PPO) and KL divergence penalty
  • Reward hacking and over-optimization
  • Direct Preference Optimization (DPO) as a simpler alternative
  • Scalability and computational challenges of RLHF
  • Reinforcement Learning from AI Feedback (RLAIF) for reducing human labeling

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q7

Implement a MaxStack. Then, extend the idea to compute a running median from a data stream.

Algorithms & Data Structures
Author's notes

MaxStack was fine, mirror of MinStack.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the requirements and constraints for MaxStack, then implement it using two stacks (one for values, one for maximums) to achieve O(1) push, pop, and getMax. For the running median, explain that a max-heap for the lower half and a min-heap for the upper half maintains balance, allowing O(log n) insertion and O(1) median retrieval. Emphasize the trade-offs and potential optimizations.

Pro tip: Discuss how these data structures can be applied to real-time data processing at TikTok, such as monitoring trending topics or user engagement metrics, to show practical relevance.

1. Clarify Requirements

Ask about expected operations, constraints (e.g., time complexity, memory), and edge cases for both MaxStack and running median.

2. Design MaxStack

Propose using two stacks: one to store all elements, another to keep track of the maximum so far. Explain how push, pop, top, and getMax work in O(1) time.

3. Design Running Median

Describe the two-heap approach: a max-heap for the lower half and a min-heap for the upper half. Explain how to balance the heaps after each insertion to maintain the median.

4. Analyze Complexity

State the time and space complexity for each operation. For MaxStack, all operations are O(1); for running median, insertion is O(log n) and median retrieval is O(1).

5. Discuss Extensions and Trade-offs

Mention alternative approaches (e.g., balanced BST for median) and trade-offs. Highlight how these structures can be used in data science pipelines for real-time analytics.

Key Points to Mention

  • Two-stack approach for MaxStack with O(1) operations
  • Two-heap approach for running median with O(log n) insertion
  • Handling edge cases: empty stack, duplicate values, even/odd number of elements
  • Time and space complexity analysis
  • Comparison with alternative data structures (e.g., balanced BST, sorted list)
  • Application to real-time data streams and data science tasks

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q8

Explain Dropout again and specifically address why it preserves distributional consistency between training and inference.

Technical Trade-offs
Author's notes

They asked this a second time across rounds, which was unexpected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining Dropout as a regularization technique that randomly deactivates neurons during training to prevent co-adaptation. Then, explain the distributional shift it introduces between training and inference, and how the scaling factor (either at train or test time) ensures that the expected output remains consistent. Conclude by emphasizing the importance of this consistency for model performance.

Pro tip: Mention that the scaling factor is exactly 1/(1-p) where p is the dropout rate, and that this ensures the expected sum of inputs to the next layer remains the same. Also, note that this is a form of Monte Carlo approximation at test time if dropout is kept on, but standard practice is to scale weights instead.

1. Define Dropout

Explain that Dropout randomly sets a fraction p of input units to zero during training, which prevents overfitting by reducing complex co-adaptations.

2. Describe Training vs. Inference

During training, each neuron is kept with probability 1-p and its output is scaled by 1/(1-p) (inverted dropout) or not scaled (original dropout). During inference, all neurons are active and no dropout is applied.

3. Explain Distributional Consistency

The scaling ensures that the expected total input to the next layer during training matches the actual input during inference, preserving the distribution of activations.

4. Discuss Implementation Choices

Mention inverted dropout (scaling at train time) as the standard because it keeps inference unchanged and efficient, avoiding any scaling at test time.

5. Conclude with Impact

Emphasize that without this scaling, the model would suffer from a shift in activation magnitudes, leading to degraded performance at inference.

Key Points to Mention

  • Dropout rate p and keep probability 1-p
  • Inverted dropout: scaling during training by 1/(1-p)
  • Expected value of neuron output remains the same
  • Distributional shift if no scaling is applied
  • Monte Carlo approximation and model averaging interpretation
  • Efficiency: no scaling needed at inference time

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q9

Given a binary tree, determine if there exists a path starting from any node and moving only upward toward the root where the node values sum to a given target.

Algorithms & Data Structures
Author's notes

The upward-only constraint changes things compared to the usual root-to-leaf path sum.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that the path must start at any node and go strictly upward to the root, so it is a contiguous suffix of the root-to-node path. Use a recursive DFS that passes down the current path sum from the root, and at each node check whether the sum of the path from that node to the root equals the target by subtracting the prefix sum before the node. Alternatively, use a hash map of prefix sums to count valid upward paths in O(n) time.

Pro tip: Mention that this is essentially the 'path sum III' variant but with paths going upward instead of downward, and that the prefix-sum hash map approach generalizes to counting paths, which is often the follow-up at TikTok.

1. Clarify the problem

Confirm that the path starts at any node and moves only upward toward the root, meaning it is a contiguous sequence of nodes from some node up to the root. Also clarify whether the target can be negative and whether the path must include the root.

2. Define the recursive relation

For a node, the sum of the path from that node to the root equals the sum of the path from its parent to the root plus the node's value. So during DFS, maintain the current path sum from the root to the current node.

3. Check for valid paths

At each node, check if the current path sum minus the target exists in a hash map of prefix sums seen so far. If yes, there is a valid upward path ending at the current node. Add the current path sum to the hash map before recursing.

4. Handle backtracking

After processing the left and right subtrees, remove the current path sum from the hash map to ensure that only ancestors are considered for other branches.

5. Analyze complexity

The DFS visits each node once, and hash map operations are O(1) on average, so time complexity is O(n) and space complexity is O(n) for the hash map and recursion stack.

Key Points to Mention

  • The path is a contiguous sequence from a node up to the root, so it corresponds to a suffix of the root-to-node path.
  • Use a hash map to store prefix sums from the root to the current node to achieve O(n) time.
  • At each node, check if (current_sum - target) exists in the hash map to find valid upward paths.
  • Backtrack by removing the current sum from the hash map after processing children.
  • Time complexity O(n), space complexity O(n) due to recursion and hash map.
  • This approach can be extended to count all such paths, not just determine existence.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.