用少样本检索增强生成,让法律文本转逻辑公式更准更稳。
Legal2LogicICL: Improving Generalization in Transforming Legal Cases to Logical Formulas via Diverse Few-Shot Learning
- 通过语义与结构双重多样性控制,构建高质量少样本示例。
- 在多个大模型上提升逻辑公式生成准确率与稳定性。
- 适合需要可解释法律推理的司法智能化研究者使用。
本文旨在通过结合最新NLP进展与法律领域适应性少样本学习技术,提升基于逻辑的法律推理系统的泛化能力。现有逻辑推理流程通常依赖微调模型将自然语言法律案例映射为逻辑公式,但受限于高质量标注数据稀缺。为此,提出基于LLM的Legal2LogicICL框架,利用检索增强生成实现有效的上下文学习。该方法在潜在语义表示与法律文本结构层面平衡示例的多样性与相似性,并显式缓解实体引发的检索偏差——长且特定的实体提及常主导语义表征,掩盖合法推理模式。Legal2LogicICL构建出信息丰富且鲁棒的少样本示范,实现无需额外训练的精准稳定逻辑规则生成。此外,构建新数据集Legal2Proleg,标注法律案例与PROLEG逻辑公式的对齐关系,支持法律语义解析评估。在开源及专有LLM上的实验表明,本方法显著提升自然语言法律描述到逻辑表示转换的准确率、稳定性和泛化能力,验证了其在可解释、可靠法律推理中的有效性。代码已公开于https://github.com/yingjie7/Legal2LogicICL。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。