Legal Mathematical Reasoning with LLM s: Procedural Alignment through Two-Stage Reinforcement Learning (2025)

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 legal mathematical reasoning is a critical capability for applying large language models (llms) in real-world legal systems. this domain-specific task-spanning scenarios such as compensation calculation and liability apportionment-requires not only the precise application of formulas and parameters, but also adherence to legally prescribed ## the proposed dataset: lexnum to construct lexnum, we collected real-world legal documents from pkulaw, covering three highfrequency litigation domains in chinese civil law: economic compensation, workplace injury, and traffic accident cases. each document includes structured metadata-case background, legal process, and final compensation result-and is preanonymized. we developed a two-stage pipeline involving llm-assisted extraction and selective human verification to efficiently construct highquality legal mathematical reasoning examples. details of each subtask are provided in appendix a. ## the proposed method: lexpam in this section, we present lexpam, a twostage reinforcement learning framework comprising curriculum-based data selection ( §4.1), foundational training for legal mathematical reasoning ( §4.2), and procedural alignment through targeted reward optimization ( §4.3). ## conclution we present lexnum, the first benchmark for legal mathematical reasoning in chinese, and introduce lexpam, a two-stage reinforcement learning framework that improves both computational accuracy and procedural compliance. lexpam leverages curriculum-based data selection and a novel legalaware reward, enabling a lightweight 1.5b model to outperform a range of legal-domain and reasoningfocused llms. extensive experiments demonstrate lexpam's effectiveness across in-domain and crossdomain settings, as well as in multi-task training scenarios. human evaluation further confirms its strength in producing procedurally sound and userreadable outputs. ## limitations in this paper, due to computational resource limitations, we primarily conduct experiments on a 1.5b-parameter reasoning model to explore how to enhance its legal mathematical reasoning capabilities. in future work, when more computational resources become available, we plan to test lex-pam on larger-scale llms to investigate whether its effectiveness holds. moreover, we have not yet annotated the legal mathematical reasoning process with chain-of-thought (cot) in this paper, as producing high-quality cot annotations for legal reasoning involves significant human effort. due to the domain-specific nature of the task, such annotations require careful work by legal professionals. in the future, we aim to enrich the lexnum dataset by annotating the cot reasoning processes that lead to the final answers, thereby further advancing research in the field of legal ai. ## ethical considerations the lexnum dataset we provide is intended to facilitate research on reasoning llms in the legal nlp domain. the data was collected from publicly accessible websites, and all cases have been anonymized. during the dataset construction process, we also engaged legal professionals to review the dataset to ensure its compliance with legal and ethical standards.