← Expedia Interview Insights

Expedia·Machine Learning Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

First round for an MLE role at Expedia, basically a notebook-based case study centered on LLMs. The skeleton was already there so you're not starting from scratch, but you still have to implement the real pieces yourself.

Questions Asked (2)

Q1

Given a pre-built LLM training framework in a notebook, implement a tokenizer along with word-to-token and token-to-word conversion functions.

Technical Trade-offsAlgorithms & Data Structures
Author's notes

Having the framework handed to you sounds like a relief until you realize the tokenizer is actually the part that needs to work correctly for everything downstream.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the tokenization strategy (e.g., word-level, subword like BPE) and the expected vocabulary size. Then implement a Tokenizer class with a vocabulary dictionary and methods for encoding (word-to-token) and decoding (token-to-word), handling unknown tokens and special tokens. Test with sample text to ensure round-trip consistency.

Pro tip: Mention that in production, tokenizers are often pre-trained and reused; here, focus on clean, efficient code with proper handling of edge cases like OOV and padding, which shows you think beyond the notebook.

1. Clarify requirements and assumptions

Ask about the tokenization granularity (word, character, subword), vocabulary size, and whether special tokens (e.g., <unk>, <pad>) are needed. Confirm if the tokenizer should be trained on the given corpus or if a pre-built vocabulary is provided.

2. Design the Tokenizer class

Outline a class with a vocabulary mapping (token to ID and ID to token), and methods for encoding and decoding. Consider adding a method to build the vocabulary from a corpus if needed.

3. Implement word-to-token (encoding)

Write a function that splits input text into tokens (e.g., by whitespace or using regex), maps each token to its ID using the vocabulary, and handles unknown tokens by assigning the <unk> ID.

4. Implement token-to-word (decoding)

Write a function that takes a list of token IDs, maps each ID back to its token using the inverse vocabulary, and joins them into a string, ensuring special tokens are handled appropriately.

5. Test and validate

Run a few examples to verify that encoding then decoding returns the original text (or a close approximation), and check edge cases like empty strings, unknown words, and special tokens.

Key Points to Mention

  • Choice of tokenization granularity (word-level vs. subword) and its trade-offs (vocabulary size, OOV handling).
  • Handling of out-of-vocabulary (OOV) words with an <unk> token.
  • Inclusion of special tokens (e.g., <pad>, <bos>, <eos>) and their role in training.
  • Efficiency considerations: using dictionaries for O(1) lookup, and potential for batch processing.
  • Round-trip consistency: ensuring encode-decode returns the original text when possible.
  • Integration with the existing LLM training framework: how tokenizer outputs feed into model inputs.

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

Q2

Write an optimizer and a loss function for the training loop, then verify the loss decreases over iterations.

Technical Trade-offsSystem Design
Author's notes

This part felt more manageable.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem setup (e.g., model architecture, dataset, task) and then implement a standard optimizer (e.g., Adam) and loss function (e.g., cross-entropy) appropriate for the task. Write a minimal training loop that logs loss per iteration and verify that the loss decreases over time, discussing potential issues like learning rate tuning or overfitting.

Pro tip: Mention that you would also monitor validation loss and use learning rate scheduling to ensure robust convergence, showing awareness of practical training dynamics beyond just the training loss.

1. Clarify the problem and assumptions

Ask about the model, data, and task to choose an appropriate optimizer and loss function. For example, for classification, use cross-entropy loss and Adam optimizer.

2. Implement the loss function and optimizer

Write code to instantiate the loss criterion and optimizer, ensuring they are compatible with the model parameters. For instance, use nn.CrossEntropyLoss and torch.optim.Adam.

3. Write the training loop

Create a loop that iterates over the dataset, performs forward pass, computes loss, backpropagates, and updates weights. Log the loss at each iteration or epoch.

4. Verify loss decreases

Run the loop and observe the loss trend. If loss doesn't decrease, check learning rate, data preprocessing, or model initialization. Plot loss over iterations for clarity.

5. Discuss trade-offs and improvements

Talk about optimizer choices (SGD vs Adam), loss function alternatives, and techniques like learning rate scheduling or regularization to improve convergence.

Key Points to Mention

  • Choice of optimizer (e.g., Adam, SGD) and its hyperparameters (learning rate, momentum)
  • Choice of loss function (e.g., cross-entropy, MSE) based on task type
  • Training loop structure: forward pass, loss computation, backward pass, optimizer step
  • Monitoring loss over iterations and using visualization (e.g., matplotlib) to confirm decrease
  • Potential issues: exploding/vanishing gradients, learning rate too high/low, overfitting
  • Best practices: validation split, early stopping, learning rate scheduling

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