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

Update README.md

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