← TikTok Interview Insights

TikTok·Data Scientist·Onsite - Multi Round·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Three rounds for a Data Scientist role at TikTok, mixing ML theory, system design, and coding. The questions recycled a few themes (Dropout came up twice across different rounds) which was a little odd, and the coding problems escalated from MinStack to a binary tree path problem that felt more like a software engineering interview than a DS one.

Questions Asked (9)

Q1

How would you deploy multimodal models when you have limited compute and GPU memory available?

System DesignTechnical Trade-offs
Author's notes

This one took me a second to organize my thoughts.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the constraints (latency, throughput, accuracy) and the multimodal task (e.g., image-text retrieval, generation). Then propose a layered strategy: model compression (quantization, pruning, distillation), efficient serving (batching, caching, offloading), and architectural choices (modality-specific encoders, parameter sharing). Emphasize trade-offs and iterative optimization based on monitoring.

Pro tip: Tie your answer to TikTok's scale and real-time needs: mention how you'd leverage mixed precision and dynamic batching to handle viral spikes, and how you'd measure the impact on user engagement metrics like watch time.

1. Clarify requirements and constraints

Ask about latency, throughput, accuracy targets, and hardware specifics (GPU type, memory, count). Understand the multimodal task and data modality balance.

2. Apply model compression techniques

Use quantization (FP16, INT8), pruning, and knowledge distillation to reduce model size and compute. Consider modality-specific compression (e.g., vision encoder quantization).

3. Optimize serving and inference

Implement dynamic batching, caching of embeddings, and CPU offloading. Use frameworks like TensorRT, ONNX Runtime, or DeepSpeed for efficient inference.

4. Design efficient architecture

Adopt parameter-efficient architectures (e.g., adapters, LoRA) and modality-specific encoders with shared representations. Consider early fusion vs. late fusion based on compute budget.

5. Monitor and iterate

Set up monitoring for latency, memory, and accuracy. Use A/B testing to validate trade-offs and iterate on compression and serving strategies.

Key Points to Mention

  • Quantization (FP16, INT8) and its impact on accuracy and speed
  • Knowledge distillation from larger multimodal models
  • Dynamic batching and caching to handle variable load
  • Parameter-efficient fine-tuning (e.g., LoRA, adapters)
  • Model parallelism and CPU offloading for large models
  • Trade-offs between latency, throughput, and accuracy

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

Q2

You already have captions and embeddings for a video dataset. How would you speed up video retrieval using those?

System DesignTechnical Trade-offs
Author's notes

Follow-up to the multimodal question.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Focus on leveraging the existing captions and embeddings to build a multi-stage retrieval system that first uses efficient approximate nearest neighbor search on embeddings, then refines with caption-based filtering or re-ranking. Emphasize trade-offs between speed, accuracy, and scalability, and how to optimize each component for TikTok's large-scale video dataset.

Pro tip: Demonstrate awareness of real-world constraints by discussing how to handle embedding drift and the need for periodic re-indexing, and mention the importance of monitoring retrieval latency and relevance metrics in production.

1. Clarify requirements and constraints

Ask about the scale of the dataset, query types (text, video, multimodal), latency requirements, and accuracy targets to tailor the solution.

2. Design a multi-stage retrieval pipeline

Propose a two-stage approach: first, use approximate nearest neighbor (ANN) search on embeddings to quickly retrieve a candidate set; second, re-rank or filter using captions (e.g., BM25 or semantic matching) to improve precision.

3. Optimize embedding search

Discuss indexing structures (e.g., HNSW, IVF-PQ), quantization, and hardware acceleration (GPU) to speed up ANN search while maintaining recall.

4. Leverage captions for efficiency

Use captions for query understanding, filtering, or as a lightweight first-stage retrieval (e.g., inverted index) to reduce the number of embeddings to search.

5. Evaluate and iterate

Define metrics (latency, recall@k, mAP) and set up A/B testing to continuously improve the system, considering caching and pre-computation.

Key Points to Mention

  • Approximate nearest neighbor (ANN) algorithms like HNSW or IVF-PQ for fast embedding search
  • Trade-offs between speed and accuracy (e.g., recall vs. latency)
  • Using captions for query expansion or as a complementary retrieval signal
  • Caching frequent queries and pre-computing embeddings for new videos
  • Scalability considerations: sharding, distributed search, and hardware acceleration
  • Evaluation metrics and online experimentation for continuous improvement

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

Q3

What is overfitting and what are the main ways to reduce it?

Technical Trade-offs
Author's notes

Came up in round 1 and then again in more depth in round 2.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start with a clear, concise definition of overfitting, then explain why it matters in practice. Structure your answer around the main techniques to reduce it, grouping them into data-based, model-based, and regularization methods. Emphasize trade-offs and how you would choose among them in a real-world scenario.

