AI-Powered Legal Assistance in Pakistani Law: A RAG-Based Framework for Context-Aware and Reliable Legal Answer - Manzar Ali; Sameer Imtiaz; Farheen Qazi; Saad Khan; Syed Muneer (International Journal of Multidisciplinary Conference Proceedings (IJMCP), 2025)
The complexity of legal frameworks and the limited availability of legal material for the population and legal experts pose substantial obstacles in working through Pakistan’s law. This paper presents a framework that makes use of pre-trained large language models (LLMs) and Retrieval Augmented Generation (RAG) to provide scalable, accurate, and context-aware legal answers for legal questions based on Pakistani law. Our system utilizes a hybrid search method blending vector-based semantic search with keyword-based retrieval for searching key Pakistani legal documents in a vector database, such as the Code of Criminal Procedure 1898, Pakistan Penal Code, Muslim Family Laws Ordinance, and West Pakistan Family Court Act. Our system overcomes challenges of fact hallucination and subtle contextual understanding by injecting domain-specific knowledge of law into the LLM using RAG. We assess the framework’s performance to capture pertinent legal provisions, produce precise explanations, and yield actionable insights for various legal queries. Experiments show that the hybrid search approach surpasses single-modality retrieval by combining semantic comprehension with accurate keyword matching to enhance precision and reliability This research showcases the promise of AI-powered legal aid tools to democratize access to justice in Pakistan, empowering citizens, legal experts, and policymakers with a fast, affordable means of navigating complex legal environments