This work aims to improve the generalization of logic-based legal reasoning systems by integrating recent advances in NLP with legal-domain adaptive few-shot learning techniques using LLMs. Existing logic-based legal reasoning pipelines typically rely on fine-tuned models to map natural-language legal cases into logical formulas before forwarding them to a symbolic reasoner. However, such approaches are heavily constrained by the scarcity of high-quality annotated training data. To address this limitation, we propose a novel LLM-based legal reasoning framework that enables effective in-context learning through retrieval-augmented generation. Specifically, we introduce Legal2LogicICL, a few-shot retrieval framework that balances diversity and similarity of exemplars at both the latent semantic representation level and the legal text structure level. In addition, our method explicitly accounts for legal structure by mitigating entity-induced retrieval bias in legal texts, where lengthy and highly specific entity mentions often dominate semantic representations and obscure legally meaningful reasoning patterns. Our Legal2LogicICL constructs informative and robust few-shot demonstrations, leading to accurate and stable logical rule generation without requiring additional training. In addition, we construct a new dataset, named Legal2Proleg, which is annotated with alignments between legal cases and PROLEG logical formulas to support the evaluation of legal semantic parsing. Experimental results on both open-source and proprietary LLMs demonstrate that our approach significantly improves accuracy, stability, and generalization in transforming natural-language legal case descriptions into logical representations, highlighting its effectiveness for interpretable and reliable legal reasoning. Our code is available at https://github.com/yingjie7/Legal2LogicICL.
翻译:本文旨在通过整合NLP最新进展与基于大语言模型的法律领域自适应少样本学习技术,提升基于逻辑的法律推理系统的泛化能力。现有基于逻辑的法律推理流程通常依赖微调模型将自然语言描述的法律案件映射为逻辑公式,再交由符号推理器处理。然而,此类方法严重受限于高质量标注训练数据的稀缺性。为解决这一局限,我们提出一种新颖的基于大语言模型的法律推理框架,通过检索增强生成实现有效的上下文学习。具体而言,我们引入Legal2LogicICL——一个在潜在语义表征层面和法律文本结构层面平衡示范样本多样性及相似性的少样本检索框架。此外,我们的方法通过缓解法律文本中实体引发的检索偏差(即冗长且高度具体的实体提及常主导语义表征、掩盖具有法律意义的推理模式),显式考虑了法律结构。Legal2LogicICL能够构建信息丰富且鲁棒的少样本示范,从而无需额外训练即可实现准确稳定的逻辑规则生成。同时,我们构建了新数据集Legal2Proleg,标注了法律案件与PROLEG逻辑公式之间的对齐关系,以支持法律语义解析评估。在开源及专有LLM上的实验结果表明,本方法在将自然语言法律案件描述转换为逻辑表征时显著提升了准确性、稳定性及泛化能力,突显了其在可解释且可靠的法律推理中的有效性。我们的代码已在https://github.com/yingjie7/Legal2LogicICL 开源。