Towards Lawful Autonomous Driving: Deriving Scenario-Aware Driving Requirements from Traffic Laws and Regulations

arXiv cs.AI / 4/28/2026

📰 NewsDeveloper Stack & InfrastructureModels & Research

Key Points

  • The paper argues that autonomous vehicles must follow traffic laws, but current formal-logic approaches for encoding compliance are costly and difficult to scale.
  • It proposes using large language models to derive driving requirements from traffic regulations, while addressing the risk that LLMs may retrieve or apply the wrong provisions without scenario grounding.
  • The authors introduce a scenario-aware pipeline that grounds LLM reasoning in a traffic-scenario taxonomy using node-wise anchors with hierarchical semantics.
  • Experiments on Chinese traffic laws and the OnSite dataset (5,897 scenarios) show a 29.1% improvement in law–scenario matching and large gains in the accuracy of both mandatory and prohibitive requirement derivation.
  • The work includes an implementation toward real-world use, demonstrating a law-compliance layer for AV navigation and an onboard real-time compliance monitor for field testing.

Abstract

Driving in compliance with traffic laws and regulations is a basic requirement for human drivers, yet autonomous vehicles (AVs) can violate these requirements in diverse real-world scenarios. To encode law compliance into AV systems, conventional approaches use formal logic languages to explicitly specify behavioral constraints, but this process is labor-intensive, hard to scale, and costly to maintain. With recent advances in artificial intelligence, it is promising to leverage large language models (LLMs) to derive legal requirements from traffic laws and regulations. However, without explicitly grounding and reasoning in structured traffic scenarios, LLMs often retrieve irrelevant provisions or miss applicable ones, yielding imprecise requirements. To address this, we propose a novel pipeline that grounds LLM reasoning in a traffic scenario taxonomy through node-wise anchors that encode hierarchical semantics. On Chinese traffic laws and OnSite dataset (5,897 scenarios), our method improves law-scenario matching by 29.1\% and increases the accuracy of derived mandatory and prohibitive requirements by 36.9\% and 38.2\%, respectively. We further demonstrate real-world applicability by constructing a law-compliance layer for AV navigation and developing an onboard, real-time compliance monitor for in-field testing, providing a solid foundation for future AV development, deployment, and regulatory oversight.