Abstract
Legal mathematical reasoning is essential for applying large language models (LLMs) in high-stakes legal contexts, where outputs must be both mathematically accurate and procedurally compliant. However, existing legal LLMs lack structured numerical reasoning, and open-domain models, though capable of calculations, often overlook mandatory legal steps. To address this, we present LexNum, the first Chinese legal mathematical reasoning benchmark, covering three representative scenarios where each instance reflects legally grounded procedural flows. We further propose LexPam, a two-stage reinforcement learning framework for efficient legal reasoning training. Leveraging curriculum learning, we use a stronger teacher model to partition data into basic and challenging subsets. A lightweight 1.5B student model is then fine-tuned with Group Relative Policy Optimization, which avoids costly value networks and enables stable training from sparse, end-of-sequence rewards. The first stage improves accuracy and format; the second introduces a novel reward to guide procedural alignment via task-specific legal elements. Experiments show that existing models perform poorly on LexNum, while LexPam enhances both mathematical accuracy and legal coherence, and generalizes effectively across tasks and domains.
Introduction
In the legal domain, mathematical calculations are rarely isolated arithmetic exercises. Determining a work injury settlement or a traffic accident payout requires procedural alignment: the model must not only perform correct arithmetic but also strictly adhere to statutory steps, such as identifying insurance limits, applying liability ratios, and categorizing compensation types.
Current Large Language Models (LLMs) typically struggle with this dual requirement. Specialized legal LLMs often fail at multi-step math, while general reasoning models (like DeepSeek-R1 or GPT-4o) may lack specific "legal logic," leading to verbose or procedurally incomplete outputs. This paper introduces LexNum, a benchmark for Chinese legal mathematical reasoning, and LexPam, a reinforcement learning framework designed to bridge the gap between legal knowledge and numerical precision.
The LexNum Benchmark
LexNum is the first benchmark specifically designed for Chinese legal mathematical reasoning. It comprises 3,708 instances derived from real-world judicial documents. The benchmark covers three high-impact civil law scenarios:
- Economic Compensation (EC): Calculations involving labor contract terminations and length of service.
- Traffic Accident Compensation (TC): Complex liability apportionment and medical expense offsets under compulsory insurance.
- Work Injury Compensation (WC): Multi-layered calculations for disability benefits, funeral subsidies, and insurance offsets.
Unlike previous datasets focused on single-step criminal sentencing, LexNum requires multi-step, interdependent calculations where each step is grounded in specific legal provisions.
Methodology: The LexPam Framework
To train models for LexNum, we propose LexPam, a two-stage Reinforcement Learning (RL) approach utilizing Group Relative Policy Optimization (GRPO). GRPO is particularly efficient as it eliminates the need for a separate value (critic) network, allowing for stable training on consumer-grade hardware.
Two-Stage Curriculum Learning
LexPam employs a curriculum-based strategy to stabilize training:
- Stage 1: Foundation Training: A lightweight 1.5B student model is trained on "Basic" samples (those a stronger teacher model can already solve). Rewards are based on final answer correctness and adherence to the
<think>tag format. - Stage 2: Procedural Grounding: The model is then trained on "Challenging" samples. In this stage, we introduce a novel Legal Reward ($r_{law}$). This reward uses keyword-based weighted coverage to ensure the model's reasoning chain includes essential legal "milestones" (e.g., "Insurance," "Liability Ratio").
This approach forces the model to "think like a lawyer," ensuring that the reasoning path is as accurate as the final numerical result.
Experimental Results
LexPam (1.5B) demonstrates significant improvements over both specialized legal models and much larger general-purpose models.
Performance Comparison
LexPam achieved an average accuracy of 60.65% on LexNum, significantly outperforming specialized legal models like DISC-LawLLM (11.07%) and HanFei (5.73%), which struggled with the mathematical components. It also beat DeepSeek-R1-7B (31.52%) and GPT-4o-mini (56.93%), approaching the performance of the much larger QwQ-32B (70.94%).
Generalization and Human Evaluation
A key strength of LexPam is its ability to generalize across different legal domains. Training on one scenario (e.g., Work Injury) often improves performance on others (e.g., Traffic Accidents), suggesting the model learns transferable procedural reasoning skills.
In blind human evaluations, law students preferred LexPam's outputs over DeepSeek-R1's, citing its superior conciseness and procedural completeness. While R1 often provided overly verbose reasoning, LexPam delivered "legally grounded yet concise" steps.
Conclusion
LexPam demonstrates that small, lightweight models can achieve high-level reasoning capabilities when aligned through domain-specific procedural rewards. By combining curriculum learning with the LexNum benchmark, we provide a path toward more reliable and legally compliant AI assistants in the judicial domain.
Summary updated