Legal Digest: Constitution of India Question Answering (FLAN-T5)
Model Description
This model is a fine-tuned version of FLAN-T5 Small designed to
answer questions about the Constitution of India.
It was trained on a curated question–answer dataset derived from
constitutional articles and provisions.
Example questions:
What does Article 14 of the Constitution of India state?
What is prohibited by Article 15 of the Constitution of India?
What is the right to life and personal liberty?
Model Details
Developed by: Ayush Kumar
Model type: Sequence-to-sequence transformer
Base model: google/flan-t5-small
Task: Question Answering
Language: English
License: MIT
Intended Use
This model can be used for:
Legal question answering
Educational tools related to the Constitution of India
Legal information retrieval systems
Prototype legal assistants
Out-of-Scope Use
This model should not be used for:
Professional legal advice
Courtroom decision making
Legal interpretation for litigation
Example Usage
python
1from transformers import T5Tokenizer, T5ForConditionalGeneration
23model = T5ForConditionalGeneration.from_pretrained("ayush9h/legal-digest-flan-t5-small")4tokenizer = T5Tokenizer.from_pretrained("ayush9h/legal-digest-flan-t5-small")56query ="What does Article 14 of the Constitution of India state?"78inputs = tokenizer("Please answer the question in detail format: "+ query, return_tensors="pt")9outputs = model.generate(**inputs)1011print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Training Data
The model was trained on a Constitution of India Question Answering
dataset containing question–answer pairs extracted from constitutional
provisions.
Example format:
{
"question": "...",
"answer": "..."
}
Example:
Question What does Article 14 of the Constitution of India state?
Answer Article 14 states that the State shall not deny to any person
equality before the law or equal protection of the laws within the
territory of India.
Preprocessing
Training inputs were formatted as:
Please answer the question in detail format: <question>
Tokenization settings:
Input max length: 128 tokens
Output max length: 512 tokens
Padding: max_length
Truncation: enabled
Training Procedure
The model was fine-tuned using Hugging Face Seq2SeqTrainer.
Key settings:
Parameter
Value
Base Model
FLAN-T5 Small
Framework
Hugging Face Transformers
Mixed Precision
FP16 (when GPU available)
Evaluation
The model was evaluated using:
Exact Match (EM)
F1 Score
ROUGE-L
These metrics measure similarity between generated answers and reference
answers.
Limitations
Dataset limited to constitutional QA
Model may hallucinate explanations
Performance decreases outside this domain
Users should verify answers with official legal sources.
Technical Specifications
Architecture
Transformer encoder–decoder architecture (T5).
Approximate parameters: ~80M
Project System
This model is part of the Legal Digest ML system which includes: