Vanishing Gradients in a Recurrent Model Over Long GPS Traces

Last updated: November 29, 2026

Quick Overview

You train a vanilla RNN on sequences of 500 GPS pings to classify whether a trip took a detour, and it cannot learn from early parts of the trip. Explain why, and what architectural changes help.

Uber
Machine Learning
Machine Learning Engineer
Uber
November 29, 2026
Machine Learning Engineer
Onsite
Machine Learning
Medium

0

0

0 solved


You train a vanilla RNN on sequences of 500 GPS pings to classify whether a trip took a detour, and it cannot learn from early parts of the trip. Explain why, and what architectural changes help.

Uber uses GPS trajectories for map matching, route deviation and safety features, and long sequences make gradient flow a real concern. The interviewer checks that you can derive the cause and choose between LSTMs, attention and downsampling.

What the Interviewer Expects
  • Derive why gradients shrink through repeated Jacobian products
  • Distinguish vanishing from exploding gradients and their fixes
  • Explain how LSTM or GRU gating helps
  • Consider transformers or convolutional models and their costs
  • Suggest reducing sequence length with feature engineering
Key Topics to Cover
vanishing gradients
LSTM
attention
gradient clipping
sequence modeling
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • Why does gradient clipping fix exploding but not vanishing gradients?
  • How would positional information be encoded for irregular timestamps?
  • Would you even need a sequence model here?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Check the setup: 500 steps, tanh RNN, label at the end. Detours often happen early (driver takes a long way from pickup), so the model needs to credit early inputs....

Approach

In an RNN, ht=tanh⁡(Wht−1+Uxt)h_t = \tanh(W h_{t-1} + U x_t). The gradient of the loss at step TT with respect to hkh_k is

$\dfrac{\partial L}{\partial h_k} = \dfrac{\partial L}{\partial h_T} \prod_{t=k+1}^{T} \text...


Submit Your Answer
Markdown supported