# Repository Briefing: AMAP-ML/DriveStreamBench
> Source: https://repoforai.com/repo/AMAP-ML/DriveStreamBench (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/AMAP-ML/DriveStreamBench
- **Category**: LLMs & Inference (大模型与推理微调)
- **Primary Language**: Python
- **License**: Apache-2.0
- **Engineering Health**: A (76/100 · Maintenance 35/35 · Adoption 1/25 · Releases 20/20 · License 20/20)
- **Deployment / Stack Signals**: CLI, GPU
- **Momentum**: 58 ★ total (+42 24h / +57 7d) · 0 forks
- **When to Use**: Best for: VLM researchers and model teams comparing instruction-driven alert behavior on a shared driving-video protocol with causal inputs, timing-aware scoring, and per-scenario reporting. Skip if: You need a production notification service, end-to-end latency or safety validation, or a turnkey benchmark with source media and model weights bundled.

## Overview
```text
### Architecture & Core Mechanics
DriveStreamBench is a Python 3.9+ evaluation harness for replaying driving video as a causal stream. Given a user watch instruction, `drivestreambench.inference.run_l4` reads annotation JSONL and sampled frames from `--dataroot`, selects a model through `--model`, and runs decisions on the prescribed schedule without exposing future frames. The model returns `ALERT` when the requested event occurs and `NO REPLY` otherwise.

Inference and scoring are separate CLI steps. The runner writes prediction JSONL and a run manifest through `--output` and `--manifest`; `scripts/evaluate.py` consumes annotations and predictions and emits score JSON. The demonstrated selector is `qwen3vl:Qwen/Qwen3-VL-8B-Instruct`. The package uses setuptools and wheel, with optional extras for VLM, API, training, and test workflows. Adapter usage and score parser selection are documented separately, so a change of backend need not change the evaluation protocol.

### Key Capabilities & Differentiators
The v1.0.0 data release contains 26,853 annotation records across L1–L4. L4 uses 2 FPS input and one decision per second by default. The scorer maps 10 FPS reference frames onto the sampled-frame grid, so its `--fps` setting must match the prediction run: use `--fps 2` for the default and `--fps 1` for native 1 FPS. Core Macro averages AlertScore@2s across S1–S5; S6 is evaluated separately rather than folded into that headline aggregate.

For shorter runs, `scripts/build_l4_short.sh` generates `annotations/l4_short_test.jsonl` with a 15-second maximum per sample. `docs/evaluation.md` covers output formats, parser selection, and L1–L3 scoring. The reference SFT workflow includes data conversion and training entry points but no model weights. The demo plays original frames at 4 FPS, twice the default L4 input rate, and marks reference events; it should not be read as benchmark inference footage.

### Trade-offs & Limitations
A general-purpose video QA evaluator can test broader clip understanding, but it does not necessarily constrain decisions to information available at the alert time. DriveStreamBench makes that constraint explicit and fixes the L4 sampling, decision cadence, and scenario aggregation. That makes model and instruction-following comparisons easier to interpret, at the cost of less direct coverage of products with a different sampling policy, alert behavior, or operating environment.

The benchmark measures alert behavior under replay, not capture-to-notification latency or road safety. For those goals, a custom playback and instrumentation harness offers more control but requires maintaining its own protocol and scorer. Local VLM runs need model weights and hardware capacity; API runs can shift the inference burden off the local machine but bring per-call costs and data-handling considerations. CPU scoring is easy to separate from either path, but acquiring and preparing source media remains an independent setup task.

### Hardware & Deployment Guide
Install on Python 3.9 or later using `python -m pip install -e '.[test]'`, then run `bash scripts/run_smoke_test.sh`. Scoring and the example run work on CPU. Add `.[vlm]` for the local VLM path, `.[api]` for API-based evaluation, or `.[train]` for the reference training workflow. For local inference, measure peak memory and processing time with the selected model and representative clips before sizing for concurrent streams; no fixed GPU or VRAM target is specified.

The v1.0.0 release separates implementation and annotations into `DriveStreamBench-code-v1.0.0.zip` and `DriveStreamBench-data-v1.0.0.zip`. Prepare data with `scripts/prepare_data.sh` or install a downloaded annotation archive using `scripts/download_data.py --archive`. That prepares the benchmark data, but source media still need to be obtained separately and prepared as frames for `--dataroot`. The installed OOD source list and preprocessing guide describe a separate input preparation path.
```

## Key Capabilities
```text
- Causal replay: models see only frames available at each decision point and return `ALERT` or `NO REPLY`.
- L4 cadence: the default protocol samples at 2 FPS and makes one decision per second; the demo's 4 FPS playback is not the inference setting.
- Time alignment: scoring maps 10 FPS reference frames onto the sampled-frame grid; use `--fps 1` for native 1 FPS runs.
- Scenario reporting: Core Macro averages AlertScore@2s across S1–S5 and reports S6 separately.
- Run artifacts: `drivestreambench.inference.run_l4` writes prediction JSONL and a separate manifest, while `scripts/evaluate.py` writes score JSON.
- Dataset scope: v1.0.0 ships 26,853 L1–L4 annotation records, with source media distributed separately.
```

## Quick Start / Clone
```bash
python -m pip install -e '.[test]'
bash scripts/run_smoke_test.sh
```
