← Thumbtack Interview Insights

Thumbtack·Data Scientist·Technical Phone Screen·Senior

Senior
Jun 2026

Summary

Technical screen for a Data Scientist role at Thumbtack that went deep into NLP pipelines and n-gram feature engineering. The questions were specific enough that I felt like I was being quizzed on a paper I'd half-read.

Questions Asked (4)

Q1

Walk through how you'd design a text preprocessing pipeline depending on whether the input comes from typed text, OCR of scanned documents, or speech-to-text output. Cover language handling, normalization, tokenization strategy, stopwords, lemmatization or stemming, and how you'd deal with emojis, URLs, code snippets, and out-of-vocabulary terms.

Technical Trade-offsSystem Design
Author's notes

This was the opening question and it sprawled fast.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by framing the pipeline as a modular sequence of stages, then tailor each stage to the input source's unique noise profile. Emphasize trade-offs between aggressive normalization and information preservation, and tie choices back to downstream tasks like search, classification, or matching.

Pro tip: Always design with the end task in mind—preprocessing that helps a classifier may hurt a retrieval system, so justify each decision by its impact on metrics like precision, recall, or latency.

1. Identify input source and noise characteristics

Analyze the typical errors and artifacts for typed text (typos, slang), OCR (misrecognized characters, broken words), and speech-to-text (homophones, missing punctuation, filler words). This guides which preprocessing steps are most critical.

2. Design language handling and normalization

Detect language (or handle multilingual input), then apply normalization: lowercasing, Unicode normalization, and source-specific corrections (e.g., OCR spell-check, speech disfluency removal). Preserve case or punctuation only if downstream tasks require it.

3. Choose tokenization and stopword strategy

Select tokenization (word, subword, or character) based on language and vocabulary size; for noisy sources, consider subword tokenization to handle OOV. Decide whether to remove stopwords based on task—often keep them for semantic tasks, remove for keyword extraction.

4. Apply lemmatization or stemming and handle special tokens

Use lemmatization for grammatical correctness or stemming for speed; handle emojis (convert to text or keep as features), URLs (replace with placeholder or extract domain), and code snippets (preserve or mask). For OOV terms, use subword units or a fallback token.

5. Validate and iterate with downstream metrics

Test the pipeline on a sample, measure impact on downstream task performance, and adjust steps. Document assumptions and ensure reproducibility across input sources.

Key Points to Mention

  • Source-specific noise profiles: OCR errors vs. speech disfluencies vs. typed slang
  • Language detection and multilingual support
  • Normalization techniques: Unicode, lowercasing, and source-specific cleaning
  • Tokenization trade-offs: word vs. subword vs. character, and handling OOV
  • Stopword removal and lemmatization/stemming decisions based on task
  • Special token handling: emojis, URLs, code snippets, and placeholders

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

Q2

You used unigrams through trigrams in your feature set. Justify that range theoretically and empirically, including the tradeoffs around sparsity, vocabulary explosion, and how the choice interacts differently with linear models versus tree-based or neural models. How did your metrics and feature importances actually shift as you moved from unigrams to bigrams to trigrams?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

The empirical part tripped me up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Structure your answer by first explaining the theoretical rationale for n-grams (capturing local context and reducing ambiguity), then discuss empirical tradeoffs (sparsity, vocabulary size, model performance) and how they differ across model types. Finally, describe how you measured the impact (metrics, feature importances) and what you observed when moving from unigrams to bigrams to trigrams.

Pro tip: Emphasize that the optimal n-gram range depends on the task, dataset size, and model capacity—there's no one-size-fits-all. Mention that you validated the choice with cross-validation and considered computational constraints.

1. Theoretical Justification

Explain why n-grams capture local context and reduce ambiguity (e.g., 'New York' vs 'New' and 'York'). Discuss the bias-variance tradeoff: higher n-grams capture more specific patterns but increase sparsity.

2. Empirical Tradeoffs

Quantify sparsity and vocabulary explosion: as n increases, the number of unique n-grams grows exponentially, leading to many rare features. Discuss how this affects model training and generalization.

3. Model-Specific Interactions

Explain how linear models (e.g., logistic regression) benefit from explicit n-grams but suffer from high dimensionality, while tree-based models can capture interactions but may overfit with sparse features. Neural models (e.g., embeddings) can learn compositional representations, reducing the need for high-order n-grams.

4. Metrics and Feature Importance Shifts

Describe how you evaluated performance (e.g., accuracy, F1, AUC) and feature importances (e.g., coefficients, SHAP values) at each n-gram level. Note any improvements or degradation and whether certain n-grams dominated.

5. Conclusion and Decision

Summarize the optimal range you chose and why, balancing performance gains against computational cost and overfitting risk. Mention any regularization or feature selection techniques used.

