AnyLearn
All lessons
Roboticsintermediate

Modular Stacks vs End-to-End Driving

Two ways to build a self-driving system: a pipeline of separately engineered modules, or one network trained from sensors to trajectory. Covers imitation learning, causal confusion, why open-loop scores mislead, joint designs like UniAD, foundation-model drivers, and what each approach costs when you must prove it safe.

Updated · AI-authored, review-gated · how lessons are made

Progress1 / 11

Two ways to build a driver

The earlier lessons in this cursus described a modular stack: perception produces boxes and tracks, prediction produces weighted futures, planning produces a trajectory, control produces commands. Each arrow is a hand-designed interface, and each module can be built, tested and replaced on its own.

An end-to-end system replaces some or all of those interfaces with learned ones. In the purest form, one network maps raw sensor data directly to a trajectory or to steering and speed, and every internal representation is whatever training finds useful.

In practice this is a spectrum, not a binary:

  1. Classical modular: learned perception, hand-written prediction and planning rules.
  2. Learned modules: each stage is a neural network, trained separately against its own labels.
  3. Jointly trained modular: the stages remain visible but are trained together so gradients from the planning loss reach perception.
  4. Monolithic: sensors in, trajectory out, with no required intermediate outputs.

Key idea: the real question is not "neural or not" but where the interfaces are fixed by engineers and where they are learned, because that choice decides what can be inspected, tested and argued safe.

Sign in free to save your progress and earn certificates.

Full lesson text

All 11 steps on one page, for reading, reference, and search.

Show

1. Two ways to build a driver

The earlier lessons in this cursus described a modular stack: perception produces boxes and tracks, prediction produces weighted futures, planning produces a trajectory, control produces commands. Each arrow is a hand-designed interface, and each module can be built, tested and replaced on its own.

An end-to-end system replaces some or all of those interfaces with learned ones. In the purest form, one network maps raw sensor data directly to a trajectory or to steering and speed, and every internal representation is whatever training finds useful.

In practice this is a spectrum, not a binary:

  1. Classical modular: learned perception, hand-written prediction and planning rules.
  2. Learned modules: each stage is a neural network, trained separately against its own labels.
  3. Jointly trained modular: the stages remain visible but are trained together so gradients from the planning loss reach perception.
  4. Monolithic: sensors in, trajectory out, with no required intermediate outputs.

Key idea: the real question is not "neural or not" but where the interfaces are fixed by engineers and where they are learned, because that choice decides what can be inspected, tested and argued safe.

2. What fixed interfaces cost

Modular stacks dominate deployed systems for good reasons: each module has its own metrics, failures can be traced to a stage, and engineers can add a rule the day a problem is found. The interfaces also have real costs:

  • Information bottleneck. A box with a class label cannot say "a mattress flapping on a truck roof, likely to fall". Whatever the interface cannot express, downstream stages never see.
  • Mismatched objectives. Perception is trained to maximise detection accuracy across all objects, but planning cares about a few objects that affect the next manoeuvre. Effort is spent in the wrong places.
  • Compounding errors. A slightly wrong heading from tracking becomes a wrong predicted path, which becomes a needless brake.
  • Rule sprawl. The long tail of situations is handled by hand-written planner logic that grows with every edge case and interacts in ways nobody fully tests.

End-to-end training attacks all four by letting the planning objective shape every representation. What it gives up is the very thing that made modules convenient: intermediate outputs with a meaning a human can check.

3. A short history of learned driving

The end-to-end idea is older than the modular stacks it now challenges. Each milestone below is a research system, cited by its paper: ALVINN (Pomerleau, 1989), PilotNet (Bojarski et al., NVIDIA, 2016, trained on about 72 hours of driving), ChauffeurNet (Bansal, Krizhevsky and Ogale, 2018), causal confusion (de Haan, Jayaraman and Levine, NeurIPS 2019), UniAD (Hu et al., a CVPR 2023 best paper) and EMMA (Waymo, 2024).

