Download README.md from thelamapi/Next-Drive: direct link, hf CLI and curl.
- Browser
- Download file 4.4 kB
-
https://huggingface.co/thelamapi/Next-Drive/resolve/main/README.md
- Command line
-
hf download hf://thelamapi/Next-Drive/README.md
-
curl -L -o README.md https://huggingface.co/thelamapi/Next-Drive/resolve/main/README.md
license: apache-2.0
library_name: pytorch
tags:
- autonomous-driving
- imitation-learning
- simulation
- dagger
- next-lab
Next Drive
Next Drive is a small learned driver for a simulated city intersection. Every 0.1 s it chooses one of six longitudinal actions (brake hard, brake, ease off, hold speed, speed up, accelerate) while following a straight, left or right route through a traffic light, a crosswalk, a lead car that brakes suddenly, oncoming and cross traffic, and parked cars that hide a pedestrian.
Simulation and education only. It is not connected to, and has never been tested on, a real vehicle, and nothing here supports a claim about real-road safety.
Space: https://huggingface.co/spaces/thelamapi/Next-Drive — pick a scene, density and driver; the drive is generated in your browser and can be replayed with its critical events.
Results on unseen test scenes (450 per driver; seeds ≥ 10000; density 3 never seen in training)
| Driver | Collisions | Red-light violations | Goal reached | Hard brakes / drive | Time to goal (s) | Decision ms (mean / p95) |
|---|---|---|---|---|---|---|
| Learned + safety check | 4.4% | 0.4% | 89.1% | 1.67 | 21.0 | 0.34 / 0.47 |
| Learned | 4.4% | 10.0% | 89.8% | 0.95 | 19.3 | 0.28 / 0.40 |
| Rule-based | 27.1% | 0.0% | 71.1% | 0.95 | 23.3 | 0.02 / 0.07 |
| Expert (teacher) | 2.7% | 1.3% | 93.6% | 1.01 | 19.2 | 1.61 / 2.38 |
Collision / goal-reached rate by scene type:
| Scene | Learned + safety | Learned | Rule-based | Expert |
|---|---|---|---|---|
| light | 4% / 96% | 2% / 98% | 1% / 99% | 1% / 99% |
| crosswalk | 7% / 93% | 1% / 99% | 9% / 86% | 0% / 100% |
| lead_brake | 8% / 92% | 1% / 99% | 3% / 97% | 2% / 98% |
| occlusion | 2% / 79% | 10% / 73% | 68% / 32% | 7% / 82% |
| mixed | 1% / 86% | 8% / 80% | 54% / 42% | 3% / 89% |
Collision rate by traffic density:
| Density | Learned + safety | Learned | Rule-based | Expert |
|---|---|---|---|---|
| 1 | 1% | 2% | 23% | 0% |
| 2 | 5% | 3% | 23% | 3% |
| 3 (unseen) | 7% | 8% | 35% | 5% |
Rates count drives with at least one event. Decision latency was measured in Python on NVIDIA L4, single process; the
Space reports its own browser timing. All 138 failures of the learned drivers are listed in evaluation.json
and can be replayed in the Space.
Replay video: one unselected test scene, then failure replays.
How it works
- Simulator: 1-lane roads, NS/EW signals with yellow and all-red, IDM-like traffic, pedestrians, and line-of-sight occlusion by parked cars. The ego car perceives cars always and pedestrians only when visible within 60 m.
- Expert: evaluates 6×6 two-phase action sequences (1 s + 2 s) at 0.25 s resolution with constant-velocity predictions, the known light schedule, a 2 m + 1.2 s following gap, and a speed cap that allows stopping before occluded gaps.
- Learned driver: MLP 21→64→64→6 on hand-made features (speed, light state, stop-line distance, lead gap, time-to-collision under three accelerations, visible-pedestrian and occlusion distances, route). Behaviour cloning on 300 expert drives (59750 states), then 3 DAgger round(s); iteration 2 was selected on validation seeds.
- Safety check: keeps an action only if braking at −6 m/s² after 0.5 s still avoids every predicted collision and red-light entry; otherwise picks the strongest safe deceleration.
- Rule-based baseline: IDM car following plus stop-line, visible-pedestrian and left-turn-yield rules.
- The browser runs a line-by-line JavaScript port; Node parity: 8 full drives, 0 mismatches.
Usage
python inference.py --seed 10007 --kind mixed --density 2 --driver shield
python inference.py --selftest
policy.safetensors holds the PyTorch weights; model.json the same weights for NumPy and the browser.
Limitations
- Speed-only control on fixed routes; no lane changes, no steering errors, no sensor noise beyond occlusion.
- Other road users follow simple scripted behaviour and never react to the ego car.
- The expert is imperfect too (see the table); the learned driver copies its habits, including frequent hard braking at yellow lights.
- All numbers come from this simulator and say nothing about real driving.

