Source-linked AI summary

Cassette: Case-to-Case Structural Distillation for Efficient Legal Case Retrieval

Yanran Tang, Ruihong Qiu, Hongzhi Yin, Xue Li, Zi Huang

arXiv:2609.08185v1cs.IR

TL;DR

Cassette addresses the high inference cost of graph-based legal case retrieval on large databases. It distills ranking and structural knowledge from a heavy GNN teacher into a hybrid student retriever, achieving retrieval performance comparable to heavyweight methods while substantially improving inference efficiency. The paper supports this outcome with experiments on three benchmark datasets, while identifying fine-grained legal knowledge integration as future work.

  • Problem

    Graph-based legal retrieval improves accuracy but is limited by dynamic graph construction, pairwise computation, and GNN operations during inference.

  • Method

    Cassette combines ranking and eigen-matching distillation to transfer knowledge from a GNN teacher to a hybrid student with MLP query and GNN candidate encoders.

  • Results

    Cassette achieves retrieval performance comparable to heavyweight state-of-the-art CaseLink while substantially improving inference efficiency across three benchmark datasets.

  • Takeaways & Limitations

    Cassette combines the efficiency of two-tower retrieval with the efficacy of relational modeling for large-scale legal information systems.

  • Takeaways & Limitations

    Future work should integrate fine-grained legal knowledge into the current model.

Abstract

from arXiv · show

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/.

1 INTRODUCTION

Legal case retrieval must balance the accuracy benefits of graph-based case-to-case modeling with the efficiency required for real-time, large-scale use. Cassette addresses this tension by distilling ranking and structural knowledge into a hybrid student retriever.

  • Motivation: Graph-based CaseLink improves accuracy over the efficient CaseGNN baseline but incurs substantially higher inference cost.The trade-off is attributed to graph construction, pairwise similarity computation, and GNN message passing at test time.
  • Motivation: O(n^2) pairwise similarity computation and dynamic graph updates make graph-based retrieval impractical for unseen queries in large databases.Incoming queries require graph reconstruction and recalculation because they are unseen during model development.
  • Motivation: Naive distillation transfers ranking signals but can fail to preserve latent inter-case relationships needed for legally informed retrieval.The paper therefore motivates combining relevance ranking with structural alignment.
  • Cassette: Cassette distills a GNN teacher into a hybrid dual encoder using ranking and eigen-matching objectives, with a GNN candidate encoder and MLP query encoder.The candidate-side GNN supports offline processing, while the query-side MLP supports efficient online processing.
  • Cassette: Experiments on three benchmark datasets verify Cassette’s performance and efficiency over previous baselines.The contribution summary reports extensive multilingual experiments.

2 RELATED WORK

Prior legal case retrieval work spans statistical and neural models, including graph-based approaches that improve relational modeling but retain substantial computational overhead. Cassette instead distills graph-based ranking and structural knowledge into a more efficient retrieval architecture.

  • Legal Case Retrieval: Legal case retrieval methods include statistical models such as TF-IDF, BM25, and LMIR, alongside neural models that encode cases with language-model architectures.Neural approaches address long legal documents through truncation, paragraph or sentence segmentation, and relational-triplet representations.
  • Graph-Based Retrieval: GNN-based methods model individual cases, external knowledge graphs, or case-to-case relationships to improve legal retrieval.CaseLink extends two-tower retrieval with pairwise relational learning and achieves state-of-the-art results.
  • GNN Distillation: Graph distillation can reduce model size without reducing the overhead of graph construction and message passing.These operations remain computationally costly when new data arrive or inference requires graph updates.
  • GNN Distillation: GNN-to-MLP methods transfer graph knowledge to lightweight models, but Cassette is tailored to legal retrieval rather than generic node or link prediction.Cassette primarily distills ranking capability from a teacher GNN while incorporating legal relational structure.
  • Ranking Distillation: Conventional ranking distillation transfers knowledge between models that generally share an architectural family, limiting cross-architecture flexibility.Cassette instead transfers knowledge from a graph-based retriever to a two-tower retriever.
  • Ranking Distillation: Cassette introduces cross-model ranking distillation from a graph-based teacher to a two-tower student for efficient legal retrieval.The paper describes this as a new direction for legal case retrieval and aims to preserve structural reasoning while improving efficiency.

