← Questions

Modeling other agents in a driving simulator

0
TeslaAI/ML designLast asked Feb 2026

An AI/ML design interview question asked in Tesla's technical phone screen, last asked Feb 2026. It tests simulation, behavior prediction and autonomous driving.

You are building a driving simulator to train and evaluate an autonomous-driving planner or RL agent. Besides the ego vehicle, the simulator must contain other road users: cars, pedestrians and cyclists. Design how those agents behave so that what the ego learns and how it is scored carry over to real roads.

Requirements

  • Functional: populate scenarios with other agents; let them react to the ego where it matters; reproduce real scenarios and generate new ones, including rare and dangerous ones.
  • Non-functional: realistic enough that results transfer; controllable and repeatable for regression tests; fast enough to run at training scale; safe, meaning simulated agents should not teach the ego wrong habits.

Clarifying questions

  • Is the simulator used for training (RL, closed loop) or for evaluation and regression tests, or both?
  • What logged driving data exists, and is it labeled with tracks and maps?
  • How much compute per simulated hour is available?
  • Which failures matter most: collisions, near misses, comfort, rule violations?

What a strong answer covers

  • The main approaches and their trade-offs in realism, control, safety and distribution shift:
    • Log replay: real behavior, but agents do not react to the ego, so they break once the ego deviates from the logged path.
    • Rule-based agents (car-following models such as IDM, lane-change rules): reactive and controllable, but too polite and too uniform.
    • Learned behavior models (imitation of logged behavior, multi-agent trajectory prediction, adversarial agents): realistic and reactive, but costly, harder to control and subject to their own distribution shift.
  • A hybrid: replay until the ego's path diverges, then hand off to reactive models; tunable aggressiveness; adversarial agents to find failures.
  • How agents react to the ego (closed loop) and why an open-loop simulator overstates the ego's safety.
  • Validation: compare the distributions of speeds, gaps, accelerations and interaction events with real logs; check collision and near-miss rates in held-out scenarios; check that the ranking of ego policies in simulation matches their ranking on the road.
  • Scenario generation for rare events and keeping it reproducible (seeds, versioned models).

Follow-ups

  • The ego learned to exploit the rule-based agents' politeness. How would you detect and fix it?
  • How do you keep a learned agent model from colliding in ways real drivers would not?
  • How would you model pedestrians differently from cars?
  • How do you decide the simulator is "good enough" to replace some road testing?

Where it's asked

  • Tesla · Technical phone screen · Last asked Feb 202645 min · 10 to 20 minutes on your background, then one compact coding, debugging or design task in CoderPad that must run

What it tests

simulation · behavior prediction · autonomous driving

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing