Road sensors only see the cars driving over them. A small neural network with one physics rule built in fills in the gaps. Drop cars on the loop below and watch it train live in your browser.
The white markers are sensors. The three rings outside the road are three guesses at the traffic everywhere else. Compare them to the real cars.
Drag the car chip onto the road to drop a bunch of cars, or use a preset. Enough cars and a jam appears by itself.
Pick stalled car, then click on the road, ideally halfway between two sensors where nothing can see it.
Drag the white markers. Fewer sensors, bigger blind spots. The slider goes down to two.
Sensors alone, a naive "connect the dots" guess, and the model. The readout grades all three against the real cars every five seconds.
Everything in the box above is computed live. The model is a Fourier-feature MLP (48 features, two hidden layers of 32) trained with Adam on the last eight minutes of sensor readings, plus a finite-difference residual of the Lighthill-Whitham-Richards conservation law at 250 random points in space and time, in a Web Worker. Training speed depends on your machine; the readout shows it.
Each strip below is a map of the loop over time: left to right is distance around the loop, top to bottom is the last eight minutes, bottom row is now. A jam that passes one sensor has to reach the next one later, so on this kind of map every jam is a stripe that leans to the left. The sensors see thin columns of that stripe. The physics is what connects the columns.
Counted from every car. The model never sees this; it is only used to grade the answers.
Only the thin columns under each sensor are known. Everything else is a blind spot.
Blend the nearest two sensors. A jam sitting between them is invisible until it reaches one.
Same sensor data, but trained to obey "cars don't vanish". It carries the stripe across the blind spots.
How it works, in one paragraph: the network takes a position on the loop and a moment in time and outputs one number, how packed the road is there. It is trained to match the sensor readings, and at thousands of random places and times where there is no sensor it is penalised if the number of cars in a stretch of road changes by more than the cars driving in or out of it. Together with a measured relationship between how packed a road is and how fast it moves (the fundamental diagram, calibrated on real Bay Area freeways in section 03), that law fixes how fast a jam crawls backwards, so the network can place jams where no sensor is looking.
The loop above is a simulation. The same model was then trained 187 times on two real datasets: NGSIM, 8.4 million recorded vehicle positions on US-101 and I-80, where the true density of every 100 ft of road every 10 seconds is known exactly, and Caltrans PeMS, every day of 2026 for 43 sensors on I-880 South between Hayward and Fremont, pulled from the Clearinghouse. In each test the model sees a few sensors (or a few percent of cars sharing their GPS) and is graded on the ones it never saw.
| setting | interpolate | neural net, no physics | same net + physics |
|---|---|---|---|
| NGSIM · 3 fixed detectors | 29.1% | 54.6% | 27.2% |
| NGSIM · 2% of cars as GPS probes | 38.7% | 54.3% | 34.8% |
| NGSIM · 10% of cars as GPS probes | 35.9% | 41.3% | 30.4% |
| I-880 · 3 fixed detectors | 48.2% | 150.9% | 48.7% |
| I-880 · 12 fixed detectors | 37.2% | 62.2% | 34.9% |
Relative error of the reconstructed density on held-out sensors, mean over days and seeds, lower is better. Green is the best of the three. Physics beat the plain network in 41 of 41 configurations. It beat interpolation in all 12 probe-vehicle tests and 6 of 9 fixed-sensor tests on NGSIM, and only tied it on I-880. Every number comes from the run logs; the full per-day tables are in the explorer.
The cars follow the Intelligent Driver Model with simple lane changes. Real drivers are messier, and a real corridor has on-ramps that add and remove cars, which is exactly the term that broke conservation on I-880. The live demo shows the mechanism, not a deployment.
Where density comes from counting real cars (NGSIM) the physics wins. Where it comes from station averages every five minutes, the storage term is buried under flow-measurement noise and ramp inflows, and the physics acts as a regulariser, not a constraint. That is a property of the data, and it is in the tables.
The most recent readings have had the fewest training steps. The strips in section 02 show the estimate a few seconds behind the leading edge is better than the estimate at it. Slower machines widen that gap; the training-rate readout tells you how much.
Asked to learn free-flow speed, wave speed and jam density from sparse sensors, the model recovered only the jam density. US-101 is congested for the whole recording, so free-flow speed is simply not in the data.