Downloads · 30 days
13
7% of all-time downloads
vikas-maurya/justifi-inlegalbert-outcome-predictor
justifi-inlegalbert-outcome-predictor is a text classification model from vikas-maurya. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
13
7% of all-time downloads
All-time downloads
183
Public
Parameters
109M
438 MB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors438 MB · 100%
From the Hugging Face model README
AI-Powered Legal Intelligence for Indian Legal Documents
A fine-tuned transformer model for legal outcome classification, built using InLegalBERT and designed to support long legal documents through chunk-based inference.
</div>JustiFi is an AI-powered legal intelligence project that uses a fine-tuned InLegalBERT model to classify Indian legal documents into two outcome categories: ACCEPT and REJECT.
Legal documents often contain lengthy arguments, complex terminology, and contextual relationships. Standard BERT models also have a limited input length of 512 tokens per sequence.
JustiFi addresses this input limitation through chunk-based processing, in which long documents are divided into smaller segments, processed individually, and combined to produce a document-level prediction.
The reported evaluation results for the chunk-based document prediction system are:
| Evaluation Metric | Score |
|---|---|
| 🎯 Accuracy | 70% |
| Precision | 71% |
| Recall | 71% |
| F1 Score | 71% |
These are the reported project results and are not a guarantee of performance on unseen legal cases.
The project includes the following evaluation analyses:
For reproducibility, the evaluation should specify the test-set size, dataset split, class distribution, and whether the metrics were calculated at the chunk or complete-document level.
The model processes legal documents through extraction, preprocessing, tokenization, chunk generation, transformer classification, and document-level aggregation.
flowchart TD
A["Legal Document"] --> B["PDF / Text Extraction"]
B --> C["Text Preprocessing"]
C --> D["Tokenizer"]
D --> E["Chunk Generation"]
E --> F["InLegalBERT Classifier"]
F --> G["Chunk-Level Predictions"]
G --> H["Document-Level Aggregation"]
H --> I["Final Prediction"]
H --> J["Confidence Score"]
I --> K["REJECT (0)"]
I --> L["ACCEPT (1)"]
classDef input fill:#e8f1ff,stroke:#3b82f6,color:#172554
classDef process fill:#f1f5f9,stroke:#64748b,color:#0f172a
classDef model fill:#ede9fe,stroke:#7c3aed,color:#2e1065
classDef output fill:#dcfce7,stroke:#16a34a,color:#14532d
class A input
class B,C,D,E,G,H process
class F model
class I,J,K,L output
The final prediction depends on the aggregation method implemented in the inference pipeline.
| Property | Description |
|---|---|
| Model Name | JustiFi InLegalBERT Outcome Predictor |
| Base Model | law-ai/InLegalBERT |
| Architecture | BERT Sequence Classification |
| Task | Binary Text Classification |
| Classes | REJECT / ACCEPT |
| Maximum Input Length | 512 tokens per sequence |
| Inference Method | Chunk-Based Processing |
| Framework | PyTorch |
| Model Library | Hugging Face Transformers |
| Backend | FastAPI |
| Domain | Indian Legal NLP |
| Class ID | Label |
|---|---|
0 | REJECT |
1 | ACCEPT |
id2label = {
0: "REJECT",
1: "ACCEPT"
}
label2id = {
"REJECT": 0,
"ACCEPT": 1
}
pip install transformers torch
from transformers import pipeline
MODEL_ID = "vikas-maurya/justifi-inlegalbert-outcome-predictor"
classifier = pipeline(
task="text-classification",
model=MODEL_ID,
tokenizer=MODEL_ID
)
text = """
Insert the legal document text here.
"""
result = classifier(
text,
truncation=True
)
print(result)
[
{
"label": "ACCEPT",
"score": 0.74
}
]
The output is illustrative and does not represent a live prediction.
Note: This example is intended for short text. Setting truncation=True does not implement long-document chunking or aggregation. For lengthy legal documents, use the project's complete inference pipeline.
Standard BERT models have a maximum input sequence length of 512 tokens. JustiFi uses chunk-based inference to process lengthy documents.
Legal Document
|
v
PDF / Text Extraction
|
v
Text Preprocessing
|
v
Tokenization
|
v
Chunk Generation
|
v
InLegalBERT Classification
|
v
Chunk-Level Predictions
|
v
Document-Level Aggregation
|
v
Final Prediction and Confidence
The inference implementation should specify whether chunks overlap and whether predictions are aggregated using majority voting, averaged probabilities, weighted aggregation, or another method.
The model is designed for integration with a FastAPI backend.
Example response:
{
"prediction": "ACCEPT",
"confidence": 0.64,
"num_chunks": 7
}
The values are illustrative and demonstrate the expected response structure.
The confidence score represents the model's output score. Unless calibration has been evaluated, it should not automatically be interpreted as the probability that the prediction is correct.
The reported training configuration is shown below.
| Parameter | Value |
|---|---|
| Learning Rate | 2e-5 |
| Batch Size | 4 |
| Gradient Accumulation Steps | 4 |
| Optimizer | AdamW |
| Loss Function | Cross Entropy |
| Mixed Precision | FP16 |
| Training Steps | Approximately 4,500 |
These values reflect the reported configuration. The effective batch size depends on the number of devices and the training setup.
| Component | Technology |
|---|---|
| Programming Language | Python |
| Base Model | InLegalBERT |
| Transformer Library | Hugging Face Transformers |
| Deep Learning Framework | PyTorch |
| NLP Task | Legal Text Classification |
| Backend | FastAPI |
| Document Processing | PDF and Text Extraction |
| Deployment | API-Based Inference |
JustiFi is intended for research, experimentation, and prototyping legal NLP workflows. It should not be used as the sole basis for legal decisions or as a substitute for qualified legal advice.
Vikas Maurya
Project: JustiFi — AI-Powered Legal Intelligence System
Focus areas include Legal AI, Natural Language Processing, Deep Learning, Transformer Models, and Generative AI.
If you use this model in academic or research work, you may cite it as follows:
@misc{justifi_inlegalbert,
title = {JustiFi: InLegalBERT Legal Outcome Predictor},
author = {Vikas Maurya},
year = {2026},
url = {https://huggingface.co/vikas-maurya/justifi-inlegalbert-outcome-predictor}
}
This repository declares the Apache-2.0 license in its model card metadata. Ensure that your use and redistribution also comply with the applicable terms of the base model and training data.
JustiFi — Transformer-Based Legal Intelligence for Indian Legal Documents
Developed by Vikas Maurya
</div>