timeline
  title Milestones in learned driving
  1989 : ALVINN maps a 30 by 32 pixel image to steering with one small network
  2016 : PilotNet learns steering directly from camera pixels
  2018 : ChauffeurNet imitates logged driving plus synthesized perturbations
  2019 : Causal confusion identified as a failure mode of imitation
  2023 : UniAD trains perception, prediction and planning jointly
  2024 : EMMA casts driving tasks as outputs of a multimodal language model

4. Learning to drive by imitation

Most end-to-end drivers start with behaviour cloning: collect logs of human driving, then train a policy πθ\pi_\theta to reproduce the expert's action a∗a^{*} from the observation oo:

θ∗=arg⁡min⁡θ  E(o, a∗)∼D[ ∥πθ(o)−a∗∥2 ]\theta^{*} = \arg\min_{\theta} \; \mathbb{E}_{(o,\,a^{*}) \sim \mathcal{D}} \big[\, \lVert \pi_\theta(o) - a^{*} \rVert^{2} \,\big]

The known weakness, covered in the lesson From Control to Imitation Learning, is distribution shift: human logs rarely contain the car drifting toward a kerb, so the policy never learns to recover, and small errors compound into states the data never showed.

Driving research added its own remedies:

  • Synthesized perturbations. ChauffeurNet (Bansal et al., 2018) displaced the logged ego position and trained the model to steer back, alongside auxiliary losses that penalise collisions and leaving the road rather than only copying the expert.
  • Multiple future waypoints. Predicting a short trajectory rather than one steering angle gives the loss more structure and smoother behaviour.
  • Closed-loop fine-tuning. Training continues in simulation, where the policy sees the consequences of its own mistakes, often with reinforcement learning on top of the cloned starting point.

5. Causal confusion

Imitation learns correlations, and driving logs are full of correlations that are not causes. De Haan, Jayaraman and Levine (NeurIPS 2019) gave the canonical example. Suppose the camera can see the car's own brake indicator on the dashboard. Two policies fit the training data equally well: one brakes because it sees a pedestrian, the other brakes because it sees the brake light already on, since in the logs the light comes on whenever the expert brakes. On the road the second policy fails, because the light is an effect of braking, not its cause. Their striking result is that giving the imitator more information can make it generalise worse under distribution shift.

Gotcha: the most dangerous shortcut in end-to-end driving is the car's own motion. Current speed, acceleration and yaw rate predict the next few seconds of the expert's path very well on ordinary roads, so a network can score highly while barely using its cameras. It then has nothing to fall back on in the rare scene where the right action is to deviate from momentum, which is exactly the scene that matters.

6. When the benchmark rewards the shortcut

That shortcut is not hypothetical. It showed up in the most widely used open-loop planning benchmark.

Predict first

An end-to-end planner is evaluated open loop on nuScenes: its predicted trajectory is compared with the logged human one. If you blank all of its camera input but still give it the car's own speed and heading, how much does its planning score drop?

The same pattern appeared in the previous lesson's nuPlan result, from the other direction: planners that imitate logs well in open loop can still drive worse in closed loop. Both point at one conclusion. A driving model is only as well understood as the evaluation that tested it, and matching a recorded human trajectory is a weak test.

7. Open loop, closed loop, and in between

Evaluation methods differ in one crucial respect: whether the model's own actions change what it sees next.

ModeHow it worksCatches compounding errors?Main limitation
Open loopCompare predicted trajectory with the logged one, frame by frameNoRewards imitation and momentum shortcuts
Non-reactive closed loopThe ego car moves by its own plan; other agents replay their logsPartlyOther agents ignore the ego car, so interactions are unrealistic
Reactive closed loopOther agents are simulated and respond to the ego carYesSimulated agents and sensors differ from reality
On-road testingReal vehicle, real traffic, usually with a safety driver at firstYesSlow, expensive, rare events are rare

