Out of the box, general-purpose vision-language models recognize cars and intersections yet fail to judge whether a crash is seconds away: across 100 unseen real-world dashcam drives from the Nexar Collision Prediction benchmark (50 collisions or near-misses and 50 normal urban, highway, night, and rain drives; 2,099 causal 2.0 fps windows), zero-shot LiquidAI/d1-2B scores 0.490 episode AUROC (0.557 Nexar truncation mAP; 0.620 window AUROC) and catches just 2% of crashes at default p >= 0.50. Following up on Inside LFM3, I adapt d1-2B across two hardware regimes: a 4-bit Apple M4 proof-of-concept (96 clips, lifting window AP from 33.1% to 51.5% across the top 6 layers vs. 41.5% on 2 layers) and a full bfloat16 Stage 2 run (420 clips, 4.12M rank-4 parameters across all 24 gated-convolution, sliding-attention, and global-attention layers in 12.5 minutes on one RTX 4090, $0.19 compute). On the 100 unseen test drives, 24-layer LoRA lifts window AUROC to 0.772 (+0.152), more than doubles window AP from 14.0% to 33.4% (2.39x), and raises official Nexar 500/1000/1500 ms truncation mAP to 0.794 (+23.7 pp; 0.841 at −0.5 s), while toggling lora_enabled = False in 0.0 ms extracts unperturbed zero-token bounding boxes around the threatening vehicle up to 3.6 s early. Streaming 260 unlabeled drives through a reservoir-gated temporal hindsight loop (Time-Machine, 0 human labels) lifts window AP 2.12x to 28.8% (0.727 AUROC). Yet commuter math exposes an honest deployment boundary: across a 20-minute drive (60 segments), operating at 70% crash recall (p >= 0.50, 2.75 s lead time) triggers 26.4 false alarms per commute (6.0 at 10% test FAR; 10% conformal recall at 4% actual FAR), mapping the gap between frozen 2.0 fps 2D vision patches and 3D video encoders (BADAS-Open 0.86 AP; Kaggle #1 0.898 mAP).
Stage 2 crash anticipation scorecard across 100 unseen Nexar test drives
| Regime / Operating Point | Trainable Params | Window AUROC | Window AP | Nexar Clip mAP | Crash Recall | Episode FAR | Detected Lead |
|---|---|---|---|---|---|---|---|
Zero-shot base d1-2B (p >= 0.50) |
0 | 0.620 | 14.0% | 0.557 | 2% | 6% | n = 1 (0.09 s all) |
Zero-label Time-Machine (Ep 120, 0 labels) |
4,117,184 | 0.727 | 28.8% | n/a | 22% | 14% | 1.51 s |
| Zero-label Time-Machine (Ep 260 final) | 4,117,184 | 0.681 | 19.2% | n/a | 36% | 34% | 1.73 s |
24-layer LoRA (Conformal 4% test FAR) |
4,117,184 | 0.772 | 33.4% | 0.794 | 10% (18% oracle) | 4% | 0.35s |
24-layer LoRA (Val <= 5% FAR threshold) |
4,117,184 | 0.772 | 33.4% | 0.794 | 26% [14%, 38%] | 10% | 1.65 s |
24-layer LoRA (Val <= 10% FAR threshold) |
4,117,184 | 0.772 | 33.4% | 0.794 | 34% | 14% | 2.06 s |
24-layer LoRA (Balanced p >= 0.50) |
4,117,184 | 0.772 | 33.4% | 0.794 | 70% [58%, 82%] | 44% | 2.75 s (1.93 s all) |
Source: Source: results/stage2_4090_420clips/stage2_summary.json and results/analysis/benchmark_and_commute_analysis.json.
Unseen Nexar urban cut-off (#00288, 2.0 fps, 0 generated tokens): 24-layer LoRA crosses the 0.50 alert threshold 3.6 s before collision (peaking at 72.0%) while toggling lora_enabled = False in 0.0 ms locks pristine d1-2B bounding boxes onto the white sedan turning across the lane; zero-shot base d1-2B stays flat below 11.6%.
Left (#00264, urban rain): 9 consecutive zero-token target locks through wet windshield glare (69.5% peak). Right (#01224, suburban night): zero-shot base falsely spikes to 52.3% on oncoming headlights while 24-layer LoRA stays calm below 38.6% (0 alerts).
| Path | Precision & Hardware | Adapted Layers | Trainable Params | Primary Use |
|---|---|---|---|---|
cuda_bf16_24layer/ |
PyTorch bfloat16 (CUDA) |
All 24 (L0..L23, 153 projections) |
4,117,184 |
Best ranking (0.772 window AUROC, 0.794 Nexar truncation mAP) + 0.0 ms toggle for zero-token box target locks |
cuda_bf16_time_machine_24layer/ |
PyTorch bfloat16 (CUDA) |
All 24 (L0..L23) |
4,117,184 |
Zero-human-label temporal hindsight adapter (0.727 peak AUROC, 28.8% window AP from t + 3.5s outcomes alone) |
mlx_4bit_6layer/ |
Apple Silicon MLX (4-bit) |
Top 6 (L18..L23) |
1,032,384 |
Laptop / edge 16 GB unified memory (0.804 AUROC, 51.5% window AP on 96-clip Stage 1 slice) |
mlx_4bit_2layer/ |
Apple Silicon MLX (4-bit) |
Top 2 (L22..L23) |
344,128 |
Fast-track shallow ablation (0.764 AUROC, 41.5% window AP, 40% episode FAR) |
inference_cuda.py |
Python (transformers + safetensors) |
L0..L23 + box toggle |
n/a | Standalone loader running 4-frame hazard scoring (lora_enabled=True) + pristine d1-2B threat boxes (lora_enabled=False) |
examples/ |
Animated .gif + H.264 .mp4 + .png |
n/a | n/a | Dawn State target-locked HUD replays on unseen Nexar crashes (#00288, #00264) and calm night control (#01224) |
bfloat16 + Zero-Token box Target Lock)Important (
LiquidAI/d1-2BLinear Fusion Note): Setmodel.fuse_projections = lambda: Noneimmediately afterAutoModel.from_pretrained(...)(before accessingmodel.engine) soq/k/vandw1/w3projections stay unfused for LoRA attachment.inference_cuda.pyhandles this automatically.
from huggingface_hub import snapshot_download
from PIL import Image
ckpt_root = snapshot_download("xmattwest/d1-2B-nexar-collision-lora")
import sys
sys.path.insert(0, ckpt_root)
from inference_cuda import DashcamD1Predictor
predictor = DashcamD1Predictor(f"{ckpt_root}/cuda_bf16_24layer")
frames = [Image.open(f"frame_{i}.jpg").convert("RGB") for i in range(4)] # 2.0 fps (t-1.5s .. t=0.0s)
out = predictor.predict_window_and_box(frames)
print(out)
# -> {'hazard_prob': 0.7203, 'threat_box': {'box': {'top': 0.48, 'bottom': 0.71, 'left': 0.02, 'right': 0.25}, 'confidence': ...}}
Research and offline dashcam triage only; do NOT deploy as an in-vehicle audible driver alarm or autonomous braking trigger.
Across 100 unseen Nexar test drives (50 crashes/near-misses and 50 routine urban, night, highway, and rain drives), a 20-minute commute corresponds to 60 twenty-second segments:
p >= 0.50 (70% crash recall, 2.75 s detected warning lead time), a 44% episode false-alarm rate equals 26.4 false alarms per 20-minute commute.<= 5% FAR threshold (26% unseen crash recall, 10% test FAR, 1.65 s lead time), it still averages 6.0 false alarms per commute.4% (2.4 false alarms per commute) compresses crash recall to 10% conformal (18% oracle).Reaching production-grade windshield alerting requires 3D spatiotemporal motion encoders (10-30 fps optical expansion as in V-JEPA2 / BADAS-Open) plus ego-vehicle speed/braking telemetry or Doppler radar.
@misc{west2026threeseconds,
title = {Three Seconds Before Impact: Zero-Token Crash Anticipation, Spatial Target Locking, and the Commute False-Alarm Wall in LiquidAI/d1-2B},
author = {West, Matt},
year = {2026},
url = {https://shelltoho.me/pubs/three-seconds-before-impact/}
}
cuda_bf16_24layer/adapters.safetensors 17 MBcuda_bf16_time_machine_24layer/adapters.safetensors 17 MBmlx_4bit_6layer/adapters.safetensors 4 MBmlx_4bit_2layer/adapters.safetensors 1 MBLiquidAI/d1-2B