Ayushi054's picture
Add CourtInsight BNS Encoder model card
7d69e41 verified
|
Raw History Blame Contribute Delete
4.08 kB
metadata
language:
  - en
license: apache-2.0
library_name: sentence-transformers
pipeline_tag: sentence-similarity
tags:
  - legal
  - legal-retrieval
  - bns
  - indian-law
  - semantic-search
  - information-retrieval
  - sentence-transformers

CourtInsight BNS Encoder

CourtInsight BNS Encoder is a BNS-specific semantic embedding model developed for the CourtInsight legal-information retrieval system.

The model is designed to retrieve relevant provisions of the Bharatiya Nyaya Sanhita, 2023 (BNS) from natural-language descriptions of legal situations.

The retrieval approach is semantic and does not use keyword matching, BM25 retrieval, manually defined keyword lists, or hard-coded section mappings.

Intended Use

  • Semantic search over BNS 2023
  • BNS provision retrieval
  • Legal-information retrieval
  • Retrieval-Augmented Generation (RAG)
  • Legal education and research applications
  • Natural-language search interfaces

The model is not a legal-advice system and should not be used to determine legal liability, make judicial decisions, or replace qualified legal professionals.

Base Model

nomic-ai/nomic-embed-text-v1.5

The model is compatible with Sentence Transformers.

For queries, use the prefix:

search_query:

For documents, use:

search_document:

Training

The training corpus was constructed from a structured dataset covering 358 BNS 2023 sections.

The dataset contains statutory information including section number, section title, operative text, explanation, illustration, legal elements, and element summaries.

Semantic hard-negative mining was performed using the base Nomic embedding model.

The V3 training dataset contained 10,545 query-positive-negative triplets.

Training used TripletLoss with cosine distance.

Training Configuration

Parameter Value
Base model nomic-ai/nomic-embed-text-v1.5
Loss TripletLoss
Distance Cosine distance
Triplet margin 0.5
Epochs 5
Effective batch size 16
Learning rate 2e-5
Maximum sequence length 512
Precision FP16

Evaluation

Controlled Natural Benchmark

15 manually constructed legal scenarios:

  • Top-1: 86.67%
  • Top-3: 93.33%
  • Top-5: 100%
  • MRR: 0.9167

These results use the complete CourtInsight retrieval pipeline.

100-Query Coverage Evaluation

  • Top-1: 99.00%
  • Top-3: 100.00%
  • Top-5: 100.00%
  • MRR: 0.9950

This benchmark is statute-derived and should not be interpreted as real-world user-query accuracy.

1,074-Query Held-Out Evaluation

  • Top-1: 98.23%
  • Top-3: 99.72%
  • Top-5: 99.72%
  • MRR: 0.9899

This benchmark is synthetic/title-derived and should not be interpreted as real-world legal accuracy.

CourtInsight Architecture

User Query

→ CourtInsight BNS Encoder

→ Top-10 Semantic Candidates

→ Cross-Encoder Reranking

→ Nomic + Cross-Encoder Score Fusion

→ Top-3 BNS Provisions

The retrieval pipeline does not use keyword matching, BM25, or hard-coded section mappings.

Example

from sentence_transformers import SentenceTransformer

model = SentenceTransformer(
    "Ayushi054/CourtInsight-BNS-Encoder",
    trust_remote_code=True
)

query = "A person knowingly uses a forged document as genuine."

embedding = model.encode(
    "search_query: " + query,
    normalize_embeddings=True
)

Limitations

  • Specialized for the Bharatiya Nyaya Sanhita, 2023.
  • English-language retrieval.
  • Not a case-law retrieval model.
  • Ambiguous or incomplete queries may retrieve closely related provisions.
  • Similar statutory provisions can be difficult to distinguish.
  • Evaluation results do not establish real-world legal accuracy.
  • Retrieved provisions should be independently verified against the applicable legislation.

License

Apache-2.0

Disclaimer

CourtInsight is an experimental/research legal-information retrieval system. It is intended to help users locate potentially relevant BNS provisions. It does not provide legal advice and should not be treated as a substitute for a qualified legal professional or authoritative legal source.