abhinavdread commited on
Commit
11986ca
·
verified ·
1 Parent(s): a89d4bd

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +108 -0
README.md ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MSME Legal Dispute Classifier (Longformer, 6-Class)
2
+
3
+ ## Model Overview
4
+ This model is a multi-class legal document classifier designed to categorize MSME-related dispute cases into six statutory dispute categories. It is fine-tuned from `allenai/longformer-base-4096` and optimized for long-form legal documents up to 1200 tokens. The system is intended for automated dispute categorization, legal triage, and decision-support applications in MSME dispute resolution workflows.
5
+
6
+ ## Problem Statement
7
+ MSME dispute cases often involve lengthy legal narratives including:
8
+
9
+ - Statement of claim
10
+ - Buyer response
11
+ - Case summary
12
+ - Contractual and payment details
13
+
14
+ Manual classification is time-consuming and error-prone. This model automates dispute categorization into predefined legal classes.
15
+
16
+ ## Classification Labels
17
+ The model predicts one of the following six categories:
18
+
19
+ | Label ID | Category |
20
+ |----------|--------------------------------|
21
+ | 0 | Delayed payment (no dispute) |
22
+ | 1 | Quality dispute |
23
+ | 2 | No formal contract |
24
+ | 3 | Partial payment dispute |
25
+ | 4 | Government procurement delay |
26
+ | 5 | Service-related dispute |
27
+
28
+ Label mapping is included in `label_mapping.json`.
29
+
30
+ ## Model Architecture
31
+ - **Base Model**: Longformer
32
+ - **Checkpoint**: `allenai/longformer-base-4096`
33
+ - **Max Sequence Length**: 1200 tokens
34
+ - **Hidden Size**: 768
35
+ - **Number of Layers**: 12
36
+ - **Attention Type**: Local attention (CLS token classification)
37
+ - **Classification Head**: Linear layer (6 outputs)
38
+
39
+ Longformer was selected due to the long-document nature of legal dispute texts.
40
+
41
+ ## Dataset Information
42
+ - Final Dataset Size (after cleaning): 2152 samples
43
+ - Duplicates Removed
44
+ - Label conflicts resolved
45
+ - Stratified 80–20 train/test split
46
+ - 5-fold stratified cross-validation
47
+
48
+ Class imbalance handled using weighted cross-entropy loss.
49
+
50
+ ## Training Configuration
51
+ - **Optimizer**: AdamW
52
+ - **Learning Rate**: 2e-5
53
+ - **Batch Size**: 2
54
+ - **Gradient Accumulation Steps**: 4
55
+ - **Effective Batch Size**: 8
56
+ - **Epochs**: 3
57
+ - **Warmup Steps**: 200
58
+ - **Mixed Precision (FP16)**: Enabled
59
+ - **Loss Function**: Weighted Cross Entropy
60
+
61
+ ## Evaluation Results (Held-Out Test Set)
62
+ Test Set Size: 431 samples
63
+
64
+ | Metric | Score |
65
+ |-------------------------|-------|
66
+ | Accuracy | 0.77 |
67
+ | Macro Precision | 0.76 |
68
+ | Macro Recall | 0.74 |
69
+ | Macro F1 Score | 0.75 |
70
+ | Macro AUC-ROC (OvR) | 0.948 |
71
+
72
+ These results indicate strong class separability and balanced performance across all categories.
73
+
74
+ ## Confusion Behavior
75
+ - Strong performance on Service-related and Government delay cases
76
+ - Moderate confusion between Quality disputes and Partial payment disputes
77
+ - Balanced macro performance across all classes
78
+
79
+ ## Intended Use
80
+ This model is suitable for:
81
+ - Automated legal dispute classification
82
+ - MSME case triage systems
83
+ - Online Dispute Resolution (ODR) platforms
84
+ - Legal analytics systems
85
+ - Case routing and prioritization tools
86
+
87
+ ## Limitations
88
+ - Performance may degrade for documents significantly exceeding 1200 tokens.
89
+ - Domain-specific to MSME dispute scenarios.
90
+ - Not designed for general legal classification tasks.
91
+ - Should not be used as a substitute for legal judgment.
92
+
93
+ ## Ethical Considerations
94
+ This model is intended as a decision-support tool. Human oversight is recommended for legal decision-making applications. It does not provide legal advice.
95
+
96
+ ## Usage Example
97
+ ```python
98
+ from transformers import LongformerForSequenceClassification, AutoTokenizer
99
+ import torch
100
+
101
+ model = LongformerForSequenceClassification.from_pretrained("YOUR_USERNAME/msme-legal-dispute-classifier-longformer")
102
+ tokenizer = AutoTokenizer.from_pretrained("YOUR_USERNAME/msme-legal-dispute-classifier-longformer")
103
+
104
+ text = "The buyer failed to release payment within the agreed 45-day period."
105
+ inputs = tokenizer(text, truncation=True, max_length=1200, return_tensors="pt")
106
+ outputs = model(**inputs)
107
+ predicted_class = torch.argmax(outputs.logits, dim=1)
108
+ print("Predicted Label:", predicted_class.item())