Pro tip: Tie your answer to TikTok's scale and real-time recommendation systems: mention that with massive datasets, overfitting can still occur due to distribution shifts or rare events, and techniques like regularization must be balanced with latency constraints.

1. Define overfitting

Explain that overfitting occurs when a model learns noise and patterns specific to the training data, leading to poor generalization on unseen data. Mention the bias-variance trade-off.

2. Explain why it's a problem

Highlight consequences like poor performance in production, especially in dynamic environments like TikTok where user behavior shifts rapidly.

3. List main reduction techniques

Group methods into: (a) data-based (more data, data augmentation, cross-validation), (b) model-based (simpler models, early stopping, pruning), and (c) regularization (L1/L2, dropout, batch norm).

4. Discuss trade-offs and selection

Explain how to choose techniques based on constraints like interpretability, latency, and computational resources. For example, dropout is cheap but may not suit all architectures.

5. Conclude with practical example

Briefly mention a scenario where you applied these techniques, e.g., using early stopping and L2 regularization in a deep learning model for user engagement prediction.

Key Points to Mention

  • Bias-variance trade-off
  • Cross-validation (k-fold, time-series split)
  • Regularization (L1/L2, dropout, early stopping)
  • Data augmentation and more training data
  • Ensemble methods (bagging, boosting)
  • Model complexity control (pruning, simpler architectures)

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

Q4

Implement a MinStack data structure that retrieves 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

Clarify the required operations (push, pop, top, getMin) and the O(1) time constraint. Propose using an auxiliary stack that tracks the minimum value alongside the main stack, ensuring all operations remain O(1). Walk through an example to demonstrate correctness and discuss edge cases like duplicate minimums and popping the minimum.

Pro tip: Mention that you can optimize space by storing the minimum only when it changes, or by using a single stack with encoded values, but prioritize clarity and correctness in the interview. Also, relate the problem to real-world scenarios like tracking minimum latency in a streaming system, which resonates with TikTok's data-intensive environment.

1. Clarify requirements and constraints

Confirm the operations needed (push, pop, top, getMin) and that all must be O(1) time. Ask about potential constraints like memory usage or thread safety.

2. Design the data structure

Propose using two stacks: one for all elements and one for minimums. Explain how the min stack is updated on push and pop to always have the current minimum at the top.

3. Walk through an example

Demonstrate with a sequence of operations (e.g., push 5, push 3, push 7, getMin, pop, getMin) to show how the min stack behaves and why getMin is O(1).

4. Discuss edge cases and optimizations

Address duplicate minimums, popping the minimum, and empty stack scenarios. Mention space optimizations like storing min only when it changes or using a single stack with encoded values.

5. Analyze complexity and conclude

State that all operations are O(1) time and O(n) space. Summarize the solution and its suitability for the problem.

Key Points to Mention

  • Use of an auxiliary stack to track minimums
  • O(1) time complexity for all operations
  • Handling duplicate minimum values correctly
  • Edge cases: popping the minimum, empty stack
  • Space optimization techniques (e.g., storing min only when it changes)
  • Real-world relevance to data science (e.g., streaming minimum latency)

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

Q5

Walk through different normalization techniques (batch norm, layer norm, etc.) and explain how inference behavior differs from training.

Technical Trade-offs
Author's notes

I liked this question more than the basic overfitting one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by categorizing normalization techniques (batch, layer, instance, group) and their key differences. Then explain how each behaves during training versus inference, focusing on the use of batch statistics vs. running estimates. Finally, discuss practical implications for model deployment and performance.

Pro tip: Emphasize that batch norm's inference behavior depends on the running statistics computed during training, which can cause issues if the inference data distribution shifts. Mention that layer norm and its variants are often preferred in NLP and online serving because they are independent of batch size and more stable.

1. Define normalization and its purpose

Briefly explain why normalization is used: to stabilize training, reduce internal covariate shift, and allow higher learning rates.

2. Compare normalization techniques

Describe batch norm, layer norm, instance norm, and group norm, highlighting what dimensions they normalize over (batch, features, spatial, etc.).

3. Explain training behavior

For each technique, explain how normalization is applied during training, e.g., batch norm uses mini-batch statistics, layer norm uses per-sample statistics.

4. Explain inference behavior

Detail how inference differs: batch norm uses running averages (or fixed statistics) instead of batch statistics, while layer norm and others remain consistent between training and inference.

5. Discuss trade-offs and practical implications

Cover scenarios where each technique is preferred, such as batch norm for CNNs with large batches, layer norm for RNNs/Transformers, and the impact on online serving and distributed training.

