AI Summary • Published on Apr 26, 2026
Autonomous vehicles (AVs) frequently encounter challenges in complying with established traffic laws and regulations, a fundamental requirement for human drivers. Current data-driven AV models lack explicit mechanisms to encode traffic laws during training, leading to violations, incidents, and a lack of regulatory oversight. Existing approaches that translate legal provisions into formal logic are labor-intensive, difficult to scale, and costly to maintain as regulations evolve. While large language models (LLMs) offer a promising alternative for automated derivation of legal requirements, they often struggle with precision due to hallucinations or by missing applicable provisions without proper grounding in structured traffic scenarios. This highlights a critical need for a scalable and accurate method to integrate scenario-aware legal compliance into AV systems.
The authors propose a novel pipeline designed to derive scenario-specific driving requirements from traffic laws. This pipeline features two main components. Firstly, it enhances law-scenario matching and mitigates LLM hallucination by explicitly grounding both legal provisions and traffic scenarios within a unified, hierarchical traffic scenario taxonomy. This taxonomy integrates international standards such as OpenDRIVE, OpenSCENARIO, and ISO 34504. Through Taxonomy-Guided Anchoring (TGA), learnable soft prompts are attached to each taxonomy node, which encode hierarchical semantics and facilitate accurate scenario grounding for retrieving applicable legal provisions. Secondly, once the scenario is grounded, the pipeline translates the relevant legal provisions into actionable driving requirements using a structured Chain-of-Thought (CoT) reasoning process. These derived behavioral constraints are then integrated into the AV system to provide multi-scale guidance for strategic routing, tactical planning, and operational vehicle control, ensuring normative statutes are operationalized into precise real-world driving constraints.
The proposed method was rigorously evaluated on Chinese traffic laws using the OnSite dataset, which comprises 5,897 diverse scenarios. The results demonstrated a substantial improvement in performance, with the taxonomy-grounded pipeline achieving a 29.1% higher F1-score for law-scenario matching compared to the strongest LLM baseline. Furthermore, it significantly increased the derivation accuracy of mandatory and prohibitive driving requirements by 36.9% and 38.2% (1-gram F1), respectively. Ablation studies confirmed the effectiveness of node-wise learned soft prompts over handcrafted prompts or universal anchors. The practical utility of the pipeline was also showcased by constructing a law-compliance layer for AV navigation across 1,500 km of road networks in nine major robotaxi operating regions in the U.S. and China. Additionally, an onboard, real-time compliance monitor was deployed in field testing, which successfully flagged violations related to right-of-way semantics and road-marking constraints, indicating a clear path toward lawful AV operation.
This research lays a crucial foundation for the development, deployment, and regulatory oversight of lawful autonomous driving systems by enabling them to accurately derive and adhere to scenario-specific legal requirements. The framework can be further advanced by more tightly integrating explicit compliance requirements into data-driven end-to-end AV architectures, supporting flexible mechanisms for applying behavioral constraints in safety-critical situations, and evolving regulatory systems to accommodate increasing automation. Beyond autonomous driving, the methodology presented holds broader implications for AI safety and alignment, offering a direction for translating human-written rules into machine-interpretable constraints to guide the behavior of AI systems in various legally and ethically governed domains.