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.
翻译:遵守交通法律法规是人类驾驶员的基本要求,然而自动驾驶车辆在多样化真实场景中可能违反这些要求。为将合规性编码至自动驾驶系统,传统方法使用形式逻辑语言明确指定行为约束,但这一过程劳动密集、难以扩展且维护成本高昂。随着人工智能的最新进展,利用大型语言模型从交通法律法规中推导法律要求颇具前景。然而,若未能在结构化交通场景中进行显式具身推理,大型语言模型常检索不相关条款或遗漏适用条款,导致要求不精确。为此,我们提出一种新颖的流水线,通过编码层级语义的节点式锚点,将大型语言模型的推理锚定在交通场景分类体系上。在中文交通法律法规与OnSite数据集(5897个场景)上,我们的方法将法律-场景匹配率提升29.1%,并将推导的强制性和禁止性要求的准确率分别提升36.9%和38.2%。我们进一步通过为自动驾驶导航构建合规层,并开发用于现场测试的车载实时合规监控器,展示了实际应用可行性,为未来自动驾驶开发、部署及监管奠定了坚实基础。