Key Points to Mention

  • Batch norm uses batch statistics during training but running averages during inference, which can cause a train-test discrepancy if batch sizes differ.
  • Layer norm normalizes across features for each sample independently, so it behaves identically in training and inference.
  • Instance norm and group norm are variants that normalize over spatial dimensions or groups of channels, often used in style transfer or when batch size is small.
  • The choice of normalization affects model convergence, memory usage, and suitability for different architectures (e.g., CNNs vs. Transformers).
  • Inference behavior can be optimized by folding batch norm into preceding layers (e.g., convolution) to reduce computation.
  • TikTok's large-scale recommendation systems may require normalization techniques that are robust to varying batch sizes and streaming data.

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

Q6

How is reinforcement learning from human feedback used in post-training large language models?

Technical Trade-offsSystem Design
Author's notes

Talked through the reward model training, the PPO loop, and why KL divergence penalty matters to keep the model from drifting too far.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining RLHF and its role in aligning LLMs with human preferences after pretraining. Then walk through the three-stage pipeline (SFT, reward modeling, PPO) and discuss trade-offs like reward hacking and scalability. Finally, connect to TikTok's use cases such as content moderation or recommendation.

Pro tip: Emphasize that RLHF is not just about performance but about aligning model behavior with human values—highlight how you'd measure success beyond reward scores, e.g., via human evaluation or A/B tests.

1. Define RLHF and its purpose

Explain that RLHF fine-tunes LLMs using human feedback to align outputs with human preferences, improving helpfulness, harmlessness, and honesty.

2. Describe the three-stage pipeline

Outline supervised fine-tuning (SFT) on demonstrations, training a reward model on human comparisons, and optimizing the policy with reinforcement learning (e.g., PPO).

3. Discuss key challenges and trade-offs

Mention issues like reward hacking, high computational cost, and the need for large-scale human annotation, and how to mitigate them (e.g., KL penalty, iterative feedback).

4. Connect to TikTok's context

Relate RLHF to TikTok's needs, such as ensuring safe and engaging content, personalizing recommendations, or moderating user interactions.

5. Evaluate and iterate

Explain how to measure success via human evaluations, A/B testing, and monitoring for unintended behaviors, and how to iterate on the reward model and policy.

Key Points to Mention

  • Supervised fine-tuning (SFT) on human demonstrations
  • Reward modeling from human preference comparisons
  • Reinforcement learning (e.g., PPO) with KL divergence penalty
  • Challenges: reward hacking, scalability, annotation cost
  • Evaluation: human eval, A/B testing, safety metrics
  • Application to TikTok: content moderation, personalization, user safety

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

Q7

Implement a MaxStack that retrieves the maximum element in O(1) time, and then extend it to compute a running median from a data stream.

Algorithms & Data Structures
Author's notes

The MaxStack itself was straightforward after doing MinStack in round 1.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by designing a MaxStack using two stacks: one for all elements and one to track the maximum at each level, enabling O(1) max retrieval. Then, for the running median, explain that a max-heap for the lower half and a min-heap for the upper half maintain the median in O(log n) insertion and O(1) retrieval. Emphasize the trade-offs and how these structures handle dynamic data streams.

Pro tip: Mention that in real-world data streams, you must handle edge cases like empty streams and ensure balanced heaps; also, note that the two-stack approach for MaxStack can be extended to support popMax in O(log n) with a balanced BST, showing depth beyond the basic solution.

1. Clarify requirements and constraints

Confirm that MaxStack needs push, pop, top, and getMax all in O(1) time, and that the running median should be computed after each insertion. Ask about data types, stream size, and memory constraints.

2. Design MaxStack with two stacks

Use a main stack for elements and a max stack that stores the maximum seen so far. On push, compare with current max and push the larger onto the max stack; on pop, pop both stacks. This gives O(1) for all operations.

3. Design running median with two heaps

Maintain a max-heap for the lower half and a min-heap for the upper half. After each insertion, balance the heaps so their sizes differ by at most one. The median is the top of the larger heap or the average of both tops.

4. Analyze time and space complexity

State that MaxStack operations are O(1) time and O(n) space. For running median, insertion is O(log n) due to heap operations, and median retrieval is O(1). Space is O(n) for storing the stream.

5. Discuss extensions and trade-offs

Mention that popMax in MaxStack can be optimized with a balanced BST or a doubly linked list plus heap, but at the cost of increased complexity. For running median, note that heaps are optimal for streaming data compared to sorting each time.

Key Points to Mention

  • Two-stack approach for MaxStack with auxiliary stack tracking maximums
  • Heap-based solution for running median using max-heap and min-heap
  • Balancing condition: sizes of heaps differ by at most 1
  • Time complexity: O(1) for MaxStack operations, O(log n) for median insertion, O(1) for median retrieval
  • Space complexity: O(n) for both structures
  • Edge cases: empty stream, duplicate elements, and negative numbers

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