Simulators such as CARLA (Dosovitskiy et al., CoRL 2017) render synthetic sensor data so camera-based models can be run fully closed loop, while benchmarks such as nuPlan simulate at the level of object tracks. Neither removes the sim-to-real gap: a model that learned to exploit the quirks of simulated pedestrians or rendered textures can fail on real ones. Developers therefore combine all four modes, using cheap ones to filter candidates and expensive ones to confirm.

8. Jointly trained modules: UniAD

A middle path keeps the modules but trains them together. UniAD (Hu et al., "Planning-oriented Autonomous Driving", a CVPR 2023 best paper) is the reference design. One network, built on a bird's-eye-view feature grid, contains five task blocks in sequence:

  1. Tracking of agents across frames.
  2. Online mapping of lanes and drivable area.
  3. Motion forecasting for the tracked agents.
  4. Occupancy prediction of which grid cells will be filled in the future.
  5. Planning of the ego trajectory.

Blocks pass learned queries, compact feature vectors, rather than finished boxes, so the planner can use anything upstream blocks encoded, not just what a box format allows. The whole network is trained with all five losses at once, and the planning loss sends gradients back into perception.

The appeal is a compromise: intermediate outputs still exist and can be visualised, checked and supervised with labels, which helps both training and debugging, while the interfaces between them are no longer lossy hand-designed formats. The cost is that a change anywhere can shift behaviour everywhere, so a module can no longer be validated once and then frozen.

9. Driving with foundation models

The newest line of work builds the driver on a large pretrained multimodal model, the same family of models that answer questions about images. The hope is that knowledge absorbed from internet-scale data, what a school bus is, what a hand signal means, transfers to the long tail that driving logs cover thinly.

EMMA (Waymo, 2024) is a documented example. Built on Gemini, it takes camera images and a text prompt, and expresses its outputs, including planned trajectories and 3D object positions, as text. Its paper reports strong motion-planning results on nuScenes and competitive results on the Waymo Open Motion Dataset, and is explicit about the limits: the model uses cameras only and cannot fuse lidar or radar, which weakens 3D spatial reasoning; it is computationally expensive to run; and closed-loop evaluation would need realistic, costly sensor simulation. The same recipe applied to general robots is covered in the lesson Vision-Language-Action Models.

In practice: deployed systems mostly use such models as components rather than as the whole driver, for example to label rare scenes in logs, to generate training scenarios, or as one input to a planner that still sits behind independent safety checks.

10. Testing for the shortcut in code

A minimal behaviour-cloning policy in PyTorch, with a switch for ego-status input. Training both variants and comparing them closed loop is the ablation that exposes the momentum shortcut.

import torch
import torch.nn as nn

class Policy(nn.Module):
    def __init__(self, use_ego_status: bool):
        super().__init__()
        self.use_ego_status = use_ego_status
        self.vision = nn.Sequential(                    # BEV feature grid -> vector
            nn.Conv2d(64, 128, 3, stride=2), nn.ReLU(),
            nn.AdaptiveAvgPool2d(1), nn.Flatten())
        extra = 4 if use_ego_status else 0              # speed, accel, yaw rate, curvature
        self.head = nn.Linear(128 + extra, 6 * 2)       # 6 future (x, y) waypoints

    def forward(self, bev, ego):
        z = self.vision(bev)
        if self.use_ego_status:
            z = torch.cat([z, ego], dim=-1)
        return self.head(z).view(-1, 6, 2)

def train_step(policy, opt, bev, ego, expert_wp):
    loss = (policy(bev, ego) - expert_wp).norm(dim=-1).mean()  # mean L2 to logged path
    opt.zero_grad()
    loss.backward()
    opt.step()
    return loss.item()

Expect the ego-status variant to reach a lower training loss faster, because extrapolating speed and yaw rate already explains most waypoints. If it also wins closed loop, the extra input is genuinely useful; if it wins open loop but loses closed loop, it has learned momentum instead of driving.

11. Choosing an architecture

