Skip to content
Tihum Kabir
All case files

Case file 02 · Generative AI / NLP

Bangladesh Legal RAG Chatbot

Bilingual legal answers, with receipts · Personal project

  • Mistral-7B
  • LangChain
  • FAISS
  • Sentence-Transformers
  • Gradio
  • Python
  • Hugging Face

Beat 01

The Dilemma

Bangladeshi law is hard to read and split across two languages: the acts are in English, while plenty of everyday filings are in Bengali. Most people need a lawyer just to find the right section.

Status: Warning · Access-to-law barrier

Language gap
English statutes · Bengali filings
Readability
Dense legalese
Access
Largely lawyer-gated
LLM risk
Hallucinated citations

Baseline: qualitative problem signals

Beat 02

The Hypothesis

Give an open-weight LLM a bilingual search engine over the actual statutes, and it can answer with citations instead of making things up.

System blueprint

  1. STAGE 01Statutes + judgmentsPenal Code 1860 · Labour Act 2006 · case law
  2. STAGE 02Multilingual embeddingsSentence-Transformers
  3. STAGE 03FAISS vector indexDense top-k retrieval
  4. STAGE 04Language ID + BN↔EN translationBidirectional pivot
  5. STAGE 05Mistral-7B-Instruct4-bit quantized generation
  6. STAGE 06Cited answerGradio chat interface

Beat 03

The Execution

Indexed the Penal Code 1860, the Labour Act 2006 and landmark judgments in FAISS with multilingual Sentence-Transformers, then paired it with a 4-bit Mistral-7B-Instruct plus language detection and Bengali-English translation in both directions.

Prompt tester · bilingual

Pick a sample question or type your own, then run the pipeline.

Simulated walkthrough · abridged statute excerpts · not legal advice

Validation

Built a Gradio app that checks each answer's citations against the real provisions.

Mistral-7B weight memory

  • FP1614.5 GB
  • 4-bit (NF4)3.6 GB

7.24B parameters × bits ÷ 8. Weights only; runtime overhead is extra.

Quantization

4-bit (NF4)

Reported latency

< 1.2s

End-to-end response, prototype

Beat 04

The Impact

Statute-grounded answers in both languages, served by an open-weight model small enough for commodity hardware.

Quantization
4-bit (NF4)
Fits commodity GPUs
Latency
< 1.2s
End-to-end response
Coverage
Penal Code 1860, Labour Act 2006, Supreme Court Precedents
Indexed sources

Figures as reported for the prototype.

Next case fileScintNet-KD: Spotting bone metastasis in whole-body scans