--- license: apache-2.0 language: - en library_name: transformers pipeline_tag: text-classification tags: - legal-ai - inlegalbert - nlp - law - legal-outcome-prediction - text-classification - bert - indian-legal base_model: - law-ai/InLegalBERT metrics: - accuracy - precision - recall - f1 --- # โš–๏ธ JustiFi โ€“ InLegalBERT Legal Outcome Predictor Fine-tuned **InLegalBERT** model for **legal outcome prediction** on Indian legal documents. This model predicts whether a legal case is: - **REJECT (0)** - **ACCEPT (1)** The system is designed for long legal documents and uses **chunk-based processing** to overcome the 512-token limitation of BERT models. --- # ๐Ÿ“Œ Project Overview Legal documents are often lengthy and contain complex legal language. Traditional machine learning methods struggle to capture contextual relationships in such texts. This project fine-tunes **InLegalBERT**, a legal-domain transformer model, to perform legal outcome prediction using Indian legal datasets. The workflow includes: ```text Input Legal Document โ†“ PDF/Text Extraction โ†“ Tokenization โ†“ Chunk Generation (512 tokens) โ†“ InLegalBERT Prediction โ†“ Chunk Aggregation โ†“ Final Outcome (REJECT / ACCEPT) ``` --- # ๐Ÿง  Model Information | Property | Value | |----------|--------| | Base Model | InLegalBERT | | Architecture | BertForSequenceClassification | | Task | Binary Classification | | Classes | REJECT / ACCEPT | | Max Tokens | 512 | | Prediction Method | Chunk Aggregation | | Domain | Legal NLP | --- # ๐Ÿ“Š Model Performance Evaluation was performed using chunk-based document prediction. | Metric | Score | |---------|--------| | Accuracy | 0.70 | | Precision | 0.71 | | Recall | 0.71 | | F1 Score | 0.71 | --- # โš™๏ธ Features โœ… Legal outcome prediction โœ… Fine-tuned InLegalBERT model โœ… Long document support โœ… Chunk-based inference โœ… PDF processing pipeline โœ… FastAPI deployment support โœ… Confidence scoring --- # ๐Ÿ“‚ Labels ```python 0 โ†’ REJECT 1 โ†’ ACCEPT ``` Model mapping: ```python id2label = { 0: "REJECT", 1: "ACCEPT" } ``` --- # ๐Ÿš€ Usage Install dependencies: ```bash pip install transformers torch ``` Load model: ```python from transformers import pipeline classifier = pipeline( "text-classification", model="vikas-maurya/justifi-inlegalbert-outcome-predictor" ) text = """ Legal case description text here """ result = classifier(text) print(result) ``` Example output: ```python [ { 'label':'ACCEPT', 'score':0.74 } ] ``` --- # ๐Ÿ”ฌ Training Configuration | Parameter | Value | |-----------|--------| | Learning Rate | 2e-5 | | Batch Size | 4 | | Gradient Accumulation | 4 | | Optimizer | AdamW | | Loss Function | Cross Entropy | | Mixed Precision | FP16 | | Training Steps | ~4500 | --- # ๐Ÿ“ˆ Evaluation Methods The project includes: - Accuracy vs Epoch - Precisionโ€“Recall Curve - Confusion Matrix - Confidence Distribution - Response Time Analysis --- # ๐Ÿ— Deployment The model was integrated into: - FastAPI backend - PDF upload pipeline - Chunk-based prediction system Output format: ```json { "prediction":"ACCEPT", "confidence":0.64, "num_chunks":7 } ``` --- # โš  Limitations - Trained on Indian legal documents only - Limited generalization to other jurisdictions - Long documents require chunk aggregation - Similar case retrieval not included in current version --- # ๐Ÿ”ฎ Future Improvements - Legal summarization - Explainability module - Similar case retrieval - Legal chatbot - Multilingual support - Outcome reasoning --- # ๐Ÿ‘จโ€๐Ÿ’ป Author **Vikas Maurya** Final Year Computer Engineering Student Focus Areas: - NLP - Legal AI - Deep Learning - Transformer Models - Generative AI Project: **JustiFi โ€“ AI Powered Legal Intelligence System** --- # ๐Ÿ“œ Citation If using this model in academic work: ```bibtex @misc{justifi_inlegalbert, title={JustiFi: InLegalBERT Legal Outcome Predictor}, author={Vikas Maurya}, year={2026} } ``` ---