No design wins on every axis, which is why most production systems are hybrids.

DimensionModular, hand-designed interfacesJointly trained modulesMonolithic end-to-end
InspectabilityHigh: every interface has a meaningMedium: intermediate outputs existLow: internal states are learned features
Fault tracingPer modulePartly per blockMostly by behaviour testing
Long-tail handlingHand-written rules per caseLearned, with labelled checkpointsLearned from data scale
Data appetiteLabels per moduleLabels per block plus driving logsVery large volumes of driving logs
ValidationModule requirements plus system testsSystem tests, some module checksSystem-level and statistical evidence

A pattern common across developers is a learned planner wrapped by independent, simpler checks: a rule-based layer that verifies the proposed trajectory keeps safe distances and obeys hard constraints, and substitutes a fallback when it does not. That wrapper is attractive precisely because it can be reasoned about with the methods the final lesson covers, which ask not "is the network good?" but "what evidence shows the whole system is acceptably safe?"

Check your understanding

The lesson ends with a 5-question quiz. Take it in the player above to see your score.

  1. What distinguishes a jointly trained modular design such as UniAD from a classical modular stack?
    • It has no intermediate outputs at all
    • It uses hand-written rules for planning
    • Its stages pass learned queries and are trained together, so the planning loss reaches perception
    • It runs each module on a separate computer
  2. In the causal confusion example of de Haan et al., why does the policy that watches the dashboard brake light fail on the road?
    • The brake light is an effect of braking, not a cause, so it gives no warning of when braking is needed
    • The brake light is too dim for the camera at night
    • The policy was trained with too few examples
    • Dashboard lights are excluded from road-test sensor data by regulation
  3. Li et al. (CVPR 2024) found that an end-to-end planner with blanked cameras but access to ego status lost little open-loop score on nuScenes. What is the main lesson?
    • Cameras are unnecessary for self-driving
    • Open-loop imitation metrics on simple scenes can reward a momentum shortcut instead of real driving
    • Ego status should never be given to a planner
    • nuScenes contains mostly rare, difficult scenes
  4. Which evaluation mode lets the ego car's actions change what it sees, but has other agents replay their logged paths?
    • Open loop
    • On-road testing
    • Reactive closed loop
    • Non-reactive closed loop
  5. Why do many developers wrap a learned planner with an independent rule-based check?
    • Because the rule-based layer drives faster than the network
    • Because learned planners cannot output trajectories
    • Because the simpler layer can be reasoned about and verified, and can substitute a fallback when a proposed trajectory breaks hard constraints
    • Because regulations forbid neural networks in vehicles

Related lessons

AI
intermediate

Learned Simulators for Robots and Cars, and How World Models Fail

How world models train and test robots and driving systems, and where they break. Covers learning to walk in an hour with DayDreamer, driving world models, ranking robot policies in a video simulator, compounding error in code, model exploitation and its defences, hallucinated physics, and why evaluation is the hardest part.

10 steps·~15 min
Robotics
intermediate

How Self-Driving Safety Is Argued and Measured

What it takes to show a self-driving system is safe enough: SAE automation levels and operational design domains, why test miles alone cannot prove safety, how crash rates are compared with human benchmarks, why disengagement counts mislead, and how safety cases, crash reporting and remote assistance fit together.

10 steps·~15 min
Robotics
intermediate

Predicting Road Users, Planning, and Control

How a self-driving car turns tracked objects into motion: forecasting several possible futures for every road user, choosing a trajectory that is safe across them, and steering it with a controller. Covers scene representations, interaction, Frenet-frame planning, and why rule-based planners remain strong baselines.

10 steps·~15 min
Robotics
intermediate

How a Self-Driving Car Perceives the Road

The first stage of a driving stack: which sensors a self-driving car carries and why, how cameras, lidar and radar are calibrated, synchronised and fused into a bird's-eye view, and how detections become tracked objects on a map that prediction and planning can use.

10 steps·~15 min