Labor Case Recommendation with Issue-Level Visualization

This project is the integrated demonstration of my master's thesis in Computer Science at National Chengchi University. It recommends related Taiwanese labor-case judgments and highlights related issue sentences so users can inspect the textual basis of a recommendation.

The demo was completed in August 2024. The underlying research combines legal issue extraction, sentence representation learning, case-pair classification, ensemble ranking, and a Gradio interface.

What the system does

Given issue sentences extracted from a target case, the system compares the target against candidate cases, ranks the candidates, and displays related issue sentences using consistent colors. An additional version supports prediction using applicant-side issues alone, reflecting situations where both parties' arguments are not yet available.

This repository hosts project artifacts; the model repository page itself is not a hosted interactive Gradio application.

Demo screenshots

Inspect a target and a candidate case

Target and candidate case comparison with issue-group colors and a pair score

The exported HTML places the target on the left and a candidate judgment on the right, with claim text (plaintiff), issue text (p_point), and a case-pair score. Colors indicate assigned issue groups to support side-by-side inspection; they are not a causal explanation of the ranking model.

The displayed score, approximately 0.7383, belongs to this single case pair. It is neither an evaluation accuracy nor a calibrated probability. This screenshot demonstrates the interface, not benchmark performance. Its candidate identifier includes a 2022 judgment date; the research corpus statistics below are reported separately and should not be inferred from this screenshot.

Supply claim text and extracted issues

Populated Gradio form with claim text, extracted issues, and HTML output files

The illustrated interface accepts a file name, plaintiff-side claim text, and already-extracted issue text. LLM issue extraction is a stage in the broader research workflow; this form should not be taken as evidence that extraction runs automatically on submission. The output panel provides HTML files for inspection. Additional slots in this capture show out_of_range.html; their filenames alone do not establish how many valid recommendations were generated.

View the initial interface

Initial Gradio interface before entering a case

The initial screen shows the input fields and empty output components.

Method

  1. Argument extraction: Regular expressions segment the parties' arguments from judgment text.
  2. Issue extraction: LLM prompts extract issue sentences from those argument sections. Experiments used GPT-3.5 Turbo and GPT-4 variants.
  3. Issue representation: The representation stage uses S-BERT with Chinese RoBERTa and Lawformer backbones. Issue sentences are assigned to existing groups by similarity to representative center-sentence embeddings.
  4. Representation fine-tuning: Contrastive loss brings same-group issue-sentence pairs closer and separates different-group pairs. These pairs were drawn from cases outside the downstream test cases.
  5. Case-pair prediction: CNN and BiLSTM models predict whether a target/candidate pair represents similar cases. Each target is compared against the candidate database.
  6. Ensemble ranking: Logistic regression combines the model predictions; the resulting scores rank candidate cases.
  7. Inspection: Gradio presents the ranked results and colors issue sentences by their assigned group.

The issue-group assignment uses an existing grouping structure; it does not discover new groups at inference time. The ranking scores should not be interpreted as calibrated probabilities of legal similarity.

Data and annotation

  • Source: Public judgments published by Taiwan's Judicial Yuan.
  • Scope: Labor litigation, covering 2000-2021.
  • Corpus: 3,835 unique judgments.
  • Labeled pairs: 2,514 binary-labeled case pairs after filtering.

Three people with law backgrounds independently labeled pairs as similar, dissimilar, or borderline similar. Labels were compared afterward, retaining pairs with agreement from at least two annotators and excluding borderline cases. The final labels are similar and dissimilar; the annotation process did not involve a consensus discussion.

These figures describe the research corpus and do not imply that every source judgment or annotation is distributed in this repository.

Evaluation

The CNN/BiLSTM logistic-regression ensemble was compared with the LFESM baseline across 30 matched case-pair data splits, using the same dataset and evaluation procedure. Classification was evaluated using accuracy and macro-F1. Recommendation ranking was evaluated separately using Precision@1.

Splits were made at the case-pair level, so a judgment may appear in pairs in more than one partition. These experiments therefore do not establish performance on a strictly case-disjoint test set. Cases used for S-BERT contrastive fine-tuning were separate from downstream test cases.

My contribution

I led and implemented the representation-learning, case-pair modeling, ensemble, ranking, and Gradio visualization workflow, including the applicant-side-input variant. A classmate helped refine the prompts used for LLM issue extraction.

Limitations

  • The research focuses on Taiwanese labor litigation; results should not be assumed to transfer to other case types or jurisdictions.
  • LLM extraction errors can propagate into representations and recommendations.
  • The interface's color coding shows assigned issue groups, not a causal explanation of the classifier's decision.
  • Historical judgments and automated similarity predictions require human interpretation. This is a research demonstration, not a substitute for legal advice.
  • The original environment dates to 2024; compatibility with current dependency versions has not been revalidated for this documentation update.

Archived version

Project snapshot

This card describes the thesis workflow. It does not assert that every experiment or training artifact is included in this snapshot.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support