Abstract
With the growing prevalence of large language models (LLMs), the safety of LLMs has raised significant concerns. However, there is still a lack of definitive standards for evaluating their safety due to the subjective nature of current safety benchmarks. To address this gap, we conducted the first exploration of LLMs' safety evaluation from a legal perspective by proposing the SafeLawBench benchmark. SafeLawBench categorizes safety risks into three levels based on legal standards, providing a systematic and comprehensive framework for evaluation. It comprises 24,860 multi-choice questions and 1,106 open-domain question-answering (QA) tasks. Our evaluation included 2 closed-source LLMs and 18 open-source LLMs using zero-shot and few-shot prompting, highlighting the safety features of each model. We also evaluated the LLMs' safety-related reasoning stability and refusal behavior. Additionally, we found that a majority voting mechanism can enhance model performance. Notably, even leading SOTA models like Claude-3.5-Sonnet and GPT-4o have not exceeded 80.5% accuracy in multi-choice tasks on SafeLawBench, while the average accuracy of 20 LLMs remains at 68.8%. We urge the community to prioritize research on the safety of LLMs.
Introduction
As Large Language Models (LLMs) become more integrated into our daily lives, "safety alignment" has moved from a niche research topic to a critical engineering requirement. However, most current safety benchmarks rely on subjective ethical categories like "helpfulness" or "harmlessness," which can be fuzzy and inconsistent. This ambiguity makes it difficult to measure if a model is truly safe or merely adhering to a specific set of cultural norms.
SafeLawBench addresses this by shifting the evaluation from subjective ethics to established legal standards. Legal frameworks offer a definitive, documented standard of acceptable behavior and the consequences of violations. While existing legal benchmarks typically focus on capability (e.g., passing the Bar Exam), SafeLawBench focuses on safety: the ability of a model to recognize and avoid generating content that violates the law.
Methodology: A Legal-Centric Safety Framework
The researchers developed a three-tiered safety taxonomy using a combination of automated clustering and human expertise to ensure both scale and accuracy.
- Seed Collection: Real-world legal materials were transformed into multi-choice questions (MCQs) using LLMs.
- Taxonomy Development: Hierarchical clustering was applied to these seed tasks to create four primary ranks: Critical Personal Safety, Property & Living Security, Fundamental Rights, and Welfare Protection.
- Scaling & Labeling: The remaining legal materials were processed into 24,860 MCQs and 1,106 open-domain QA tasks. These labels were then verified by a team of 20 legal interns to ensure high-quality ground truth.
To measure model performance beyond simple accuracy, the authors introduced "Reasoning Stability" metrics using Pass@k and G-Pass@k. These metrics evaluate how consistently a model provides the correct (legal) answer across multiple attempts at different temperatures, highlighting whether a model truly understands the law or is simply guessing.
The SafeLawBench Dataset
The primary contribution is the SafeLawBench dataset, which is grounded specifically in legal statutes rather than general "harmful" prompts. The dataset draws from legal standards in Mainland China and Hong Kong SAR, including the PRC Civil Law and the HK Basic Law. The structure is highly granular, featuring 4 risk levels, 10 categories, and 35 sub-categories, providing a comprehensive map of potential legal-safety violations.
Experimental Results
The researchers tested 20 models, including frontier models like GPT-4o and Claude 3.5 Sonnet, alongside various open-source models such as Llama 3, Qwen 2.5, and DeepSeek-V3.
- SOTA Performance Ceiling: Claude 3.5 Sonnet achieved the highest MCQ accuracy at 80.5%, followed closely by GPT-4o at 80.3%. The fact that no model exceeded 81% suggests that current alignment techniques are insufficient for complex legal reasoning.
- The Average Gap: The average accuracy across all 20 models was only 68.8%, indicating a significant safety gap in the broader LLM ecosystem.
- Open-Source Leaders: DeepSeek-R1 and Qwen2.5-72B-Instruct performed exceptionally well. Notably, DeepSeek-R1 led the Elo ratings, likely due to its advanced reasoning capabilities developed during its unique training process.
- Regional Bias: Models generally performed better on questions related to Mainland China law than Hong Kong law, likely reflecting biases in the pre-training data distributions.
Key Insights and Discussion
- Knowledge vs. Reasoning: Models often "know" the law (citing correct statutes) but fail to apply it correctly to specific scenarios. A model might identify a law correctly but then recommend an illegal course of action in an MCQ.
- Stability as a Safety Metric: High-performing models like Claude 3.5 show very low variance (high stability). Conversely, weaker models might get the right answer once but fail in subsequent attempts. If a safety guardrail only works 60% of the time, it cannot be considered a reliable guardrail.
- The Refusal Paradox: The study found that models often exhibit "over-refusal" on complex legal topics (refusing safe questions) while simultaneously failing to refuse actual illegal prompts in other categories. This suggests that current refusal mechanisms are often triggered by keywords rather than semantic understanding.
Conclusion
SafeLawBench provides a rigorous, objective framework for evaluating LLM safety. The results demonstrate that even the most advanced models struggle to consistently distinguish between legal and illegal advice. Future work will involve expanding the benchmark to include global legal systems and developing targeted Supervised Fine-Tuning (SFT) techniques to improve legal reasoning chains in LLMs.
Summary updated