3 PRELIMINARY

Cassette formulates legal case retrieval over a candidate case pool and uses a graph-based teacher retriever pretrained on case and charge relations. The evaluation setting focuses on unseen queries against a fixed candidate pool.

  • 3.1 Task Definition: The current experiments evaluate new queries against a static candidate pool whose repository remains unchanged during testing.
  • 3.1 Task Definition: Cassette can be extended to incremental document insertion, but dynamic-case evaluation lies beyond the current fixed-pool datasets and experiments.
  • 3.1 Task Definition: Legal case retrieval seeks relevant precedent cases for each query case from a candidate set.
  • 3.2 Teacher Retriever Pretraining: A pretrained GNN-based CaseLink teacher is trained with contrastive learning and then supplies frozen supervision signals for student encoders.
  • 3.2 Teacher Retriever Pretraining: The teacher legal graph contains query cases, candidate cases, and legal charges connected by case-case, case-charge, and charge-charge relations.
  • 3.2 Teacher Retriever Pretraining: Teacher case-case edges use BM25 similarity scores, while case-charge edges are binary text-presence links and charge-charge edges use word-embedding similarity.

4 CASSETTE METHOD

Cassette distils a heavy graph-based teacher into separate candidate and query student encoders to avoid dynamic online graph updates. Its design combines offline candidate encoding with online query processing and ranking-plus-structural distillation.

  • Overview: Cassette targets high-efficiency retrieval by replacing the heavy teacher with a lightweight hybrid student dual encoder.
  • Motivation: Dynamic teacher inference updates graph structure and recomputes BM25 scores when a new query arrives, creating slow online computation.
  • Overview: The framework separates candidate and query modelling, constructing a static candidate graph for offline calculation and using a separate query model online.
  • 4.1 Student Candidate Case Encoding: The student candidate encoder uses a candidate-only graph with case and charge nodes plus case-case, case-charge, and charge-charge edges.
  • 4.1 Student Candidate Case Encoding: Candidate representations are precomputed offline with a GNN, while an MLP encodes each unseen query on the fly.
  • 4.3 Case to Case Structural Distillation: Ranking distillation transfers teacher query-candidate ordering, while eigen-matching transfers latent case-to-case structural relationships.
  • 4.3 Case to Case Structural Distillation: The eigen-matching objective addresses structural information omitted by distilling query-candidate ranking alone.
  • 4.4 Inference: Cassette does not need retraining during testing when the database is expanding.

5 EXPERIMENT

Cassette is evaluated on three legal case retrieval benchmarks using standard retrieval metrics and comparisons with traditional, language-model, and graph-based baselines. The experiments examine performance, efficiency, module contributions, robustness, document insertion, and hyperparameter sensitivity.

  • Research questions: The experiments address eight questions covering overall performance, efficiency, module effectiveness, distillation objectives, candidate encoding, document insertion, charge-category robustness, and hyperparameters.The study therefore evaluates both retrieval quality and deployment-relevant behavior.
  • Datasets: Three benchmark datasets—COLIEE2022, COLIEE2023, and LeCaRDv2—form the evaluation suite.COLIEE datasets contain English Federal Court of Canada cases, while LeCaRDv2 contains Chinese criminal cases with 55,192 candidates.
  • Experimental setting: The evaluation follows an inductive setting in which test queries are unseen during training.COLIEE also separates test cases from most training cases, whereas LeCaRDv2 shares a candidate pool between training and testing.
  • Evaluation metrics: Precision, recall, Micro F1, Macro F1, MRR, MAP, and NDCG measure retrieval performance.Top-5 results are reported for COLIEE and Top-30 for LeCaRDv2 unless otherwise specified.
  • Baselines: Cassette is compared with BM25, language-model methods, two-tower graph methods, and CaseLink, the teacher GNN.The baselines include LEGAL-BERT, Lawformer, MonoT5, SAILER, PromptCase, large embedding models, CaseGNN, and CaseLink.

