Logo Lanfrica

AamirAyoub123/RAG-LawAssistant-Morocco-V1

Domain:

natural language processing

Record type:

software
Creator:
Aam
Host:
A lightweight RAG-based AI assistant featuring FLAN-T5 Large fine-tuned on Moroccan legal texts for specialized Family Code analysis. The system compares original vs fine-tuned FLAN-T5 for optimal legal Q&A performance, leveraging Qdrant for vector search and SentenceTransformers for embeddings. Optimized to run on CPU and deployable via Docker. # 🏛️ Moroccan Legal RAG Assistant **Fine-tuned FLAN-T5 for Moroccan Family Code Analysis** ## 🌐 Project Overview In the complex landscape of Moroccan legal documentation, accessing and interpreting the Family Code requires specialized expertise. This project implements a **Retrieval-Augmented Generation (RAG)** system fine-tuned specifically on Moroccan legal texts, providing instant, accurate answers to legal questions in French contexts. Our system bridges the gap between **legal complexity** and **public accessibility**, offering a specialized AI assistant that understands Moroccan legal terminology, articles, and procedures. ## 🎯 Objectives - Provide **accurate, context-aware answers** to Moroccan Family Code questions - **Fine-tune FLAN-T5** on Moroccan legal texts for domain specialization - Implement **vector search** for precise legal document retrieval - Compare **Original vs Fine-tuned** model performance - Create an **intuitive web interface** for legal professionals and citizens # 🚀 Features Overview ### **1. Model Comparison UI** Compare: - Original FLAN-T5 Large - Fine-tuned FLAN-T5 (trained on Moroccan Family Code) Metrics displayed: - Precision - Speed - Completeness - Citation accuracy - Final LL.M judgement ### **2. Legal-Aware Backend (FastAPI)** - Embedding-based retriever - Domain-adapted generation - Article-level grounding ### **3. Vector Database (Qdrant)** - Stores 768-dim embeddings - Fast cosine search - Scalable for large corpora ## ⚙️ Technical Stack | Category | Tools / Libraries | |----------|-------------------| | **Language Models** | FLAN-T5 Large, SentenceTransformers | | **Vector Database** | Qdrant | | **Backend Framework** | FastAPI | | **Frontend** | HTML/CSS/JavaScript, Jinja2 | | **Containerization** | Docker | | **Machine Learning** | Transformers, PyTorch, HuggingFace | | **Text Processing** | NLTK, regex, pandas | ## 🏗️ Architecture …