用知识蒸馏让法律检索快10倍,还更准。
Cassette: Case-to-Case Structural Distillation for Efficient Legal Case Retrieval

- 用教师模型指导轻量学生模型,迁移图结构推理能力。
- 在5.5万案例库上检索速度从3500秒降至约30秒。
- 适合需要快速法律案例检索的律师与普通用户。
法律案例检索(LCR)是辅助法律从业者高效查找判例、让普通人无需付费即可获取法律信息的重要工具。先前工作CaseLink虽利用案例图结构提升检索准确率,但推理时构建图和计算成对词频相似度带来高计算开销,复杂度达O(n²),导致大规模数据库下运行时间过长。例如,在包含1,563个候选案例的COLIEE2022数据集上,单次查询耗时超过500毫秒;而在包含55,192个案例的LeCaRDv2数据集上,耗时将增至3,500秒以上。为此,本文提出Cassette框架,通过排名蒸馏与特征匹配双重目标,将强大教师检索器的知识高效迁移到轻量级混合学生双编码器中。学生查询编码器采用多层感知机以实现快速在线处理,而学生候选编码器则使用图神经网络,适合离线处理案例库。在三个基准数据集上的实验验证了该方法在保持高精度的同时实现显著加速。代码已开源:https://github.com/yanran-tang/Cassette/
原文摘要 · Abstract (English)
Legal case retrieval (LCR) is an essential tool for not only assisting legal practitioners to efficiently retrieve precedents but also enabling ordinary individuals to find valuable legal case information without relying on expensive professional legal services. Our previous work CaseLink demonstrated the effectiveness of using case to case graph structures to improve retrieval accuracy. However, its high computational cost during inference on large-scale legal databases limits its practical use in real-world settings. The main inefficiency comes from constructing test time graphs and computing pairwise term frequency similarities of cases. This process has O(n^2) complexity for n legal cases, making the runtime prohibitive as the number of candidates grows. For example, the retrieval time for one query on a database (COLIEE2022) with 1,563 candidate cases is more than 500 milliseconds, while the runtime would increase drastically to more than 3,500 seconds for a database (LeCaRDv2) with 55,192 candidate cases. To further enhance the retrieval performance while achieving a significant speed-up, in this extension paper, Cassette framework is proposed with a distillation strategy involving ranking objective and eigen-matching objective for an effective transfer of knowledge from a powerful and well-trained heavy teacher retriever to a lightweight and efficient hybrid student dual encoder. Specifically, the student query encoder is implemented as a multilayer perceptron model designed for fast online processing, whereas the student candidate encoder adopts a GNN architecture, suitable for an offline manner within the case database. Extensive experiments are conducted on three benchmark datasets, and the results verify the effectiveness of the ranking distillation while achieving high efficiency. The code has been released on https://github.com/yanran-tang/Cassette/.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。