consistently outperforms or matches the heavyweight SOTA model CaseLink, while substantially surpassing

Across three datasets, Cassette generally outperforms traditional, two-tower, and large-language-model baselines while matching or surpassing CaseLink in several settings. Its offline candidate encoding and lightweight online inference provide major speedups, while ablations support the value of structural and ranking distillation.

  • Overall performance: Cassette outperforms traditional two-tower and advanced embedding language-model baselines across the evaluated datasets.The reported comparisons cover both one-stage and two-stage retrieval settings.
  • Overall performance: Cassette matches or outperforms the teacher GNN on COLIEE2022 and LeCaRDv2, while narrowing the gap on COLIEE2023.The COLIEE2023 result is described as approaching the teacher despite dataset difficulty.
  • Inference efficiency: 50 times speed-up on COLIEE and ∼340,000 times speed-up on LeCaRDv2 are reported against CaseLink.Cassette combines near-BM25 query latency with higher retrieval accuracy and ranking quality in complex scenarios.
  • Inference efficiency: Cassette’s efficiency increases as candidate cases grow from 1,563 in COLIEE2022 to 55,192 in LeCaRDv2.Offline candidate encoding and lightweight online inference avoid the teacher’s costly test-time graph processing.
  • Ablation study: Student encoders and ranking distillation significantly contribute to retrieval performance across the three datasets.Removing structural distillation or using supervised loss alone prevents the student from matching the teacher and Cassette in most metrics.
  • Distillation objectives: Combining supervised and structural objectives improves results, whereas omitting either objective causes a noticeable performance decline.Eigen-matching alone is less useful, while its combination with supervised and ranking losses improves performance.
  • Robustness: Performance remains stable across charge categories and after document insertion, although mixed-corpus retrieval declines moderately across metrics.The results indicate robustness to case-type shifts and enlarged candidate pools within the tested settings.

6 CONCLUSION

Cassette addresses the inference inefficiency of graph-based legal case retrieval with a distillation framework that balances retrieval effectiveness, computational efficiency, and practical scalability. Its hybrid student dual encoder achieves retrieval performance comparable to state-of-the-art methods while improving inference efficiency for large-scale deployment.

  • Cassette tackles efficiency limitations caused by dynamic graph construction and computationally intensive GNN operations during inference.
  • Cassette uses a hybrid student dual encoder supervised by a graph-based teacher retriever.The candidate encoder processes cases offline, while the query encoder supports efficient real-time inference.
  • Ranking and eigen-matching objectives transfer both retrieval relevance and structural information from the teacher to the student.
  • Experiments on COLIEE2022, COLIEE2023, and LeCaRDv2 show retrieval performance comparable to state-of-the-art methods.
  • Cassette offers substantial inference-efficiency improvements, making it suitable for real-world deployment in large-scale legal information systems.

7 FUTURE WORK

Future work focuses on extending Cassette to broader legal settings, richer legal knowledge, improved interpretability, and adaptation to changing databases. These directions aim to strengthen its applicability to global and dynamic legal information systems.

  • Future work could adapt Cassette to multilingual or cross-jurisdictional legal corpora for broader applicability in global legal systems.
  • Integrating domain-specific prompts or reasoning chains into student encoders could improve interpretability and semantic alignment.
  • Online or continual distillation could let Cassette adapt incrementally to evolving legal databases without retraining from scratch.
  • Future extensions could incorporate fine-grained legal knowledge from statutes, case precedents, and legal commentaries.Such sources could help capture more nuanced legal reasoning and complex legal relationships.
  • Structured legal information, including provision constraints, could guide students to learn consistency patterns across analogous cases and legally constrained outcomes.
Loading 2609.08185v1…