Q8

Explain Dropout again: why does it work, and how does it preserve the distribution of activations at inference time?

Technical Trade-offs
Author's notes

They literally asked me Dropout again in round 3 after I'd covered it in round 2.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining Dropout as a regularization technique that prevents overfitting by randomly deactivating neurons during training. Then describe how it approximates an ensemble of subnetworks and why scaling at inference preserves the expected activation distribution. Finally, connect it to practical benefits like improved generalization and uncertainty estimation.

Pro tip: Emphasize that Dropout is not just about preventing co-adaptation but also acts as a Bayesian approximation, providing a cheap way to estimate model uncertainty—a point that resonates in industry settings like TikTok where robustness matters.

1. Define Dropout and its purpose

Explain that Dropout randomly sets a fraction of input units to 0 during training to prevent overfitting. Mention that it forces the network to learn redundant representations.

2. Explain why Dropout works

Discuss how Dropout prevents co-adaptation of neurons, effectively training an ensemble of subnetworks. At test time, using the full network approximates averaging these subnetworks, reducing variance.

3. Describe the scaling at inference

Explain that at inference, no units are dropped, but activations are scaled by the keep probability (1 - dropout rate) to maintain the expected output magnitude. Alternatively, use inverted dropout during training to avoid scaling at test time.

4. Connect to distribution preservation

Show that scaling ensures the expected activation at inference equals the expected activation during training, preventing a shift in the input distribution to subsequent layers.

5. Mention practical implications and variants

Highlight that Dropout is simple, effective, and has variants like DropConnect or Monte Carlo Dropout for uncertainty. Note that it's less common in some modern architectures but still valuable.

Key Points to Mention

  • Dropout prevents overfitting by reducing co-adaptation of neurons.
  • It approximates training an ensemble of subnetworks, and inference approximates averaging their predictions.
  • Scaling by keep probability (or inverted dropout) preserves the expected activation distribution.
  • Without scaling, activations at inference would be larger than during training, causing a distribution shift.
  • Dropout can be interpreted as a Bayesian approximation, enabling uncertainty estimation via Monte Carlo Dropout.
  • Practical trade-offs: Dropout adds noise and may require longer training, but improves generalization.

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

Q9

Given a binary tree, find whether any upward-only path starting from any node sums to a given target value.

Algorithms & Data Structures
Author's notes

Hardest coding problem of the three rounds.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that an upward-only path starts at any node and moves only to its ancestors, so each path is a contiguous sequence of nodes from a starting node up to some ancestor. Use a recursive DFS that returns all prefix sums from the current node upward, then check if any prefix sum equals the target. Alternatively, use a hash map to track cumulative sums from the root to the current node, but adapt it for upward paths by considering sums from each node to its ancestors.

Pro tip: Mention that the problem can be solved in O(n) time with O(h) space using a hash map of cumulative sums from the root, but be careful: the standard path-sum approach for downward paths doesn't directly apply because upward paths can start anywhere. Instead, for each node, you need to check if there exists an ancestor such that the sum from the node to that ancestor equals the target, which can be done by storing the cumulative sum from the root and checking if (current_cumulative - target) exists in the map for ancestors.

1. Clarify the problem

Confirm that an upward-only path starts at any node and moves only to its ancestors (parent, grandparent, etc.), and that the path must be contiguous. Ask if the tree is binary and if node values can be negative.

2. Define the recursive approach

For each node, compute all possible sums of upward paths starting at that node. This can be done by returning a list of sums from the node to each ancestor, or by using a hash map to track cumulative sums from the root.

3. Implement DFS with cumulative sums

Traverse the tree using DFS, maintaining a hash map of cumulative sums from the root to the current node's ancestors. At each node, check if (current_cumulative - target) exists in the map, which indicates an upward path sum equals the target.

4. Handle edge cases and complexity

Consider empty tree, single node, negative values, and target zero. Analyze time complexity O(n) and space complexity O(h) for the hash map and recursion stack.

5. Test with examples

Walk through a small example to verify the logic, such as a tree with values [1,2,3] and target 3, checking paths like 3 (single node) and 1->2 (if 1 is child of 2).

Key Points to Mention

  • Definition of upward-only path: from a node to any of its ancestors, moving only upward.
  • Use of cumulative sums from the root to avoid recomputing path sums.
  • Hash map to store cumulative sums of ancestors for O(1) lookup.
  • Time complexity O(n) and space complexity O(h) where h is tree height.
  • Handling negative values and target zero.
  • Difference from downward path sum problems and why standard approach needs adaptation.

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