Self-driving cars explained: a conventional self-driving system is a stack. Perception builds a model of the road and traffic, prediction and planning work out a path, and control turns that path into actuator actions. In perception, deep networks analyse camera, LiDAR and radar data to detect and identify vehicles, pedestrians and road signs. This article dwells on three pressures on the design: rare road situations, how hard it is to prove safety, and the time budget on the vehicle’s own hardware.
The “feed it enough driving footage and it learns” picture is appealing, but it does not help you work out why one system copes with a snowy on-ramp and another brakes for a plastic bag. The rest of this article replaces that picture with the stack itself. This article is one part of our wider look at AI in autonomous machines.
The Operating Domain Sets What the Stack Must Handle
Every automated driving system is designed to drive within a set of operating conditions, known as its operational design domain (ODD). Together with the driving task it has to perform, the ODD determines the SAE automation level. A single car can have different levels in different conditions. Wikipedia’s example is Level 3 lane management up to 100 km/h and Level 2 above that speed, or Level 4 on designated highways and Level 2 on urban side roads. At Level 3 and above, the system has to recognise when it is leaving its ODD (a clear highway turning into a construction zone with a worker giving hand signals, say) and fall back, which can include asking the driver to take over.
Waymo’s 2020 safety methodology paper says that, below Level 5, safety analysis and measurement have to address the specific ODD of the system. Systems should therefore operate within the ODD’s limitations, not everywhere. They have to be reliable across a stated set of conditions and notice when the car has left them.
Modular Stack or End-to-End Model: The Trade-Offs for Debugging and Safety
A modular stack builds each function separately and passes explicit outputs, such as bounding boxes and trajectories, from one component to the next. An end-to-end system is a single differentiable program that takes raw sensor data in and produces a plan or control commands, trained jointly by back-propagating a driving loss. NVIDIA’s 2016 paper by Bojarski et al. is the classic end-to-end example: a convolutional network that maps raw pixels from one front-facing camera straight to steering commands, running at 30 frames per second. The authors argued that optimising every step together would eventually give better performance and smaller systems than optimising criteria humans had chosen, such as lane detection.
Each approach has a cost. The 2023 survey by Chen et al. on end-to-end driving says the classical pipeline is good for interpretability and ease of debugging. Because detection is tuned for mean average precision while planning is tuned for safety and comfort, though, errors can compound along the sequence and information gets lost. The UniAD authors make the same criticism of standalone task models (accumulated errors and poor coordination between tasks) and propose a single network in which perception and prediction tasks are prioritised so that all of them contribute to planning. In the other direction, a 2023 systematic review notes that when an end-to-end system misbehaves, it is extremely hard to find a targeted software fix, and teams are left feeding it more data.
The split is also less binary than it sounds. “End-to-end” does not have to mean a single black box: several leading systems keep a modular design with intermediate outputs and optimise all the components together.
| Modular stack | End-to-end model | |
|---|---|---|
| What flows between stages | Explicit outputs: boxes, tracks, trajectories | Learned feature representations |
| Optimisation target | Each module’s own metric (e.g. mAP for detection) | The final planning or control objective |
| Main weakness | Errors compound across modules | Hard to localise a fault; teams fall back on feeding in more data |
| Safety constraints | Already built into planning and speed modules | Learning-based, no precise mathematical safety guarantees |
| Debugging | Interpretable, component by component | Black-box interpretability is harder and more critical |
The surveys’ interpretability findings favour a modular, observable stack. When a car does something wrong, the first question is which component failed and why, and a stack with inspectable intermediate outputs can answer that question in a way a monolith cannot. The hybrid designs above, which train end to end but keep readable intermediate outputs, are a reasonable middle ground for exactly this reason.
What Does Machine Learning Do in the Perception Layer of a Self-Driving Car?
In perception, machine learning turns raw sensor streams into a structured description of the scene. That covers vehicle and pedestrian detection, pixel-level segmentation, traffic-light and road-sign detection, and the sensor fusion that combines camera, LiDAR and radar. A 2023 survey of computer vision in autonomous vehicles lists four applications in current systems: depth estimation, object detection, lane detection and traffic sign recognition, mostly built on convolutional networks. The perception output is then sent to every other component of the self-driving unit.
Each task has its own trade-offs. Object detectors are either two-stage (propose regions, then classify them) or single-stage (predict classes and boxes directly in one network). Lane detection lets the car position itself within its lane, and camera-based methods keep up with high frame rates but lose considerable accuracy at night because RGB cameras are sensitive to lighting. Traffic sign benchmarks can mislead: in GTSRB the sign fills most of the image.
Perception also has a time dimension. Tracking keeps a memory of each object’s past movement, so the stack still expects an occluded pedestrian to be there and has the history that prediction needs. The training regimes behind these models (supervised, imitation and reinforcement learning) are covered in our piece on machine learning in self-driving cars. The detection mechanics are covered in more depth in how perception detection works in autonomous cars.
How Is Sensor Fusion Used to Combine Camera, LiDAR and Radar Data for Autonomous Driving?
Sensor fusion combines several sensors so that they offset each other’s limitations. Several sensors give a fuller view than one and can cross-check each other to correct errors. An edge-case survey sums up the roles. Cameras give rich semantics but struggle with poor lighting, glare and occlusion. LiDAR gives precise 3D geometry whatever the lighting but degrades on reflective surfaces and becomes sparse at long range. Radar measures range and velocity reliably in bad weather but has lower angular resolution and ghost returns.
| Sensor | Typical range (per a CV-in-AV survey) | Strength | Weakness |
|---|---|---|---|
| Camera | Several centimetres to 100 m | Semantic detail: classes, signs, lane paint | Light and weather; 20-60 MB/s per high-resolution camera |
| LiDAR | Up to 200 m | Accurate distance, 3D structure, independent of lighting | Sparse points, weak on small targets; 10-70 MB/s |
| Radar | 70 m at 24 GHz, 200 m at 77 GHz | Distance, angle and relative speed; robust in dust, rain, smoke | Lower angular resolution, ghost returns |
The NTSB’s Tempe crash report describes how one real system fused its sensors. Uber’s developmental ADS detected objects mainly with LiDAR, radar and cameras, then tracked them, estimated heading and velocity, and classified them by fusing the three sensor systems under a schema that gave some sensors priority over others. Asking whether LiDAR is “better” than cameras misses that the sensors offset each other’s limitations. Each wins in different conditions, and that is the reason fusion exists.
The Long Tail Is Where Self-Driving Perception Fails
Edge cases are rare or novel situations that still happen often enough across a deployed fleet to need specific design attention. Examples include extreme weather, unexpected object behaviour and unknown objects. Training data is dominated by routine driving, so systems end up optimised for routine conditions, and the cases near the limits of performance are under-represented even though they matter most. Chen et al. describe the imbalance plainly: most driving is repetitive lane following, while safety-critical scenarios are rare, varied and unsafe to stage on real roads. Waymo distinguishes edge cases (one operating parameter at an extreme) from corner cases (more than one parameter outside normal conditions).
Two ways a model goes wrong in the long tail are out-of-distribution inputs and domain shift. Out-of-distribution inputs, such as unusual road signs, markings or rare objects the model never saw or never learned, cause misclassification. Domain shift is subtler. When input conditions drift away from the training distribution, operational performance falls below what the test set promised. The domain shifts Chen et al. list for driving are sim-to-real, one geography to another, weather, day to night and sensor to sensor. Sun glare is a concrete case: reflections off a wet road can overexpose exactly the part of the image where the lane markings are, and missing those markings can affect steering decisions.
Rare cases can also be rare within a class. A 3D detection study reports that even the best detectors make naive mistakes on rare examples such as vehicles with irregular shapes. Mining rare object tracks by estimating density in feature space improved performance on rare objects by 30.97%. Their finding that rareness, not difficulty, is what data-centric fixes address is useful in practice. Rareness comes from a lack of data support, whereas difficulty comes from ambiguity in the problem itself. Building that data support is the subject of our guide to a car parts dataset and annotation for automotive perception.
The Tempe crash shows a classification failure carrying through to path prediction. The ADS detected the pedestrian 5.6 seconds before impact but never classified her correctly as a pedestrian or predicted her path. Her classification switched several times between vehicle, bicycle and other. Each time it changed, tracking history was unavailable and the system predicted the object’s path as static. The system design did not consider pedestrians crossing away from a crosswalk. The ADS data recorded the detection time, each classification and the predicted paths assigned to the pedestrian.
We go into why off-the-shelf computer vision models fail in production. Unresolved edge cases show up as false positives, which cause unnecessary interventions, or as false negatives, which cause abrupt reactions and safety-critical failures.
How Are Machine Learning Perception Models for Self-Driving Cars Tested and Validated Before Release?
Waymo holds that no single safety methodology is sufficiently holistic, so its validation combines several. Validation of perception models often relies on accuracy on large test sets, but that is clearly insufficient for safety-critical use because real-world inputs can differ from the test set. Open-loop evaluation compares a system’s predicted trajectory with recorded human driving. It is easy to run on real data, but it does not measure performance once the vehicle drifts away from the logged path, and it penalises valid alternatives that do not appear in the log. Closed-loop evaluation runs the system in a simulator such as CARLA or nuPlan and scores collisions, rule violations and comfort. Simulators still do not generalise fully to real scenes.
Waymo’s programme therefore layers its methods. Waymo describes three system-level test types (simulation, closed-course and public road) supported by unit, integration, bench and hardware-in-the-loop tests. In its view, neither simulation alone nor real driving alone gives enough information for a confident readiness decision. Koopman and Wagner report that robustness testing by fault injection, which feeds corrupted LiDAR data or malformed messages into interfaces, commonly finds defects that extensive field testing missed. Component-level detection scores should also be linked to downstream vehicle behaviour, for example through closed-loop simulation, rather than treated as a stand-in for safety. After a change to one component, an ideal framework re-runs a well-chosen subset of tests instead of the whole programme. The full model-building and release workflow is covered in how autonomous car perception models are built and validated.
What Are the Main Validation and Safety Challenges for Machine Learning in Autonomous Vehicles?
The first challenge is statistical. RAND’s 2016 report estimated that autonomous vehicles would need hundreds of millions, and in some cases hundreds of billions, of miles of driving to demonstrate reliability for fatalities and injuries. That would take existing fleets tens or hundreds of years, so test driving alone cannot provide the evidence. Koopman’s argument, as summarised in a 2020 validation survey, reaches the same point in hours: a hypothetical fleet of one million vehicles driving one hour a day logs a million hours daily, so one catastrophic failure every 1,000 days means a billion hours between failures, and several billion hours of testing to confirm it.
The second challenge is specification. Machine learning models learn their classes from data, not from a formal specification, so what the designer intended and what the model actually learned can differ. Koopman and Wagner argue that the training data forms the de facto requirements, and ask how anyone knows it is complete. ISO 26262 covers hazards from malfunctions, but it cannot account for a component that simply fails to understand its environment. ISO 21448 (SOTIF) addresses hazards caused by functional insufficiencies, including performance insufficiencies in systems whose situational awareness comes from complex sensors and algorithms. Waymo notes that SOTIF was designed with Levels 1 and 2 in mind and is not sufficient by itself for a Level 4 system.
The third challenge is that validation does not stop at release. Field monitoring should detect outdated models, for example through out-of-distribution detection on the vehicle, and should feed a change-management plan, since ML-based functions will very likely be updated throughout the product’s life. The scenario space is effectively infinite, so a framework has to pick the most critical scenarios and quantify the risk left in the ones it did not test. How these safety demands shape perception engineering is discussed further in ML perception and automotive safety demands.
How Do Latency and On-Vehicle Compute Limits Affect Which Machine Learning Models a Self-Driving Car Can Run?
Latency and compute limits decide which models fit on the vehicle. A model that is accurate offline but cannot deliver within the control loop’s time budget is not a usable perception model. A CV-in-AV survey states that autonomous systems need to respond within 0.1 s to match the best human drivers. The high-performance GPUs that make this possible draw a lot of power (it gives 300 W for NVIDIA Drive AGX), which cuts driving range. Offline benchmarks also hide a further problem: by the time a model finishes a frame, the world has moved on. That is why Li, Wang and Ramanan proposed “streaming accuracy”, which scores the whole stack’s output at every moment and so combines latency and accuracy in one number.
Worked Example: A Camera-Based 3D Detector Against a 100 Ms Budget
A study of BEVFormer, a transformer-based detector that builds a bird’s-eye view from several cameras, makes the budget concrete.
- Baseline. The unoptimised model averaged 673 ms per inference, far above the 100 ms limit the authors describe as widely adopted for real-time perception. It reached an NDS of 0.52 while using over 65% of the onboard hardware.
- Compiler and quantisation. With TensorRT, inference fell from 486 ms at FP32 to 194 ms at FP8, and NDS only dropped from 0.52 to 0.51.
- Still too slow. FP8 gave an end-to-end delay of 198.9 ms, which works out to about 5 Hz against the roughly 10 Hz expected of a 100 ms system.
- Changing the architecture. Splitting the network after layer 3 at FP16 reached an end-to-end delay of 88.7 ms with an NDS of 0.47, within the 100 ms bound.
The study’s conclusion is that quantisation alone could not make up for too much local computation. Split depth had the dominant influence on onboard latency. Offloading brings its own risk, since bandwidth over wireless links varies and a static configuration can break the latency bound. Safety machinery uses the same budget: MC-dropout uncertainty estimation for a PilotNet-style model needed 128 stochastic forward passes, which is too expensive for run-time failure prediction. The edge-case survey notes that such factors often favour simpler, interpretable approaches over technically superior but harder-to-certify ones.
TechnoLynx’s GPU Performance Engineering uses profiling and compilers to make workloads faster on the target hardware, as part of AI engineering for manufacturing.
Which Failures Can You Trace?
An average score says little about how a self-driving stack behaves when it fails. When a pedestrian is misclassified, a lane is lost in glare or a frame arrives 90 ms late, can the team point to the component, the input condition and the fix, and re-test only what changed? Modular stacks make that question answerable, component by component. Pure end-to-end systems make it harder, and in exchange they offer joint optimisation that may yet prove its worth on the road. Which way that trade-off settles at scale is still open, and the sources do not settle it.