- The paper introduces a four-stage framework that mimics judicial workflows by integrating retrieval, reasoning, prediction, and explanation.
- It employs domain-specific LLMs fine-tuned on a large Indian legal corpus, enhancing evidence alignment and transparent decision-making.
- It demonstrates that maintaining high weight precision is crucial for robust legal reasoning, as aggressive quantization negatively impacts performance.
NyayaMind: A Transparent CJPE Framework for Indian Legal Reasoning
Motivation and Context
Court Judgment Prediction and Explanation (CJPE) demands not only robust outcome prediction, but also legally grounded, verifiable reasoning traces—a requirement particularly salient in high-stakes legal domains such as judicial decision support. The Indian legal ecosystem faces unique complexity: over 50 million pending cases, multilingual jurisprudence, and extensive reliance on statutory law and precedent. Prior CJPE systems for India have achieved improvements in outcome prediction via LLMs and RAG-based retrieval, but typically lack explicit modeling of the multi-stage, deliberative process that human judges follow—resulting in brittle explanations and poor evidence alignment. NyayaMind directly operationalizes the call for transparent, structured, and scalable legal reasoning, integrating retrieval, stepwise reasoning, prediction, and explanation with domain-specialized LLMs.
Figure 1: Comparative overview situating NyayaMind against prior CJPE and LJP systems, highlighting its structured, evidence-aligned reasoning paradigm.
System Architecture and Task Decomposition
NyayaMind is architected as a four-stage reasoning pipeline: Retrieval, Reasoning, Prediction, and Explanation. Each stage mirrors judicial workflow, generating intermediate artifacts that enhance interpretability and verifiability.
- Retrieval: A RAG-based module leverages India's largest known legal corpus (16M+ cases, 1K+ Central Acts, 7K+ State Acts) to extract statutes and precedents relevant to case facts. Retrieval is implemented via three complementary architectures (Endee, Milvus, Vespa), combining dense vector (Snowflake-Arctic-Embed) and BM25 lexical retrieval, with hybrid fusion for optimal semantic and textual coverage. Relevance is cast as a binary classification per statute or precedent, accepting only those documents that surpass semantic similarity and legal context thresholds.
- Reasoning: Conditioned on case facts and retrieved legal documents, fine-tuned, reasoning-oriented LLMs generate a tripartite intermediate: legal issue(s), petitioner arguments, respondent arguments. This enforces explicit modeling of the argumentation structure, enabling post hoc analysis and ensuring generated rationales can be mapped to concrete legal principles.
- Prediction: The final legal decision—accept or reject appeal—is output, informed by case context and structured reasoning. The decision is not generated directly from raw facts, but via a stepwise deliberative process rooted in retrieved legal authority and the modeled argument structure.
- Explanation: Integrates the above: assembling an explicit, evidence-referenced rationale that aligns the prediction with supporting statutes, precedents, controverted issues, and party arguments, providing a comprehensive interpretive trace.
Figure 2: Schematic of NyayaMind’s multi-stage processing, illustrating data flow from user input through retrieval, stepwise reasoning, prediction, and structured explanation.
Dataset Construction and Domain Adaptation
NyayaMind introduces a legal database exceeding 16M documents uniquely tailored for the Indian domain, enabling exhaustive RAG-based retrieval. For structured legal reasoning, fine-tuning leverages an adapted version of the LegalSeg dataset [nigam-etal-2025-legalseg]: over 7,000 Indian court cases annotated with rhetorical roles (Facts, Issues, Arguments, Reasoning, Decision). A custom pre-processing pipeline transforms these annotations into input-output pairs for instruction-based LLM fine-tuning, preserving legal semantics and enhancing supervised learning of stepwise legal reasoning.
Model Architecture and Parameter-efficient Fine-tuning
Four LLMs—DeepSeek-R1-Distill-Qwen-14B, Phi-4-mini-reasoning, Phi-4-reasoning, and Qwen3.5-27B—serve as backbones for the Prediction module. All are further specialized for CJPE with parameter-efficient adaptation via LoRA/QLoRA [hu2021loralowrankadaptationlarge, dettmers2023qloraefficientfinetuningquantized], supporting token windows up to 32K for long-context legal documents and permitting high-scale ablation across quantization regimes (4/8/16/32-bit) to assess reasoning stability versus computational cost.
Prompt templates enforce a strict output format: legal issue analysis, party arguments, deliberation, label, and explanation, with step-by-step "think tokens" guiding the LLM through the full reasoning schema. This design prevents shortcut learning and supports fine-grained model evaluation at each reasoning stage.
Evaluation Methodology and Key Results
Comprehensive evaluation combines automatic scoring (ROUGE, BLEU, METEOR, BERTScore, BLANC) and expert legal annotation (Likert-scale assessment by practitioners on factuality, coherence, completeness, and legal plausibility of intermediate and final outputs).
- Structured Reasoning: Larger models—Qwen3.5-27B—demonstrate superior structured reasoning fidelity, with BERTScore improvements up to 58.3 for petitioner arguments (vs. 57.1 for DeepSeek R1-14B) and overall higher expert ratings for legal issue identification (average 7.1/10).
- Outcome Prediction: Qwen3.5-27B achieves higher lexical and semantic alignment with reference decisions (ROUGE-L up to 38.3, BERTScore 67.3, expert rating 7.24/10).
- Explanation Generation: Explanations by Qwen3.5-27B are semantically richer (BERTScore 61.9, BLANC 9.77) and rated more coherent by experts, though higher lexical overlap (ROUGE) is marginally better for DeepSeek.
- Quantization Ablation: 4-bit and 8-bit models exhibit output degradation—repetition, hallucination, and loss of stepwise structure—emphasizing that high-precision weights (16–32-bit) are necessary for complex legal reasoning tasks.
- Retrieval Impact: Fusion of semantic and lexical retrieval (especially RRF hybrid) is essential; pure vector or pure BM25 retrieval insufficiently capture the legal context, directly impacting downstream reasoning quality.
Implications and Theoretical Contributions
NyayaMind's architecture advances the state-of-the-art in transparent legal AI for several reasons:
- By modeling the full structure of judicial deliberation—not just the outcome—NyayaMind aligns generated rationales with the stepwise analysis used in real courts. This contrasts prior models that conflate factual conditioning and decision, potentially hallucinating explanations unanchored in precedent [wu-etal-2023-precedent].
- The integration of large-scale, domain-specific retrieval substantially improves the grounding of predictions, addressing the "black-box" problem prominent in Indian and international LJP [benedetto2025boosting, papadouli2022transparency].
- Quantization ablation reveals a clear trade-off: aggressive weight reduction destabilizes stepwise reasoning and introduces repetition/artifacts—a consideration for practical legal deployment at scale.
By assembling the largest Indian case/statute RAG corpus and enforcing strict reasoning formats, NyayaMind also establishes a robust benchmark for future multilingual/verifiable legal AI.
Future Directions
Critical limitations for real-world deployment remain:
- Current models are restricted to English, excluding regional language legal material common in lower Indian courts.
- Input/output context length constraints (16K–32K) preclude end-to-end modeling for ultra-long cases; chunk-wise or hierarchical long-context modeling is needed.
- Verification of generated rationales against retrieved legal sources is not explicitly guaranteed; future iterations must prioritize automatic fact/claim checking, perhaps via retrieval-augmented chain-of-thought or agentic legal reasoning models [yao-etal-2025-elevating, zhou2026lras].
- Expansion to interactive, agentic frameworks or iterative deliberation agents may enable handling of multi-party, multi-stage, or appellate workflows with richer procedural modeling.
Conclusion
NyayaMind provides a transparent, scalable, and reproducible framework for stepwise legal reasoning and judgment prediction in the Indian context (2604.09069). Its retrieval-reasoning-prediction-explanation paradigm, grounded in large legal corpora and expert-verified reasoning LLMs, substantially improves explanation quality and decision verifiability compared to prior Indian CJPE approaches. Results indicate that model scale and weight precision are critical for stable stepwise legal reasoning. Addressing multilinguality, long-context modeling, and formal verification is essential for further progress in trustworthy, transparent legal AI.