Key Points to Mention

  • Sparsity: higher n-grams create many features with low frequency, leading to overfitting and increased memory/compute.
  • Vocabulary explosion: the number of unique n-grams grows exponentially with n, requiring careful pruning or hashing.
  • Linear models: explicit n-grams are crucial for capturing interactions, but require regularization (L1/L2) to handle high dimensionality.
  • Tree-based models: can implicitly capture interactions but may overfit to sparse n-grams; feature importance may show high-order n-grams as less useful.
  • Neural models: can learn from raw text or embeddings, making high-order n-grams less necessary; however, they may still benefit from some n-gram features.
  • Empirical results: typically, bigrams improve over unigrams, but trigrams may yield diminishing returns or overfitting; monitor metrics like F1 and feature importance stability.

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

Q3

Compare word-level n-grams versus character-level n-grams. In what situations does each approach outperform the other, particularly for noisy text with misspellings or languages with rich morphology?

Technical Trade-offs
Author's notes

Short answer and I think I did okay here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining both approaches and their core differences, then systematically compare their strengths and weaknesses across dimensions like vocabulary size, sparsity, and robustness. Finally, apply these trade-offs to the specific scenarios of noisy text and morphologically rich languages, concluding with practical recommendations for when to use each.

Pro tip: Mention that in practice, character n-grams are often used as a fallback or in combination with word n-grams, and that subword tokenization methods like BPE or WordPiece offer a modern alternative that balances the two.

1. Define and contrast

Clearly define word-level and character-level n-grams, highlighting that word n-grams capture semantic units while character n-grams capture subword patterns.

2. Compare key properties

Discuss differences in vocabulary size, sparsity, and ability to handle unseen words. Word n-grams have larger vocabularies and sparsity issues; character n-grams have smaller vocabularies but lose semantic meaning.

3. Analyze noisy text

Explain that character n-grams are more robust to misspellings and typos because they capture partial matches, while word n-grams fail on out-of-vocabulary words.

4. Analyze rich morphology

Explain that character n-grams handle morphologically rich languages better by capturing prefixes, suffixes, and stems, whereas word n-grams suffer from data sparsity due to many inflected forms.

5. Conclude with trade-offs and recommendations

Summarize that word n-grams are better for clean, semantically focused tasks, while character n-grams excel in noisy or morphologically complex settings. Suggest hybrid approaches or subword tokenization as modern solutions.

Key Points to Mention

  • Vocabulary size and sparsity: word n-grams have large vocabularies leading to sparse representations; character n-grams have smaller vocabularies but may lose semantic meaning.
  • Robustness to noise: character n-grams are more robust to misspellings and typos, as they can match substrings even with errors.
  • Morphological richness: character n-grams capture affixes and stems, making them effective for languages with rich morphology, while word n-grams struggle with many inflected forms.
  • Out-of-vocabulary (OOV) handling: character n-grams can represent unseen words, whereas word n-grams cannot.
  • Computational efficiency: character n-grams can be more computationally expensive due to longer sequences, but this can be mitigated with techniques like hashing.
  • Hybrid approaches: combining word and character n-grams or using subword tokenization (e.g., BPE, WordPiece) often yields the best performance.

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

Q4

How would you validate this preprocessing and feature pipeline end to end? Describe your train/validation split strategy, how you'd check for data leakage, and how you'd compare this classical approach against a transformer-based tokenizer and embedding.

Technical Trade-offsA/B Testing & Experimentation
Author's notes

The leakage question felt like a gotcha and I almost missed the obvious one: fitting the tokenizer or vocabulary on the full dataset before splitting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by outlining a robust validation strategy that mirrors production data, then detail specific leakage checks at each pipeline stage. Finally, compare classical and transformer approaches using a controlled experiment with clear metrics and trade-off analysis.

Pro tip: Emphasize that leakage can occur not only in train/test split but also during feature engineering (e.g., target encoding, scaling) and that using a time-based split is crucial for temporal data. Also, when comparing models, ensure you account for computational cost and latency, not just accuracy.

1. Define validation strategy

Choose a split that reflects the real-world deployment scenario (e.g., time-based for temporal data, stratified for imbalanced classes). Ensure the validation set is large enough to detect meaningful differences.

2. Implement leakage checks

Audit the pipeline for common leakage sources: target leakage, train-test contamination, and improper cross-validation. Use techniques like adversarial validation to detect distribution shifts.

3. Validate preprocessing and feature engineering

Fit preprocessing steps (e.g., scaling, imputation) only on training data and apply to validation/test. For feature engineering, ensure no future information is used (e.g., rolling statistics should only use past data).

4. Set up model comparison

Define evaluation metrics (e.g., accuracy, F1, AUC) and a baseline. Train both classical and transformer models on the same data splits, and compare performance, training time, inference latency, and resource usage.

5. Analyze trade-offs and iterate

Interpret results in the context of business needs: is the transformer's performance gain worth the cost? Consider hybrid approaches or further feature engineering. Document findings and recommend next steps.

Key Points to Mention

  • Time-based split for temporal data to prevent future leakage
  • Adversarial validation to check for distribution shift between train and validation
  • Fit preprocessing only on training data and apply to validation/test
  • Use of pipelines (e.g., sklearn Pipeline) to encapsulate preprocessing and prevent leakage
  • Comparison metrics: not just accuracy but also training/inference time, model size, and interpretability
  • Consideration of business impact: latency, cost, and scalability when choosing between classical and transformer models

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